-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created TEST_NOTE.md and .coveragerc
- Loading branch information
Showing
2 changed files
with
65 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[run] | ||
omit = *migrations*, *tests* | ||
omit = | ||
*migrations* | ||
*templates* | ||
"rest_routes* | ||
plugins = django_coverage_plugin |
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,61 @@ | ||
def test_resend_User_otp_bad_request(self): | ||
data = {"email": "abram@hello.com"} | ||
response = self.client.post( | ||
"http://127.0.0.1:8000/rest_routes/resend_otp_code/", data | ||
) | ||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) | ||
self.assertEqual( | ||
response.data, | ||
{"status": "failed", "message": "Credentials does not match our record!"}, | ||
) | ||
|
||
def test_confirm_otp_bad_request(self): | ||
data = {"email": "abram@test.com", "otp_code": "453521"} | ||
response = self.client.post( | ||
"http://127.0.0.1:8000/rest_routes/confirm_otp/", data | ||
) | ||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) | ||
|
||
def test_logout(self): | ||
response = self.client.post("http://127.0.0.1:8000/rest_routes/logout/") | ||
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT) | ||
|
||
def test_email_otp_verify_page(self): | ||
response = self.client.get("http://127.0.0.1:8000/rest_routes/otp_verify/") | ||
self.assertEqual(response.status_code, 200) | ||
self.assertTemplateUsed(response, "emails/authentication/otp_verify.html") | ||
|
||
def test_welcome_user_page(self): | ||
response = self.client.get("http://127.0.0.1:8000/rest_routes/welcome/") | ||
self.assertEqual(response.status_code, 200) | ||
self.assertTemplateUsed(response, "emails/users/welcome.html") def test_resend_User_otp_bad_request(self): | ||
data = {"email": "abram@hello.com"} | ||
response = self.client.post( | ||
"http://127.0.0.1:8000/rest_routes/resend_otp_code/", data | ||
) | ||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) | ||
self.assertEqual( | ||
response.data, | ||
{"status": "failed", "message": "Credentials does not match our record!"}, | ||
) | ||
|
||
def test_confirm_otp_bad_request(self): | ||
data = {"email": "abram@test.com", "otp_code": "453521"} | ||
response = self.client.post( | ||
"http://127.0.0.1:8000/rest_routes/confirm_otp/", data | ||
) | ||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) | ||
|
||
def test_logout(self): | ||
response = self.client.post("http://127.0.0.1:8000/rest_routes/logout/") | ||
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT) | ||
|
||
def test_email_otp_verify_page(self): | ||
response = self.client.get("http://127.0.0.1:8000/rest_routes/otp_verify/") | ||
self.assertEqual(response.status_code, 200) | ||
self.assertTemplateUsed(response, "emails/authentication/otp_verify.html") | ||
|
||
def test_welcome_user_page(self): | ||
response = self.client.get("http://127.0.0.1:8000/rest_routes/welcome/") | ||
self.assertEqual(response.status_code, 200) | ||
self.assertTemplateUsed(response, "emails/users/welcome.html") |