Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankApiyo committed Jul 25, 2024
1 parent 36a23ae commit 18c904e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions onadata/apps/api/models/organization_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ def __str__(self):
def save(self, *args, **kwargs): # pylint: disable=arguments-differ
super().save(*args, **kwargs)

@property
def email(self):
return self.user.email

def remove_user_from_organization(self, user):
"""Removes a user from all teams/groups in the organization.
Expand Down
1 change: 1 addition & 0 deletions onadata/apps/api/tests/viewsets/test_abstract_viewset.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ def _org_create(self, org_data=None):
response = view(request)
self.assertEqual(response.status_code, 200)
data = {
"email": "[email protected]",
"org": "denoinc",
"name": "Dennis",
"city": "Denoville",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,16 +214,16 @@ def test_orgs_get_anon(self):
self.assertTrue(isinstance(user["user"], text))

def test_orgs_create(self):
org_email = "[email protected]"
self._org_create(org_data = {"email": org_email})
self._org_create()
self.assertTrue(self.organization.user.is_active)
self.assertEqual(self.organization.user.email, org_email)
self.assertEqual(self.organization.user.email, "[email protected]")

def test_orgs_create_without_name(self):
data = {
"org": "denoinc",
"city": "Denoville",
"country": "US",
"email": "[email protected]",
"home_page": "deno.com",
"twitter": "denoinc",
"description": "",
Expand Down Expand Up @@ -563,6 +563,7 @@ def test_orgs_create_with_mixed_case(self):
"home_page": "deno.com",
"twitter": "denoinc",
"description": "",
"email": "[email protected]",
"address": "",
"phonenumber": "",
"require_auth": False,
Expand Down

0 comments on commit 18c904e

Please sign in to comment.