-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update unit tests to reflect changes and add tests for utils
- Loading branch information
1 parent
e23daab
commit cb126f9
Showing
3 changed files
with
69 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import uuid | ||
from unittest.mock import patch | ||
from django.test import TestCase | ||
from decouple import config | ||
from user_api.utils import generate_verification_url | ||
|
||
|
||
class UtilsTestCase(TestCase): | ||
""" | ||
Test case for generate varification url. | ||
""" | ||
|
||
def test_generate_verification_url(self): | ||
""" | ||
Test generate varification url. | ||
""" | ||
# Given | ||
token = uuid.uuid4() | ||
test_base_url = config('FRONTEND_BASE_URL') | ||
|
||
# Mock the config method to return our test_base_url for 'FRONTEND_BASE_URL' | ||
with patch('user_api.utils.config', return_value=test_base_url): | ||
# When | ||
verification_url = generate_verification_url(token) | ||
|
||
# Then | ||
expected_url = f"{test_base_url}/verify-email/{token}/" | ||
self.assertEqual(verification_url, expected_url) |
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