Skip to content

Commit c275a5a

Browse files
committed
[fix] Load Organization model with swappable in tests
1 parent 9a5c522 commit c275a5a

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

openwisp_network_topology/tests/test_utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@
1010
from django.test import TestCase
1111
from django.utils.timezone import now
1212

13-
from openwisp_users.models import Organization
14-
1513
from .. import settings as app_settings
1614
from .utils import CreateGraphObjectsMixin, CreateOrgMixin, LoadMixin
1715

16+
Organization = swapper.load_model('openwisp_users', 'Organization')
1817
Link = swapper.load_model('topology', 'Link')
1918
Node = swapper.load_model('topology', 'Node')
2019
Snapshot = swapper.load_model('topology', 'Snapshot')

openwisp_network_topology/tests/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import logging
22
import os
33

4-
from openwisp_users.models import Organization
4+
import swapper
5+
56
from openwisp_utils.tests import TimeLoggingTestRunner
67

8+
Organization = swapper.load_model('openwisp_users', 'Organization')
9+
710

811
class CreateOrgMixin(object):
912
def _create_org(self, **kwargs):

0 commit comments

Comments
 (0)