Skip to content

Commit

Permalink
refactor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvin-muchiri committed Jan 16, 2025
1 parent 3aa15c4 commit 6ddce00
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions onadata/apps/api/tests/viewsets/test_abstract_viewset.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ def setUp(self):
sender=DataDictionary, dispatch_uid="create_export_repeat_register"
)

def tearDown(self):
TestCase.tearDown(self)

# Enable signals
post_save.connect(
sender=DataDictionary, dispatch_uid="create_export_repeat_register"
)

def user_profile_data(self):
"""Returns the user profile python object."""
return {
Expand Down
8 changes: 4 additions & 4 deletions onadata/libs/tests/utils/test_logger_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1168,6 +1168,7 @@ def setUp(self):

# Disable signals
post_save.disconnect(sender=Instance, dispatch_uid="register_export_repeats")

self.project = get_user_default_project(self.user)
md = """
| survey |
Expand Down Expand Up @@ -1215,11 +1216,10 @@ def setUp(self):
self.instance = Instance.objects.create(
xml=self.xml, user=self.user, xform=self.xform
)
self.register, _ = MetaData.objects.get_or_create(
self.register = MetaData.objects.get(
data_type="export_repeat_register",
object_id=self.xform.pk,
content_type=ContentType.objects.get_for_model(self.xform),
defaults={"data_value": ""},
)

def test_repeat_register_not_found(self):
Expand Down Expand Up @@ -1340,6 +1340,7 @@ def setUp(self):

# Disable signals
post_save.disconnect(sender=Instance, dispatch_uid="register_export_repeats")

self.project = get_user_default_project(self.user)
md = """
| survey |
Expand Down Expand Up @@ -1387,11 +1388,10 @@ def setUp(self):
self.instance = Instance.objects.create(
xml=xml, user=self.user, xform=self.xform
)
self.register, _ = MetaData.objects.get_or_create(
self.register = MetaData.objects.get(
data_type="export_repeat_register",
object_id=self.xform.pk,
content_type=ContentType.objects.get_for_model(self.xform),
defaults={"data_value": ""},
)

def test_register(self):
Expand Down

0 comments on commit 6ddce00

Please sign in to comment.