Skip to content

Commit

Permalink
[MISC] Update Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Geuthur committed Oct 14, 2024
1 parent 12bd251 commit e465d1c
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 2 deletions.
2 changes: 0 additions & 2 deletions killstats/tests/test_api/test_corporationssapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ def test_killmail_api_search(self):
# when
response = self.client.get(url)

print(response.json())

# then
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json(), expected_data)
Expand Down
32 changes: 32 additions & 0 deletions killstats/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,35 @@ def test_killmail_store_and_already_exist(
mock_logger.warning.assert_called_once_with(
"%s: Failed to store killmail, because it already exists", killmail_id
)

@patch(MODULE_PATH + ".KillmailManager.get_killmail_data_bulk")
@patch(MODULE_PATH + ".Killmail.objects.all")
@patch(MODULE_PATH + ".logger")
def test_killmail_update_corp_existing_kms(
self, mock_logger, mock_existing, mock_get_killmail_data_bulk
):
# given
corp = CorporationsAudit.objects.get(corporation__corporation_id=2001)
existing_kms = [119324952, 119324561, 119271433]
mock_get_killmail_data_bulk.return_value = _load_get_bulk_data()
mock_existing.return_value.values_list.return_value = existing_kms
# when
killmail_update_corp(corp.corporation.corporation_id)
# then
mock_logger.debug.assert_called_with("No new Killmail found.")

@patch(MODULE_PATH + ".KillmailManager.get_killmail_data_bulk")
@patch(MODULE_PATH + ".Killmail.objects.all")
@patch(MODULE_PATH + ".logger")
def test_killmail_update_ally_existing_kms(
self, mock_logger, mock_existing, mock_get_killmail_data_bulk
):
# given
ally = AlliancesAudit.objects.get(alliance__alliance_id=3001)
existing_kms = [119324952, 119324561, 119271433]
mock_get_killmail_data_bulk.return_value = _load_get_bulk_data()
mock_existing.return_value.values_list.return_value = existing_kms
# when
killmail_update_ally(ally.alliance.alliance_id)
# then
mock_logger.debug.assert_called_with("No new Killmail found.")
33 changes: 33 additions & 0 deletions killstats/tests/testdata/eveuniverse.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,39 @@
"position_y": 4.273309719085835e+16,
"position_z": 6568509050290774.0,
"security_status": 0.38548383116722107
},
{
"enabled_sections": 0,
"eve_constellation_id": 20000372,
"eve_star_id": null,
"id": 30002594,
"name": "Javrendei",
"position_x": -1.280818422914163e+17,
"position_y": 4.273309719085835e+16,
"position_z": 6568509050290774.0,
"security_status": 0.38548383116722107
},
{
"enabled_sections": 0,
"eve_constellation_id": 20000372,
"eve_star_id": null,
"id": 30002596,
"name": "Test System 2",
"position_x": -1.280818422914163e+17,
"position_y": 4.273309719085835e+16,
"position_z": 6568509050290774.0,
"security_status": 0.38548383116722107
},
{
"enabled_sections": 0,
"eve_constellation_id": 20000372,
"eve_star_id": null,
"id": 30002126,
"name": "Test System",
"position_x": -1.280818422914163e+17,
"position_y": 4.273309719085835e+16,
"position_z": 6568509050290774.0,
"security_status": 0.38548383116722107
}
],
"EveType": [
Expand Down

0 comments on commit e465d1c

Please sign in to comment.