Skip to content

Commit

Permalink
chore(test): remove prints in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tdethier authored Nov 20, 2024
2 parents ba7374e + e1f0672 commit 3588332
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 15 deletions.
2 changes: 0 additions & 2 deletions iaso/tasks/create_payment_lot.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ def create_payment_lot(
# We want to filter out potential payments assigned to another task.
# Since the task is assigned in the view after it's created, we filter out potential payments with no task or with the current task assigned (for safety)
potential_payments = PotentialPayment.objects.filter(id__in=potential_payment_ids)
for p in potential_payments:
print(p.task.id)
potential_payments_for_lot = potential_payments.filter(task=the_task)
# potential_payments_for_lot = potential_payments.filter((Q(task__isnull=True) | Q(task=the_task)))
payment_lot.potential_payments.add(*potential_payments_for_lot, bulk=False)
Expand Down
4 changes: 2 additions & 2 deletions iaso/tests/api/test_orgunits.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,13 +554,13 @@ def test_org_unit_retrieve_with_instances_count(self):
response_descendant = self.client.get(f"/api/orgunits/{descendant_org_unit.id}/")
self.assertJSONResponse(response_descendant, 200)
descendant_instances_count = response_descendant.json()["instances_count"]
self.assertEquals(descendant_instances_count, 1)
self.assertEqual(descendant_instances_count, 1)

# Test the parent instances count
response_parent = self.client.get(f"/api/orgunits/{parent_org_unit.id}/")
self.assertJSONResponse(response_parent, 200)
parent_instances_count = response_parent.json()["instances_count"]
self.assertEquals(parent_instances_count, 2)
self.assertEqual(parent_instances_count, 2)

def test_can_retrieve_org_units_in_csv_format(self):
self.client.force_authenticate(self.yoda)
Expand Down
4 changes: 3 additions & 1 deletion iaso/tests/gpkg/test_import_with_sub_org_unit_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ def test_minimal_import_with_sub_org_unit_type(self):
self.assertJSONResponse(response, 200)
response_data = response.json()

updated_with_sub_types = update_org_unit_sub_type(self.client, self.project.id, response_data["orgUnitTypes"])
updated_with_sub_types = update_org_unit_sub_type(
self.client, self.project.id, response_data["orgUnitTypes"], False
)

for org_unit_type_with in updated_with_sub_types:
self.assertJSONResponse(org_unit_type_with, 200)
1 change: 0 additions & 1 deletion iaso/tests/tasks/test_export_mobile_app_setup_for_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def mocked_iaso_client_get(*args, **kwargs):
elif url.startswith("/api/formattachments/"):
return {"results": []}
else:
print(args)
# for all other calls, return an empty array
return []

Expand Down
1 change: 0 additions & 1 deletion plugins/polio/api/vaccines/supply_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ def to_internal_value(self, data):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
print("VaccineRequestFormPostSerializer instance created with data: %s", self.initial_data)

def to_representation(self, instance):
ret = super().to_representation(instance)
Expand Down
2 changes: 0 additions & 2 deletions plugins/polio/tests/test_im_refresh_hh_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,6 @@ def test_get_latest_for_country(self):
response = self.client.get(f"{self.action_url}?country_id={self.country_org_unit.id}")
response = self.assertJSONResponse(response, 200)
task = response["task"]
print("RESPONSE", response)
print("TASK", task)
self.assertEqual(task["id"], self.task1.id)
self.assertEqual(task["ended_at"], self.task1.ended_at)
self.assertEqual(task["status"], self.task1.status)
Expand Down
2 changes: 0 additions & 2 deletions plugins/polio/tests/test_im_refresh_hh_ohh_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,6 @@ def test_get_latest_for_country(self):
response = self.client.get(f"{self.action_url}?country_id={self.country_org_unit.id}")
response = self.assertJSONResponse(response, 200)
task = response["task"]
print("RESPONSE", response)
print("TASK", task)
self.assertEqual(task["id"], self.task1.id)
self.assertEqual(task["ended_at"], self.task1.ended_at)
self.assertEqual(task["status"], self.task1.status)
Expand Down
2 changes: 0 additions & 2 deletions plugins/polio/tests/test_im_refresh_ohh_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,6 @@ def test_get_latest_for_country(self):
response = self.client.get(f"{self.action_url}?country_id={self.country_org_unit.id}")
response = self.assertJSONResponse(response, 200)
task = response["task"]
print("RESPONSE", response)
print("TASK", task)
self.assertEqual(task["id"], self.task1.id)
self.assertEqual(task["ended_at"], self.task1.ended_at)
self.assertEqual(task["status"], self.task1.status)
Expand Down
5 changes: 3 additions & 2 deletions setuper/pyramid.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ def setup_orgunits(iaso_client):
iaso_client.wait_task_completion(task)


def update_org_unit_sub_type(iaso_client, project_id, org_unit_types):
print("-- Updating org unit sub type")
def update_org_unit_sub_type(iaso_client, project_id, org_unit_types, verbose: bool = True):
if verbose:
print("-- Updating org unit sub type")
updated_with_sub_types = []
for org_unit_type in org_unit_types:
org_unit_type_level = org_unit_type["depth"]
Expand Down

0 comments on commit 3588332

Please sign in to comment.