Skip to content

Commit

Permalink
* Updates requirements with pip
Browse files Browse the repository at this point in the history
* Fixes black issues
  • Loading branch information
gurkanindibay committed Sep 23, 2023
1 parent f7a0a1c commit 2563a4d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
1 change: 0 additions & 1 deletion django_multitenant/tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,3 @@
USE_TZ = True

TENANT_USE_ASGIREF = False

13 changes: 8 additions & 5 deletions django_multitenant/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,18 @@ def test_tenant_persists_from_thread_to_async_task(self):
set_current_tenant(account)

with self.settings(TENANT_USE_ASGIREF=True):
importlib.reload(sys.modules['django_multitenant.utils'])
importlib.reload(sys.modules["django_multitenant.utils"])
from django_multitenant.utils import get_current_tenant

# Check the tenant within an async task when asgiref enabled
tenant = async_to_sync(self.async_get_current_tenant)()
self.assertEqual(get_current_tenant(), tenant)
unset_current_tenant()

with self.settings(TENANT_USE_ASGIREF=False):
importlib.reload(sys.modules['django_multitenant.utils'])
importlib.reload(sys.modules["django_multitenant.utils"])
from django_multitenant.utils import get_current_tenant

# Check the tenant within an async task when asgiref is disabled
tenant = async_to_sync(self.async_get_current_tenant)()
self.assertIsNone(get_current_tenant())
Expand All @@ -58,22 +60,23 @@ def test_tenant_persists_from_async_task_to_thread(self):
account = projects[0].account

with self.settings(TENANT_USE_ASGIREF=True):
importlib.reload(sys.modules['django_multitenant.utils'])
importlib.reload(sys.modules["django_multitenant.utils"])
from django_multitenant.utils import get_current_tenant

# Set the tenant in task
async_to_sync(self.async_set_current_tenant)(account)
self.assertEqual(get_current_tenant(), account)
unset_current_tenant()

with self.settings(TENANT_USE_ASGIREF=False):
importlib.reload(sys.modules['django_multitenant.utils'])
importlib.reload(sys.modules["django_multitenant.utils"])
from django_multitenant.utils import get_current_tenant

# Set the tenant in task
async_to_sync(self.async_set_current_tenant)(account)
self.assertIsNone(get_current_tenant())
unset_current_tenant()


def test_get_tenant_column(self):
from .models import Project

Expand Down
6 changes: 6 additions & 0 deletions requirements/test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,9 @@ pytest-cov==4.1.0
# via -r requirements/test.in
pytest-django==4.5.2
# via -r requirements/test.in
tomli==2.0.1
# via
# coverage
# pytest
typing-extensions==4.8.0
# via asgiref

0 comments on commit 2563a4d

Please sign in to comment.