Fakultas Ilmu Komputer UI

Commit 9d4335d9 authored by Dave Nathanael's avatar Dave Nathanael
Browse files

[REFACTOR] Use f-strings for string test assertions on test cases

parent eff3a8df
Pipeline #41466 passed with stages
in 4 minutes and 47 seconds
......@@ -125,9 +125,9 @@ class AccountViewTest(APITestCase):
response = self.client.get(self.LOGS_URL)
response_string = response.rendered_content.decode("utf-8")
self.assertIn('"object_id":"{}"'.format(new_officer_id), response_string)
self.assertIn(f'"object_id":"{new_officer_id}"', response_string)
self.assertIn(
'"action_type":"{}"'.format(ACTIVITY_TYPE_CREATE), response_string
f'"action_type":"{ACTIVITY_TYPE_CREATE}"', response_string
)
def test_create_new_account_fails_with_poor_password(self):
......@@ -175,8 +175,8 @@ class AccountViewTest(APITestCase):
response = self.client.get(self.LOGS_URL)
response_string = response.rendered_content.decode("utf-8")
self.assertIn('"object_id":"{}"'.format(self.officer.id), response_string)
self.assertIn('"action_type":"{}"'.format(ACTIVITY_TYPE_EDIT), response_string)
self.assertIn(f'"object_id":"{self.officer.id}"', response_string)
self.assertIn(f'"action_type":"{ACTIVITY_TYPE_EDIT}"', response_string)
def test_edit_account_fail_without_complete_fields(self):
url = self.BASE_URL + str(self.officer.id) + "/"
......@@ -201,9 +201,9 @@ class AccountViewTest(APITestCase):
response = self.client.get(self.LOGS_URL)
response_string = response.rendered_content.decode("utf-8")
self.assertIn('"object_id":"{}"'.format(self.officer.id), response_string)
self.assertIn(f'"object_id":"{self.officer.id}"', response_string)
self.assertIn(
'"action_type":"{}"'.format(ACTIVITY_TYPE_DELETE), response_string
f'"action_type":"{ACTIVITY_TYPE_DELETE}"', response_string
)
def test_retrieve_current_profile_success(self):
......
......@@ -109,10 +109,10 @@ class MonitoringCaseViewTest(APITestCase):
response_string = logs_response.rendered_content.decode("utf-8")
self.assertIn(
'"object_id":"{}"'.format(str(self.positive_investigation_case.id)), response_string
f'"object_id":"{str(self.positive_investigation_case.id)}"', response_string
)
self.assertIn(
'"action_type":"{}"'.format(ACTIVITY_TYPE_CREATE), response_string
f'"action_type":"{ACTIVITY_TYPE_CREATE}"', response_string
)
def test_edit_monitoring_case_success(self):
......@@ -130,8 +130,8 @@ class MonitoringCaseViewTest(APITestCase):
response = self.client.get(self.LOGS_URL)
response_string = response.rendered_content.decode("utf-8")
self.assertIn('"object_id":"{}"'.format(self.case_1.id), response_string)
self.assertIn('"action_type":"{}"'.format(ACTIVITY_TYPE_EDIT), response_string)
self.assertIn(f'"object_id":"{self.case_1.id}"', response_string)
self.assertIn(f'"action_type":"{ACTIVITY_TYPE_EDIT}"', response_string)
def test_soft_delete_monitoring_case_success(self):
url = self.BASE_URL + str(self.case_1.id) + "/"
......@@ -147,7 +147,7 @@ class MonitoringCaseViewTest(APITestCase):
response = self.client.get(self.LOGS_URL)
response_string = response.rendered_content.decode("utf-8")
self.assertIn('"object_id":"{}"'.format(self.case_1.id), response_string)
self.assertIn(f'"object_id":"{self.case_1.id}"', response_string)
self.assertIn(
'"action_type":"{}"'.format(ACTIVITY_TYPE_DELETE), response_string
f'"action_type":"{ACTIVITY_TYPE_DELETE}"', response_string
)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment