Skip to content

Commit

Permalink
test create user validation
Browse files Browse the repository at this point in the history
  • Loading branch information
kalsmic committed Jun 19, 2022
1 parent d90ce63 commit a7eb277
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/test_validation_with_db.py
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)

0 comments on commit a7eb277

Please sign in to comment.