-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from biocompute-objects/104-unit-testing-for-api
104 unit testing for api
- Loading branch information
Showing
6 changed files
with
170 additions
and
57 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env python3 | ||
|
||
"""Models Testing | ||
""" | ||
|
||
import json | ||
from django.test import TestCase | ||
from django.utils import timezone | ||
from django.contrib.auth.models import Group, Permission, User | ||
# from django.urls import reverse | ||
from api.models import new_users | ||
|
||
|
||
class NewUserTestCase(TestCase): | ||
"""Test for BCO""" | ||
|
||
def setUp(self): | ||
self.email = "[email protected]" | ||
self.temp_identifier = "OOO" | ||
self.token = "SampleToken" | ||
self.hostname = "UserDB" | ||
|
||
def create_user(self): | ||
"""Create Test User | ||
""" | ||
|
||
return new_users.objects.create( | ||
email="[email protected]", | ||
temp_identifier="OOO", | ||
token="SampleToken", | ||
hostname="UserDB" | ||
) | ||
|
||
def test_user_creation(self): | ||
"""Test user creation | ||
Creates new user, asserts that it is an instance of new_user, and asserts the email, | ||
token, and hostname match. | ||
""" | ||
|
||
user = self.create_user() | ||
self.assertTrue(isinstance(user, new_users)) | ||
self.assertEqual(user.__email__(), self.email) | ||
self.assertEqual(user.__token__(), self.token) | ||
self.assertEqual(user.__hostname__(), self.hostname) | ||
self.assertEqual(user.__temp_identifier__(), self.temp_identifier) |
Oops, something went wrong.