diff --git a/killstats/tests/test_api/test_corporationssapi.py b/killstats/tests/test_api/test_corporationssapi.py index 73de246..52f107c 100644 --- a/killstats/tests/test_api/test_corporationssapi.py +++ b/killstats/tests/test_api/test_corporationssapi.py @@ -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) diff --git a/killstats/tests/test_tasks.py b/killstats/tests/test_tasks.py index 16e8338..f68dd66 100644 --- a/killstats/tests/test_tasks.py +++ b/killstats/tests/test_tasks.py @@ -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.") diff --git a/killstats/tests/testdata/eveuniverse.json b/killstats/tests/testdata/eveuniverse.json index c060b0c..e7900f6 100644 --- a/killstats/tests/testdata/eveuniverse.json +++ b/killstats/tests/testdata/eveuniverse.json @@ -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": [