Skip to content

Commit

Permalink
refactor test case
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvin-muchiri committed Aug 17, 2023
1 parent a7e4366 commit d20defb
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from django.contrib.auth.models import User, timezone
from django.core.cache import cache
from django.test.utils import override_settings

from guardian.shortcuts import get_perms
from mock import patch
Expand Down Expand Up @@ -800,6 +801,7 @@ def test_add_members_to_owner_role(self):

self.assertNotIn(aboy, owner_team.user_set.all())

@override_settings(CELERY_TASK_ALWAYS_EAGER=True)
def test_org_members_added_to_projects(self):
# create org
self._org_create()
Expand All @@ -809,7 +811,9 @@ def test_org_members_added_to_projects(self):
# create a proj
project_data = {"owner": self.company_data["user"]}
self._project_create(project_data)
self._publish_xls_form_to_project()

with self.captureOnCommitCallbacks(execute=True):
self._publish_xls_form_to_project()

# create aboy
self.profile_data["username"] = "aboy"
Expand Down Expand Up @@ -839,6 +843,8 @@ def test_org_members_added_to_projects(self):
self.assertEqual(response.status_code, 201)

# Assert that user added in org is added to teams in proj
aboy.refresh_from_db()
alice.refresh_from_db()
self.assertTrue(OwnerRole.user_has_role(aboy, self.project))
self.assertTrue(OwnerRole.user_has_role(alice, self.project))
self.assertTrue(OwnerRole.user_has_role(aboy, self.xform))
Expand Down

0 comments on commit d20defb

Please sign in to comment.