generated from ocadotechnology/codeforlife-template-backend
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
28 additions
and
152 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
53 changes: 0 additions & 53 deletions
53
api/migrations/0002_agreementsignature_contributor_repository.py
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
from codeforlife.tests import ModelTestCase | ||
from django.db import IntegrityError | ||
|
||
# from .agreement_signature import AgreementSignature | ||
from .contributor import Contributor | ||
from .repository import Repository | ||
|
||
|
@@ -17,13 +16,14 @@ class TestRepository(ModelTestCase[Repository]): | |
fixtures = ["contributors", "repositories"] | ||
|
||
def setUp(self): | ||
self.repository = Repository.objects.get(pk=111) | ||
self.contributor1 = Contributor.objects.get(pk=111111) | ||
self.contributor2 = Contributor.objects.get(pk=222222) | ||
self.repository = Repository.objects.get(pk=1) | ||
self.contributor1 = Contributor.objects.get(pk=1) | ||
self.contributor2 = Contributor.objects.get(pk=2) | ||
|
||
def test_str(self): | ||
"""Parsing a contributor object instance to returns its name.""" | ||
assert str(self.repository) == self.repository.name | ||
expected = f"{self.repository.contributor}: {self.repository.gh_id}" | ||
assert str(self.repository) == expected | ||
|
||
def test_default_value(self): | ||
"""check default value of points if not assigned""" | ||
|
@@ -36,25 +36,23 @@ def test_default_value(self): | |
avatar_url="https://contributornew.github.io/", | ||
) | ||
repository = Repository.objects.create( | ||
id=999, contributor=new_contributor, name="portal" | ||
contributor=new_contributor, gh_id=432079567 | ||
) | ||
assert repository.points == 0 | ||
|
||
def test_unique_fields(self): | ||
"""Test the unique fields functionality""" | ||
new_contributor = Contributor.objects.create( | ||
id=999999, | ||
id=5134, | ||
email="[email protected]", | ||
name="new contributor", | ||
location="london", | ||
html_url="https://github.com/newcontributor", | ||
avatar_url="https://contributornew.github.io/", | ||
) | ||
Repository.objects.create( | ||
id=123, contributor=new_contributor, name="rr" | ||
) | ||
Repository.objects.create(contributor=new_contributor, gh_id=432079567) | ||
|
||
with self.assertRaises(IntegrityError): | ||
Repository.objects.create( | ||
id=999, contributor=self.contributor1, name="rr" | ||
contributor=self.contributor1, gh_id=10274252 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters