mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-08 20:10:17 +02:00
Compare commits
2 Commits
f35a5ea725
...
5e42007088
Author | SHA1 | Date | |
---|---|---|---|
|
5e42007088 | ||
|
9f81c7fa0e |
@ -7,5 +7,6 @@ manage online service access.
|
||||
|
||||
__version__ = '4.8.0'
|
||||
__title__ = 'Alliance Auth'
|
||||
__title_useragent__ = 'AllianceAuth'
|
||||
__url__ = 'https://gitlab.com/allianceauth/allianceauth'
|
||||
NAME = f'{__title__} v{__version__}'
|
||||
|
@ -7,7 +7,7 @@ from jsonschema.exceptions import RefResolutionError
|
||||
from django.conf import settings
|
||||
from esi.clients import esi_client_factory
|
||||
|
||||
from allianceauth import __version__
|
||||
from allianceauth import __version__, __title_useragent__, __url__
|
||||
from allianceauth.utils.django import StartupCommand
|
||||
|
||||
|
||||
@ -185,7 +185,9 @@ class EveSwaggerProvider(EveProvider):
|
||||
self._client = esi_client_factory(
|
||||
token=token,
|
||||
spec_file=SWAGGER_SPEC_PATH,
|
||||
app_info_text=f"allianceauth v{__version__}"
|
||||
ua_appname=__title_useragent__,
|
||||
ua_version=__version__,
|
||||
ua_url=__url__
|
||||
)
|
||||
except (HTTPError, RefResolutionError):
|
||||
logger.exception(
|
||||
@ -202,7 +204,11 @@ class EveSwaggerProvider(EveProvider):
|
||||
def client(self):
|
||||
if self._client is None:
|
||||
self._client = esi_client_factory(
|
||||
token=self._token, spec_file=SWAGGER_SPEC_PATH, app_info_text=("allianceauth v" + __version__)
|
||||
token=self._token,
|
||||
spec_file=SWAGGER_SPEC_PATH,
|
||||
ua_appname=__title_useragent__,
|
||||
ua_version=__version__,
|
||||
ua_url=__url__
|
||||
)
|
||||
return self._client
|
||||
|
||||
|
@ -6,6 +6,12 @@ from jsonschema.exceptions import RefResolutionError
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
from allianceauth import __url__ as aa_url
|
||||
from allianceauth import __version__ as aa_version
|
||||
|
||||
from esi import __url__ as esi_url
|
||||
from esi import __version__ as esi_version
|
||||
|
||||
from . import set_logger
|
||||
from .esi_client_stub import EsiClientStub
|
||||
from ..providers import (
|
||||
@ -717,11 +723,11 @@ class TestEveSwaggerProvider(TestCase):
|
||||
self.assertIsNotNone(my_provider._client)
|
||||
self.assertEqual(my_client, 'my_client')
|
||||
|
||||
@patch(MODULE_PATH + '.__version__', '1.0.0')
|
||||
def test_user_agent_header(self):
|
||||
my_provider = EveSwaggerProvider()
|
||||
my_client = my_provider.client
|
||||
operation = my_client.Universe.get_universe_factions()
|
||||
self.assertEqual(
|
||||
operation.future.request.headers['User-Agent'], 'allianceauth v1.0.0 dummy@example.net'
|
||||
operation.future.request.headers['User-Agent'],
|
||||
f'AllianceAuth/{aa_version} (dummy@example.net; +{aa_url}) Django-ESI/{esi_version} (+{esi_url})'
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user