aa-intel-tool 2.6.1__py3-none-any.whl → 2.6.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. aa_intel_tool/__init__.py +1 -1
  2. aa_intel_tool/helper/eve_character.py +24 -36
  3. aa_intel_tool/helper/static_files.py +2 -2
  4. aa_intel_tool/locale/cs_CZ/LC_MESSAGES/django.po +30 -29
  5. aa_intel_tool/locale/de/LC_MESSAGES/django.mo +0 -0
  6. aa_intel_tool/locale/de/LC_MESSAGES/django.po +36 -35
  7. aa_intel_tool/locale/django.pot +31 -30
  8. aa_intel_tool/locale/es/LC_MESSAGES/django.po +32 -29
  9. aa_intel_tool/locale/fr_FR/LC_MESSAGES/django.mo +0 -0
  10. aa_intel_tool/locale/fr_FR/LC_MESSAGES/django.po +38 -33
  11. aa_intel_tool/locale/it_IT/LC_MESSAGES/django.po +30 -29
  12. aa_intel_tool/locale/ja/LC_MESSAGES/django.po +30 -29
  13. aa_intel_tool/locale/ko_KR/LC_MESSAGES/django.mo +0 -0
  14. aa_intel_tool/locale/ko_KR/LC_MESSAGES/django.po +39 -33
  15. aa_intel_tool/locale/nl_NL/LC_MESSAGES/django.po +30 -29
  16. aa_intel_tool/locale/pl_PL/LC_MESSAGES/django.po +30 -29
  17. aa_intel_tool/locale/ru/LC_MESSAGES/django.mo +0 -0
  18. aa_intel_tool/locale/ru/LC_MESSAGES/django.po +38 -33
  19. aa_intel_tool/locale/sk/LC_MESSAGES/django.po +30 -29
  20. aa_intel_tool/locale/uk/LC_MESSAGES/django.mo +0 -0
  21. aa_intel_tool/locale/uk/LC_MESSAGES/django.po +129 -123
  22. aa_intel_tool/locale/zh_Hans/LC_MESSAGES/django.po +32 -29
  23. aa_intel_tool/parser/general.py +11 -16
  24. aa_intel_tool/parser/helper/db.py +8 -11
  25. aa_intel_tool/parser/module/chatlist.py +97 -126
  26. aa_intel_tool/parser/module/dscan.py +115 -147
  27. aa_intel_tool/parser/module/fleetcomp.py +85 -102
  28. aa_intel_tool/static/aa_intel_tool/css/aa-intel-tool.css +6 -19
  29. aa_intel_tool/static/aa_intel_tool/css/aa-intel-tool.min.css +1 -1
  30. aa_intel_tool/static/aa_intel_tool/css/aa-intel-tool.min.css.map +1 -1
  31. aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan-highlight.js +104 -64
  32. aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan-highlight.min.js +1 -1
  33. aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan-highlight.min.js.map +1 -1
  34. aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan.js +59 -59
  35. aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan.min.js +1 -1
  36. aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-chatscan.min.js.map +1 -1
  37. aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan-highlight.js +43 -43
  38. aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan-highlight.min.js +1 -1
  39. aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan-highlight.min.js.map +1 -1
  40. aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan.js +146 -105
  41. aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan.min.js +1 -1
  42. aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-dscan.min.js.map +1 -1
  43. aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition-highlight.js +51 -51
  44. aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition-highlight.min.js +1 -1
  45. aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition-highlight.min.js.map +1 -1
  46. aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition.js +69 -59
  47. aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition.min.js +1 -1
  48. aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-fleetcomposition.min.js.map +1 -1
  49. aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-scan-result-common.js +54 -32
  50. aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-scan-result-common.min.js +1 -1
  51. aa_intel_tool/static/aa_intel_tool/javascript/aa-intel-tool-scan-result-common.min.js.map +1 -1
  52. aa_intel_tool/templates/aa_intel_tool/base.html +4 -2
  53. aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/alliances.html +0 -2
  54. aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/corporations.html +0 -2
  55. aa_intel_tool/templates/aa_intel_tool/partials/scan/chatlist/pilots.html +0 -2
  56. aa_intel_tool/templates/aa_intel_tool/partials/scan/evetime.html +1 -1
  57. aa_intel_tool/tests/test-data/dscan.txt +250 -0
  58. aa_intel_tool/tests/test_admin.py +50 -38
  59. aa_intel_tool/tests/test_helper_eve_character.py +405 -0
  60. aa_intel_tool/tests/test_models.py +188 -4
  61. aa_intel_tool/tests/test_parser_general.py +771 -0
  62. aa_intel_tool/tests/test_parser_module_chatlist.py +154 -0
  63. {aa_intel_tool-2.6.1.dist-info → aa_intel_tool-2.6.3.dist-info}/METADATA +4 -4
  64. {aa_intel_tool-2.6.1.dist-info → aa_intel_tool-2.6.3.dist-info}/RECORD +66 -64
  65. aa_intel_tool/tests/test_parser.py +0 -135
  66. {aa_intel_tool-2.6.1.dist-info → aa_intel_tool-2.6.3.dist-info}/WHEEL +0 -0
  67. {aa_intel_tool-2.6.1.dist-info → aa_intel_tool-2.6.3.dist-info}/licenses/LICENSE +0 -0
@@ -3,84 +3,96 @@ Test for admin.py
3
3
  """
4
4
 
5
5
  # Django
6
- from django.test import TestCase
6
+ from django.contrib import admin
7
+ from django.test import RequestFactory, TestCase
7
8
  from django.urls import reverse
8
9
 
9
- # Alliance Auth (External Libs)
10
- from app_utils.testing import create_fake_user
11
-
12
10
  # AA Intel Tool
13
- from aa_intel_tool.admin import BaseReadOnlyAdminMixin
11
+ from aa_intel_tool.admin import BaseReadOnlyAdminMixin, ScanAdmin
12
+ from aa_intel_tool.models import Scan
14
13
 
15
14
 
16
- class TestAdmin(TestCase):
15
+ class TestBaseReadOnlyAdminMixin(TestCase):
17
16
  """
18
- The tests
17
+ Test the BaseReadOnlyAdminMixin class
19
18
  """
20
19
 
21
- @classmethod
22
- def setUpClass(cls) -> None:
23
- """
24
- Set up groups and users
20
+ def test_add_permission_is_denied(self):
25
21
  """
22
+ Test if admin.BaseReadOnlyAdminMixin.has_add_permission returns False
26
23
 
27
- super().setUpClass()
24
+ :return:
25
+ :rtype:
26
+ """
28
27
 
29
- # User
30
- cls.user_1001 = create_fake_user(
31
- character_id=1001, character_name="Peter Parker"
28
+ request = RequestFactory().get(
29
+ path=reverse(viewname="aa_intel_tool:intel_tool_index")
32
30
  )
33
31
 
34
- def test_has_add_permission_returns_false(self):
32
+ self.assertFalse(BaseReadOnlyAdminMixin.has_add_permission(request))
33
+
34
+ def test_change_permission_is_denied(self):
35
35
  """
36
- Test if admin.BaseReadOnlyAdminMixin.has_add_permission returns False
36
+ Test if admin.BaseReadOnlyAdminMixin.has_change_permission returns False
37
37
 
38
38
  :return:
39
39
  :rtype:
40
40
  """
41
41
 
42
- self.client.force_login(user=self.user_1001)
43
-
44
- response = self.client.get(
42
+ request = RequestFactory().get(
45
43
  path=reverse(viewname="aa_intel_tool:intel_tool_index")
46
44
  )
47
45
 
48
- has_permission = BaseReadOnlyAdminMixin.has_add_permission(request=response)
49
-
50
- self.assertFalse(expr=has_permission)
46
+ self.assertFalse(BaseReadOnlyAdminMixin.has_change_permission(request))
51
47
 
52
- def test_has_change_permission_returns_false(self):
48
+ def test_delete_permission_is_denied(self):
53
49
  """
54
- Test if admin.BaseReadOnlyAdminMixin.has_change_permission returns False
50
+ Test if admin.BaseReadOnlyAdminMixin.has_delete_permission returns False
55
51
 
56
52
  :return:
57
53
  :rtype:
58
54
  """
59
55
 
60
- self.client.force_login(user=self.user_1001)
61
-
62
- response = self.client.get(
56
+ request = RequestFactory().get(
63
57
  path=reverse(viewname="aa_intel_tool:intel_tool_index")
64
58
  )
65
59
 
66
- has_permission = BaseReadOnlyAdminMixin.has_change_permission(request=response)
60
+ self.assertFalse(BaseReadOnlyAdminMixin.has_delete_permission(request))
67
61
 
68
- self.assertFalse(expr=has_permission)
69
62
 
70
- def test_has_delete_permission_returns_false(self):
63
+ class TestScanAdmin(TestCase):
64
+ """
65
+ Test the ScanAdmin class
66
+ """
67
+
68
+ def test_displays_scan_type_with_link(self):
71
69
  """
72
- Test if admin.BaseReadOnlyAdminMixin.has_delete_permission returns False
70
+ Test if ScanAdmin._scan_type displays the scan type with a link
73
71
 
74
72
  :return:
75
73
  :rtype:
76
74
  """
77
75
 
78
- self.client.force_login(user=self.user_1001)
76
+ scan = Scan(raw_data="test data")
77
+ scan.save()
79
78
 
80
- response = self.client.get(
81
- path=reverse(viewname="aa_intel_tool:intel_tool_index")
82
- )
79
+ admin_instance = ScanAdmin(model=Scan, admin_site=admin.site)
80
+ result = admin_instance._scan_type(scan)
81
+
82
+ self.assertIn("Open in a new browser tab", result)
83
+ self.assertIn(scan.hash, result)
84
+
85
+ def test_displays_raw_data_in_pre_tag(self):
86
+ """
87
+ Test if ScanAdmin._raw_data displays the raw data in a <pre> tag
88
+
89
+ :return:
90
+ :rtype:
91
+ """
92
+
93
+ scan = Scan.objects.create(raw_data="test data")
83
94
 
84
- has_permission = BaseReadOnlyAdminMixin.has_delete_permission(request=response)
95
+ admin_instance = ScanAdmin(model=Scan, admin_site=admin.site)
96
+ result = admin_instance._raw_data(scan)
85
97
 
86
- self.assertFalse(expr=has_permission)
98
+ self.assertIn("<pre>test data</pre>", result)
@@ -0,0 +1,405 @@
1
+ """
2
+ Tests for the helper functions in the eve_character module.
3
+ """
4
+
5
+ # Standard Library
6
+ from unittest.mock import Mock, patch
7
+
8
+ # Django
9
+ from django.test import TestCase
10
+
11
+ # Alliance Auth
12
+ from allianceauth.eveonline.models import (
13
+ EveAllianceInfo,
14
+ EveCharacter,
15
+ EveCorporationInfo,
16
+ )
17
+
18
+ # AA Intel Tool
19
+ from aa_intel_tool.helper.eve_character import (
20
+ _create_alliance,
21
+ _create_character,
22
+ _create_corporation,
23
+ get_or_create_character,
24
+ )
25
+
26
+
27
+ class TestCreateAlliance(TestCase):
28
+ """
29
+ Test the _create_alliance function.
30
+ """
31
+
32
+ def test_creates_new_alliances(self):
33
+ """
34
+ Test that new alliances are created when they do not exist in the database.
35
+
36
+ :return:
37
+ :rtype:
38
+ """
39
+
40
+ alliance_ids = [1001, 1002, 1003]
41
+
42
+ with (
43
+ patch.object(
44
+ EveAllianceInfo.objects,
45
+ "filter",
46
+ return_value=EveAllianceInfo.objects.none(),
47
+ ),
48
+ patch.object(
49
+ EveAllianceInfo.objects, "create_alliance"
50
+ ) as mock_create_alliance,
51
+ ):
52
+ _create_alliance(alliance_ids)
53
+
54
+ self.assertEqual(mock_create_alliance.call_count, 3)
55
+
56
+ def test_does_not_create_existing_alliances(self):
57
+ """
58
+ Test that existing alliances are not created again.
59
+
60
+ :return:
61
+ :rtype:
62
+ """
63
+
64
+ alliance_ids = [1001, 1002, 1003]
65
+
66
+ # Create existing alliances in the database
67
+ EveAllianceInfo.objects.create(
68
+ alliance_id=1001, alliance_name="Alliance 1001", executor_corp_id=2001
69
+ )
70
+ EveAllianceInfo.objects.create(
71
+ alliance_id=1002, alliance_name="Alliance 1002", executor_corp_id=2002
72
+ )
73
+
74
+ with (
75
+ patch.object(
76
+ EveAllianceInfo.objects,
77
+ "filter",
78
+ wraps=EveAllianceInfo.objects.filter,
79
+ ),
80
+ patch.object(
81
+ EveAllianceInfo.objects, "create_alliance"
82
+ ) as mock_create_alliance,
83
+ ):
84
+ _create_alliance(alliance_ids)
85
+
86
+ mock_create_alliance.assert_called_once_with(alliance_id=1003)
87
+
88
+ def test_handles_empty_alliance_ids(self):
89
+ """
90
+ Test that no alliances are created when the input list is empty.
91
+
92
+ :return:
93
+ :rtype:
94
+ """
95
+
96
+ alliance_ids = []
97
+
98
+ with (
99
+ patch.object(EveAllianceInfo.objects, "filter"),
100
+ patch.object(
101
+ EveAllianceInfo.objects, "create_alliance"
102
+ ) as mock_create_alliance,
103
+ ):
104
+ _create_alliance(alliance_ids)
105
+
106
+ mock_create_alliance.assert_not_called()
107
+
108
+
109
+ class TestCreateCorporation(TestCase):
110
+ """
111
+ Test the _create_corporation function.
112
+ """
113
+
114
+ def test_creates_new_corporations(self):
115
+ """
116
+ Test that new corporations are created when they do not exist in the database.
117
+
118
+ :return:
119
+ :rtype:
120
+ """
121
+
122
+ corporation_ids = [2001, 2002, 2003]
123
+
124
+ with (
125
+ patch.object(
126
+ EveCorporationInfo.objects,
127
+ "filter",
128
+ return_value=EveCorporationInfo.objects.none(),
129
+ ),
130
+ patch.object(
131
+ EveCorporationInfo.objects, "create_corporation"
132
+ ) as mock_create_corporation,
133
+ ):
134
+ _create_corporation(corporation_ids)
135
+
136
+ self.assertEqual(mock_create_corporation.call_count, 3)
137
+
138
+ def test_does_not_create_existing_corporations(self):
139
+ """
140
+ Test that existing corporations are not created again.
141
+
142
+ :return:
143
+ :rtype:
144
+ """
145
+
146
+ corporation_ids = [2001, 2002, 2003]
147
+
148
+ EveCorporationInfo.objects.create(
149
+ corporation_id=2001, corporation_name="Corporation 2001", member_count=10
150
+ )
151
+ EveCorporationInfo.objects.create(
152
+ corporation_id=2002, corporation_name="Corporation 2002", member_count=20
153
+ )
154
+
155
+ with (
156
+ patch.object(
157
+ EveCorporationInfo.objects,
158
+ "filter",
159
+ wraps=EveCorporationInfo.objects.filter,
160
+ ),
161
+ patch.object(
162
+ EveCorporationInfo.objects, "create_corporation"
163
+ ) as mock_create_corporation,
164
+ ):
165
+ _create_corporation(corporation_ids)
166
+
167
+ mock_create_corporation.assert_called_once_with(corp_id=2003)
168
+
169
+ def test_handles_empty_corporation_ids(self):
170
+ """
171
+ Test that no corporations are created when the input list is empty.
172
+
173
+ :return:
174
+ :rtype:
175
+ """
176
+
177
+ corporation_ids = []
178
+
179
+ with (
180
+ patch.object(EveCorporationInfo.objects, "filter"),
181
+ patch.object(
182
+ EveCorporationInfo.objects, "create_corporation"
183
+ ) as mock_create_corporation,
184
+ ):
185
+ _create_corporation(corporation_ids)
186
+
187
+ mock_create_corporation.assert_not_called()
188
+
189
+
190
+ class TestCreateCharacter(TestCase):
191
+ """
192
+ Test the _create_character function.
193
+ """
194
+
195
+ @patch("aa_intel_tool.helper.eve_character.EveCharacter.objects.create_character")
196
+ @patch("aa_intel_tool.helper.eve_character.EveAllianceInfo.objects.create_alliance")
197
+ @patch("allianceauth.eveonline.providers.provider.get_corp")
198
+ def test_creates_new_characters(
199
+ self, mock_get_corp, mock_create_alliance, mock_create_character
200
+ ):
201
+ # Setup mock return values
202
+ mock_create_character.side_effect = [
203
+ Mock(character_id=1001, alliance_id=3001, corporation_id=2001),
204
+ Mock(character_id=1002, alliance_id=3001, corporation_id=2002),
205
+ Mock(character_id=1003, alliance_id=None, corporation_id=2003),
206
+ ]
207
+
208
+ mock_get_corp_side_effect = [
209
+ Mock(
210
+ id=2001,
211
+ name="Corporation 2001",
212
+ ticker="TICK1",
213
+ alliance_id=3001,
214
+ members=10,
215
+ ),
216
+ Mock(
217
+ id=2002,
218
+ name="Corporation 2002",
219
+ ticker="TICK2",
220
+ alliance_id=3001,
221
+ members=20,
222
+ ),
223
+ Mock(
224
+ id=2003,
225
+ name="Corporation 2003",
226
+ ticker="TICK3",
227
+ alliance_id=None,
228
+ members=30,
229
+ ),
230
+ ]
231
+
232
+ # Ensure the mock objects return plain values for attributes
233
+ for mock_corp in mock_get_corp_side_effect:
234
+ mock_corp.name = "Corporation " + str(mock_corp.id)
235
+ mock_corp.ticker = "TICK" + str(mock_corp.id % 1000)
236
+ mock_corp.members = mock_corp.members
237
+
238
+ mock_get_corp.side_effect = (
239
+ lambda *args, **kwargs: mock_get_corp_side_effect.pop(0)
240
+ )
241
+
242
+ # Call the function under test
243
+ _create_character(character_ids=[1, 2, 3], with_affiliation=True)
244
+
245
+ # Assert that create_character was called three times
246
+ self.assertEqual(mock_create_character.call_count, 3)
247
+
248
+ # Assert that create_alliance was called once with the correct ID
249
+ mock_create_alliance.assert_called_once_with(alliance_id=3001)
250
+
251
+ def test_handles_empty_character_ids(self):
252
+ """
253
+ Test that no characters are created when the input list is empty.
254
+
255
+ :return:
256
+ :rtype:
257
+ """
258
+
259
+ character_ids = []
260
+
261
+ with (
262
+ patch.object(EveCharacter.objects, "filter"),
263
+ patch.object(
264
+ EveCharacter.objects, "create_character"
265
+ ) as mock_create_character,
266
+ ):
267
+ _create_character(character_ids)
268
+
269
+ mock_create_character.assert_not_called()
270
+
271
+ @patch("aa_intel_tool.helper.eve_character.EveCharacter.objects.create_character")
272
+ @patch("aa_intel_tool.helper.eve_character.EveAllianceInfo.objects.create_alliance")
273
+ @patch("allianceauth.eveonline.providers.provider.get_corp")
274
+ def creates_characters_without_affiliation(
275
+ self, mock_get_corp, mock_create_alliance, mock_create_character
276
+ ):
277
+ # Setup mock return values
278
+ mock_create_character.side_effect = [
279
+ Mock(character_id=1001, alliance_id=3001, corporation_id=2001),
280
+ Mock(character_id=1002, alliance_id=3001, corporation_id=2002),
281
+ Mock(character_id=1003, alliance_id=None, corporation_id=2003),
282
+ ]
283
+
284
+ mock_get_corp_side_effect = [
285
+ Mock(
286
+ id=2001,
287
+ name="Corporation 2001",
288
+ ticker="TICK1",
289
+ alliance_id=3001,
290
+ members=10,
291
+ ),
292
+ Mock(
293
+ id=2002,
294
+ name="Corporation 2002",
295
+ ticker="TICK2",
296
+ alliance_id=3001,
297
+ members=20,
298
+ ),
299
+ Mock(
300
+ id=2003,
301
+ name="Corporation 2003",
302
+ ticker="TICK3",
303
+ alliance_id=None,
304
+ members=30,
305
+ ),
306
+ ]
307
+
308
+ # Ensure the mock objects return plain values for attributes
309
+ for mock_corp in mock_get_corp_side_effect:
310
+ mock_corp.name = "Corporation " + str(mock_corp.id)
311
+ mock_corp.ticker = "TICK" + str(mock_corp.id % 1000)
312
+ mock_corp.members = mock_corp.members
313
+
314
+ mock_get_corp.side_effect = (
315
+ lambda *args, **kwargs: mock_get_corp_side_effect.pop(0)
316
+ )
317
+
318
+ # Call the function under test
319
+ _create_character(character_ids=[1, 2, 3], with_affiliation=False)
320
+
321
+ # Assert that create_character was called three times
322
+ self.assertEqual(mock_create_character.call_count, 3)
323
+
324
+ # Assert that create_alliance was called once with the correct ID
325
+ mock_create_alliance.assert_called_once_with(alliance_id=3001)
326
+
327
+
328
+ class TestGetOrCreateCharacter(TestCase):
329
+ """
330
+ Test the get_or_create_character function.
331
+ """
332
+
333
+ @patch("aa_intel_tool.helper.eve_character._create_character")
334
+ def test_returns_existing_characters(self, mock_create_character):
335
+ """
336
+ Test that existing characters are returned without creating new ones.
337
+
338
+ :param mock_create_character:
339
+ :type mock_create_character:
340
+ :return:
341
+ :rtype:
342
+ """
343
+
344
+ character_ids = [3001, 3002]
345
+ EveCharacter.objects.create(
346
+ character_id=3001,
347
+ character_name="Character 3001",
348
+ corporation_id=2001,
349
+ alliance_id=1001,
350
+ )
351
+ EveCharacter.objects.create(
352
+ character_id=3002,
353
+ character_name="Character 3002",
354
+ corporation_id=2002,
355
+ alliance_id=1002,
356
+ )
357
+
358
+ characters = get_or_create_character(character_ids)
359
+
360
+ self.assertEqual(characters.count(), 2)
361
+ mock_create_character.assert_not_called()
362
+
363
+ @patch("aa_intel_tool.helper.eve_character._create_character")
364
+ def test_creates_missing_characters(self, mock_create_character):
365
+ """
366
+ Test that missing characters are created when they do not exist in the database.
367
+
368
+ :param mock_create_character:
369
+ :type mock_create_character:
370
+ :return:
371
+ :rtype:
372
+ """
373
+
374
+ character_ids = [3001, 3002, 3003]
375
+ EveCharacter.objects.create(
376
+ character_id=3001,
377
+ character_name="Character 3001",
378
+ corporation_id=2001,
379
+ alliance_id=1001,
380
+ )
381
+
382
+ characters = get_or_create_character(character_ids)
383
+
384
+ self.assertEqual(characters.count(), 1)
385
+ mock_create_character.assert_called_once_with(
386
+ character_ids={3002, 3003}, with_affiliation=True
387
+ )
388
+
389
+ @patch("aa_intel_tool.helper.eve_character._create_character")
390
+ def handles_empty_character_ids(self, mock_create_character):
391
+ character_ids = []
392
+
393
+ characters = get_or_create_character(character_ids)
394
+
395
+ self.assertEqual(characters.count(), 0)
396
+ mock_create_character.assert_not_called()
397
+
398
+ @patch("aa_intel_tool.helper.eve_character._create_character")
399
+ def handles_none_character_ids(self, mock_create_character):
400
+ character_ids = None
401
+
402
+ characters = get_or_create_character(character_ids)
403
+
404
+ self.assertEqual(characters.count(), 0)
405
+ mock_create_character.assert_not_called()