aa-fleetfinder 0.1.0a12__py3-none-any.whl → 3.0.0b2__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 (89) hide show
  1. aa_fleetfinder-3.0.0b2.dist-info/METADATA +820 -0
  2. aa_fleetfinder-3.0.0b2.dist-info/RECORD +86 -0
  3. {aa_fleetfinder-0.1.0a12.dist-info → aa_fleetfinder-3.0.0b2.dist-info}/WHEEL +1 -2
  4. fleetfinder/__init__.py +19 -0
  5. fleetfinder/app_settings.py +20 -0
  6. fleetfinder/apps.py +22 -0
  7. fleetfinder/auth_hooks.py +58 -0
  8. fleetfinder/locale/cs_CZ/LC_MESSAGES/django.mo +0 -0
  9. fleetfinder/locale/cs_CZ/LC_MESSAGES/django.po +296 -0
  10. fleetfinder/locale/de/LC_MESSAGES/django.mo +0 -0
  11. fleetfinder/locale/de/LC_MESSAGES/django.po +306 -0
  12. fleetfinder/locale/django.pot +303 -0
  13. fleetfinder/locale/es/LC_MESSAGES/django.mo +0 -0
  14. fleetfinder/locale/es/LC_MESSAGES/django.po +319 -0
  15. fleetfinder/locale/fr_FR/LC_MESSAGES/django.mo +0 -0
  16. fleetfinder/locale/fr_FR/LC_MESSAGES/django.po +314 -0
  17. fleetfinder/locale/it_IT/LC_MESSAGES/django.mo +0 -0
  18. fleetfinder/locale/it_IT/LC_MESSAGES/django.po +294 -0
  19. fleetfinder/locale/ja/LC_MESSAGES/django.mo +0 -0
  20. fleetfinder/locale/ja/LC_MESSAGES/django.po +303 -0
  21. fleetfinder/locale/ko_KR/LC_MESSAGES/django.mo +0 -0
  22. fleetfinder/locale/ko_KR/LC_MESSAGES/django.po +337 -0
  23. fleetfinder/locale/nl_NL/LC_MESSAGES/django.mo +0 -0
  24. fleetfinder/locale/nl_NL/LC_MESSAGES/django.po +294 -0
  25. fleetfinder/locale/pl_PL/LC_MESSAGES/django.mo +0 -0
  26. fleetfinder/locale/pl_PL/LC_MESSAGES/django.po +298 -0
  27. fleetfinder/locale/ru/LC_MESSAGES/django.mo +0 -0
  28. fleetfinder/locale/ru/LC_MESSAGES/django.po +319 -0
  29. fleetfinder/locale/sk/LC_MESSAGES/django.mo +0 -0
  30. fleetfinder/locale/sk/LC_MESSAGES/django.po +294 -0
  31. fleetfinder/locale/uk/LC_MESSAGES/django.mo +0 -0
  32. fleetfinder/locale/uk/LC_MESSAGES/django.po +310 -0
  33. fleetfinder/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
  34. fleetfinder/locale/zh_Hans/LC_MESSAGES/django.po +319 -0
  35. fleetfinder/migrations/0001_initial.py +72 -0
  36. fleetfinder/migrations/0002_esi_error_handling_and_verbose_names.py +92 -0
  37. fleetfinder/migrations/0003_alter_fleet_fleet_commander_alter_fleet_groups_and_more.py +46 -0
  38. fleetfinder/migrations/__init__.py +0 -0
  39. fleetfinder/models.py +95 -0
  40. fleetfinder/providers.py +32 -0
  41. fleetfinder/static/fleetfinder/css/fleetfinder.css +31 -0
  42. fleetfinder/static/fleetfinder/css/fleetfinder.min.css +2 -0
  43. fleetfinder/static/fleetfinder/css/fleetfinder.min.css.map +1 -0
  44. fleetfinder/static/fleetfinder/js/fleetfinder-dashboard.js +86 -0
  45. fleetfinder/static/fleetfinder/js/fleetfinder-dashboard.min.js +2 -0
  46. fleetfinder/static/fleetfinder/js/fleetfinder-dashboard.min.js.map +1 -0
  47. fleetfinder/static/fleetfinder/js/fleetfinder-fleet-details.js +154 -0
  48. fleetfinder/static/fleetfinder/js/fleetfinder-fleet-details.min.js +2 -0
  49. fleetfinder/static/fleetfinder/js/fleetfinder-fleet-details.min.js.map +1 -0
  50. fleetfinder/static/fleetfinder/js/fleetfinder.js +23 -0
  51. fleetfinder/static/fleetfinder/js/fleetfinder.min.js +2 -0
  52. fleetfinder/static/fleetfinder/js/fleetfinder.min.js.map +1 -0
  53. fleetfinder/static/fleetfinder/libs/slim-select/2.6.0/css/slimselect.css +477 -0
  54. fleetfinder/static/fleetfinder/libs/slim-select/2.6.0/css/slimselect.min.css +2 -0
  55. fleetfinder/static/fleetfinder/libs/slim-select/2.6.0/css/slimselect.min.css.map +1 -0
  56. fleetfinder/static/fleetfinder/libs/slim-select/2.6.0/js/slimselect.min.js +1 -0
  57. fleetfinder/tasks.py +554 -0
  58. fleetfinder/templates/fleetfinder/base.html +43 -0
  59. fleetfinder/templates/fleetfinder/bundles/css/fleetfinder-css.html +3 -0
  60. fleetfinder/templates/fleetfinder/bundles/css/slim-select-css.html +3 -0
  61. fleetfinder/templates/fleetfinder/bundles/js/fleetfinder-js.html +9 -0
  62. fleetfinder/templates/fleetfinder/bundles/js/slim-select-js.html +3 -0
  63. fleetfinder/templates/fleetfinder/create-fleet.html +42 -0
  64. fleetfinder/templates/fleetfinder/dashboard.html +53 -0
  65. fleetfinder/templates/fleetfinder/edit-fleet.html +42 -0
  66. fleetfinder/templates/fleetfinder/fleet-details.html +102 -0
  67. fleetfinder/templates/fleetfinder/join-fleet.html +68 -0
  68. fleetfinder/templates/fleetfinder/modals/kick-fleet-member.html +46 -0
  69. fleetfinder/templates/fleetfinder/partials/body/form-fleet-details.html +50 -0
  70. fleetfinder/templates/fleetfinder/partials/footer/app-translation-footer.html +11 -0
  71. fleetfinder/templates/fleetfinder/partials/header/header-nav-left.html +9 -0
  72. fleetfinder/templates/fleetfinder/partials/header/header-nav-right.html +18 -0
  73. fleetfinder/templatetags/__init__.py +3 -0
  74. fleetfinder/templatetags/fleetfinder.py +33 -0
  75. fleetfinder/tests/__init__.py +41 -0
  76. fleetfinder/tests/test_access.py +74 -0
  77. fleetfinder/tests/test_auth_hooks.py +79 -0
  78. fleetfinder/tests/test_settings.py +38 -0
  79. fleetfinder/tests/test_tasks.py +1116 -0
  80. fleetfinder/tests/test_templatetags.py +65 -0
  81. fleetfinder/tests/test_user_agent.py +88 -0
  82. fleetfinder/tests/test_views.py +1184 -0
  83. fleetfinder/tests/utils.py +58 -0
  84. fleetfinder/urls.py +45 -0
  85. fleetfinder/views.py +631 -0
  86. aa_fleetfinder-0.1.0a12.dist-info/METADATA +0 -50
  87. aa_fleetfinder-0.1.0a12.dist-info/RECORD +0 -5
  88. aa_fleetfinder-0.1.0a12.dist-info/top_level.txt +0 -1
  89. {aa_fleetfinder-0.1.0a12.dist-info → aa_fleetfinder-3.0.0b2.dist-info/licenses}/LICENSE +0 -0
@@ -0,0 +1,65 @@
1
+ """
2
+ Test the apps' template tags
3
+ """
4
+
5
+ # AA Fleet Finder
6
+ from fleetfinder.templatetags.fleetfinder import get_item
7
+ from fleetfinder.tests import BaseTestCase
8
+
9
+
10
+ class TestGetItem(BaseTestCase):
11
+ """
12
+ Test the `get_item` template tag
13
+ """
14
+
15
+ def test_returns_value_for_existing_key(self):
16
+ """
17
+ Test should return the value for an existing key
18
+
19
+ :return:
20
+ :rtype:
21
+ """
22
+
23
+ dictionary = {"key1": "value1", "key2": "value2"}
24
+ result = get_item(dictionary, "key1")
25
+
26
+ self.assertEqual(result, "value1")
27
+
28
+ def test_returns_none_for_non_existing_key(self):
29
+ """
30
+ Test should return None for a non-existing key
31
+
32
+ :return:
33
+ :rtype:
34
+ """
35
+
36
+ dictionary = {"key1": "value1", "key2": "value2"}
37
+ result = get_item(dictionary, "key3")
38
+
39
+ self.assertIsNone(result)
40
+
41
+ def test_returns_none_for_empty_dictionary(self):
42
+ """
43
+ Test should return None for an empty dictionary
44
+
45
+ :return:
46
+ :rtype:
47
+ """
48
+
49
+ dictionary = {}
50
+ result = get_item(dictionary, "key1")
51
+
52
+ self.assertIsNone(result)
53
+
54
+ def test_returns_none_for_none_dictionary(self):
55
+ """
56
+ Test should return None for a None dictionary
57
+
58
+ :return:
59
+ :rtype:
60
+ """
61
+
62
+ dictionary = None
63
+ result = get_item(dictionary, "key1")
64
+
65
+ self.assertIsNone(result)
@@ -0,0 +1,88 @@
1
+ """
2
+ Test user agent header for ESI requests
3
+ """
4
+
5
+ # Standard Library
6
+ from unittest.mock import MagicMock, patch
7
+
8
+ # Third Party
9
+ import httpx
10
+
11
+ # Django
12
+ from django.conf import settings
13
+
14
+ # Alliance Auth
15
+ from esi import __url__ as esi_url
16
+ from esi import __version__ as esi_version
17
+ from esi.openapi_clients import ESIClientProvider
18
+ from esi.tests.test_openapi import SPEC_PATH
19
+
20
+ # AA Fleet Finder
21
+ from fleetfinder import (
22
+ __app_name_verbose__,
23
+ __esi_compatibility_date__,
24
+ __github_url__,
25
+ __version__,
26
+ )
27
+ from fleetfinder.tests import BaseTestCase
28
+
29
+
30
+ class TestUserAgent(BaseTestCase):
31
+ """
32
+ Test suite for verifying the `User-Agent` header in ESI requests.
33
+ """
34
+
35
+ @patch.object(httpx.Client, "send")
36
+ def test_user_agent_header(self, send: MagicMock):
37
+ """
38
+ Test that the `User-Agent` header is correctly set in ESI requests.
39
+
40
+ This test verifies that the `User-Agent` header in HTTP requests made by the ESI client
41
+ is constructed correctly based on the provided application name, version, and other metadata.
42
+
43
+ Args:
44
+ send (MagicMock): A mocked `httpx.Client.send` method to intercept HTTP requests and provide a controlled response.
45
+
46
+ Assertions:
47
+ - The `User-Agent` header in the HTTP request matches the expected format.
48
+ - The `players` field in the response JSON is correctly parsed and matches the expected value.
49
+ """
50
+
51
+ # Initialize the ESI client provider with test-specific metadata
52
+ esi = ESIClientProvider(
53
+ ua_appname=__app_name_verbose__, # Application name for the User-Agent header
54
+ ua_url=__github_url__, # Application URL for the User-Agent header
55
+ ua_version=__version__, # Application version for the User-Agent header
56
+ compatibility_date=__esi_compatibility_date__, # Compatibility date for the ESI spec
57
+ spec_file=SPEC_PATH, # Path to the OpenAPI specification file
58
+ )
59
+
60
+ # Mock the HTTP response returned by the `send` method
61
+ send.return_value = httpx.Response(
62
+ status_code=200, # HTTP status code for the response
63
+ json={ # Mocked JSON response body
64
+ "players": 1234,
65
+ "server_version": "1234",
66
+ "start_time": "2029-09-19T11:02:08Z",
67
+ },
68
+ request=httpx.Request(method="GET", url="test"), # Mocked HTTP request
69
+ )
70
+
71
+ # Perform the ESI client request and retrieve the status
72
+ status = esi.client.Status.GetStatus().result()
73
+
74
+ # Retrieve the arguments passed to the mocked `send` method
75
+ call_args, call_kwargs = send.call_args
76
+
77
+ # Assert that the `User-Agent` header matches the expected format
78
+ self.assertEqual(
79
+ first=call_args[0].headers["user-agent"],
80
+ second=(
81
+ f"AaFleetFinder/{__version__} "
82
+ f"({settings.ESI_USER_CONTACT_EMAIL}; +{__github_url__}) "
83
+ f"DjangoEsi/{esi_version} (+{esi_url})"
84
+ ),
85
+ )
86
+
87
+ # Assert that the `players` field in the response matches the expected value
88
+ self.assertEqual(first=status.players, second=1234)