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.
- aa_fleetfinder-3.0.0b2.dist-info/METADATA +820 -0
- aa_fleetfinder-3.0.0b2.dist-info/RECORD +86 -0
- {aa_fleetfinder-0.1.0a12.dist-info → aa_fleetfinder-3.0.0b2.dist-info}/WHEEL +1 -2
- fleetfinder/__init__.py +19 -0
- fleetfinder/app_settings.py +20 -0
- fleetfinder/apps.py +22 -0
- fleetfinder/auth_hooks.py +58 -0
- fleetfinder/locale/cs_CZ/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/cs_CZ/LC_MESSAGES/django.po +296 -0
- fleetfinder/locale/de/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/de/LC_MESSAGES/django.po +306 -0
- fleetfinder/locale/django.pot +303 -0
- fleetfinder/locale/es/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/es/LC_MESSAGES/django.po +319 -0
- fleetfinder/locale/fr_FR/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/fr_FR/LC_MESSAGES/django.po +314 -0
- fleetfinder/locale/it_IT/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/it_IT/LC_MESSAGES/django.po +294 -0
- fleetfinder/locale/ja/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/ja/LC_MESSAGES/django.po +303 -0
- fleetfinder/locale/ko_KR/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/ko_KR/LC_MESSAGES/django.po +337 -0
- fleetfinder/locale/nl_NL/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/nl_NL/LC_MESSAGES/django.po +294 -0
- fleetfinder/locale/pl_PL/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/pl_PL/LC_MESSAGES/django.po +298 -0
- fleetfinder/locale/ru/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/ru/LC_MESSAGES/django.po +319 -0
- fleetfinder/locale/sk/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/sk/LC_MESSAGES/django.po +294 -0
- fleetfinder/locale/uk/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/uk/LC_MESSAGES/django.po +310 -0
- fleetfinder/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/zh_Hans/LC_MESSAGES/django.po +319 -0
- fleetfinder/migrations/0001_initial.py +72 -0
- fleetfinder/migrations/0002_esi_error_handling_and_verbose_names.py +92 -0
- fleetfinder/migrations/0003_alter_fleet_fleet_commander_alter_fleet_groups_and_more.py +46 -0
- fleetfinder/migrations/__init__.py +0 -0
- fleetfinder/models.py +95 -0
- fleetfinder/providers.py +32 -0
- fleetfinder/static/fleetfinder/css/fleetfinder.css +31 -0
- fleetfinder/static/fleetfinder/css/fleetfinder.min.css +2 -0
- fleetfinder/static/fleetfinder/css/fleetfinder.min.css.map +1 -0
- fleetfinder/static/fleetfinder/js/fleetfinder-dashboard.js +86 -0
- fleetfinder/static/fleetfinder/js/fleetfinder-dashboard.min.js +2 -0
- fleetfinder/static/fleetfinder/js/fleetfinder-dashboard.min.js.map +1 -0
- fleetfinder/static/fleetfinder/js/fleetfinder-fleet-details.js +154 -0
- fleetfinder/static/fleetfinder/js/fleetfinder-fleet-details.min.js +2 -0
- fleetfinder/static/fleetfinder/js/fleetfinder-fleet-details.min.js.map +1 -0
- fleetfinder/static/fleetfinder/js/fleetfinder.js +23 -0
- fleetfinder/static/fleetfinder/js/fleetfinder.min.js +2 -0
- fleetfinder/static/fleetfinder/js/fleetfinder.min.js.map +1 -0
- fleetfinder/static/fleetfinder/libs/slim-select/2.6.0/css/slimselect.css +477 -0
- fleetfinder/static/fleetfinder/libs/slim-select/2.6.0/css/slimselect.min.css +2 -0
- fleetfinder/static/fleetfinder/libs/slim-select/2.6.0/css/slimselect.min.css.map +1 -0
- fleetfinder/static/fleetfinder/libs/slim-select/2.6.0/js/slimselect.min.js +1 -0
- fleetfinder/tasks.py +554 -0
- fleetfinder/templates/fleetfinder/base.html +43 -0
- fleetfinder/templates/fleetfinder/bundles/css/fleetfinder-css.html +3 -0
- fleetfinder/templates/fleetfinder/bundles/css/slim-select-css.html +3 -0
- fleetfinder/templates/fleetfinder/bundles/js/fleetfinder-js.html +9 -0
- fleetfinder/templates/fleetfinder/bundles/js/slim-select-js.html +3 -0
- fleetfinder/templates/fleetfinder/create-fleet.html +42 -0
- fleetfinder/templates/fleetfinder/dashboard.html +53 -0
- fleetfinder/templates/fleetfinder/edit-fleet.html +42 -0
- fleetfinder/templates/fleetfinder/fleet-details.html +102 -0
- fleetfinder/templates/fleetfinder/join-fleet.html +68 -0
- fleetfinder/templates/fleetfinder/modals/kick-fleet-member.html +46 -0
- fleetfinder/templates/fleetfinder/partials/body/form-fleet-details.html +50 -0
- fleetfinder/templates/fleetfinder/partials/footer/app-translation-footer.html +11 -0
- fleetfinder/templates/fleetfinder/partials/header/header-nav-left.html +9 -0
- fleetfinder/templates/fleetfinder/partials/header/header-nav-right.html +18 -0
- fleetfinder/templatetags/__init__.py +3 -0
- fleetfinder/templatetags/fleetfinder.py +33 -0
- fleetfinder/tests/__init__.py +41 -0
- fleetfinder/tests/test_access.py +74 -0
- fleetfinder/tests/test_auth_hooks.py +79 -0
- fleetfinder/tests/test_settings.py +38 -0
- fleetfinder/tests/test_tasks.py +1116 -0
- fleetfinder/tests/test_templatetags.py +65 -0
- fleetfinder/tests/test_user_agent.py +88 -0
- fleetfinder/tests/test_views.py +1184 -0
- fleetfinder/tests/utils.py +58 -0
- fleetfinder/urls.py +45 -0
- fleetfinder/views.py +631 -0
- aa_fleetfinder-0.1.0a12.dist-info/METADATA +0 -50
- aa_fleetfinder-0.1.0a12.dist-info/RECORD +0 -5
- aa_fleetfinder-0.1.0a12.dist-info/top_level.txt +0 -1
- {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)
|