Skip to content

Commit

Permalink
Created TEST_NOTE.md and .coveragerc
Browse files Browse the repository at this point in the history
  • Loading branch information
aybruhm committed Aug 22, 2022
1 parent 30ff24b commit bdc6ebb
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .coveragerc
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
61 changes: 61 additions & 0 deletions TEST_NOTE.md
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")

0 comments on commit bdc6ebb

Please sign in to comment.