-
Notifications
You must be signed in to change notification settings - Fork 4
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
1 changed file
with
27 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
""" | ||
This module contains tests that test validation which are not related to the database. | ||
""" | ||
from helpers.validation import is_username_in_db | ||
from tests.test_base import TestBase | ||
|
||
|
||
class TestValidationWithDb(TestBase): | ||
""" | ||
Test functions that validate functions that involve data validation from the database""" | ||
|
||
def test_validate_username_exists_returns_none_if_username_does_not_exist( | ||
self): | ||
""" | ||
Should return None if the username does not exist | ||
""" | ||
self.assertIsNone(is_username_in_db('username')) | ||
|
||
def test_validate_username_exists_returns_user_object_if_username_exists( | ||
self): | ||
""" | ||
Should return User object if the username exists | ||
""" | ||
user = self.create_dummy_user('username') | ||
user_object = is_username_in_db('username') | ||
self.assertEqual(user_object.username, 'username') | ||
self.assertEqual(user_object.id, user.id) |