-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2712 from onaio/use-email-provided-when-creating-…
…organization-to-set-metadata Add organization email to organization profile instead of adding to organization user
- Loading branch information
Showing
5 changed files
with
38 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Generated by Django 4.2.14 on 2024-10-01 08:01 | ||
""" | ||
Add email field to the organization profile model | ||
""" | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
""" | ||
Add email field to the organization profile model | ||
""" | ||
|
||
dependencies = [ | ||
("api", "0007_odktoken_expires"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="organizationprofile", | ||
name="email", | ||
field=models.EmailField( | ||
blank=True, max_length=254, verbose_name="email address" | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -196,8 +196,8 @@ def test_orgs_get_not_creator(self): | |
response = view(request, user="denoinc") | ||
self.assertNotEqual(response.get("Cache-Control"), None) | ||
self.assertEqual(response.status_code, 200) | ||
del self.company_data['email'] | ||
del self.company_data['metadata'] | ||
del self.company_data["email"] | ||
del self.company_data["metadata"] | ||
self.assertEqual(response.data, self.company_data) | ||
self.assertIn("users", list(response.data)) | ||
for user in response.data["users"]: | ||
|
@@ -212,7 +212,7 @@ def test_orgs_get_anon(self): | |
self.assertNotEqual(response.get("Cache-Control"), None) | ||
self.assertEqual(response.status_code, 200) | ||
del self.company_data["email"] | ||
del self.company_data['metadata'] | ||
del self.company_data["metadata"] | ||
self.assertEqual(response.data, self.company_data) | ||
self.assertIn("users", list(response.data)) | ||
for user in response.data["users"]: | ||
|
@@ -222,7 +222,7 @@ def test_orgs_get_anon(self): | |
def test_orgs_create(self): | ||
self._org_create() | ||
self.assertTrue(self.organization.user.is_active) | ||
self.assertEqual(self.organization.user.email, "[email protected]") | ||
self.assertEqual(self.organization.email, "[email protected]") | ||
|
||
def test_orgs_create_without_name(self): | ||
data = { | ||
|
@@ -264,7 +264,7 @@ def test_org_create_and_fetch_by_admin_user(self): | |
request.user = self.user | ||
response = self.view(request) | ||
self.assertEqual(response.status_code, 201) | ||
self.assertEqual(response.data['email'], org_email) | ||
self.assertEqual(response.data["email"], org_email) | ||
|
||
def test_org_create_with_anonymous_user(self): | ||
data = { | ||
|
@@ -420,7 +420,7 @@ def test_member_sees_orgs_added_to(self): | |
} | ||
) | ||
del expected_data["metadata"] | ||
del expected_data['email'] | ||
del expected_data["email"] | ||
|
||
request = self.factory.get("/", **self.extra) | ||
response = view(request) | ||
|
@@ -452,8 +452,7 @@ def test_role_for_org_non_owner(self): | |
request = self.factory.get("/", **self.extra) | ||
response = view(request, user="denoinc") | ||
self.assertEqual(response.status_code, 200) | ||
self.assertTrue('email' in response.data) | ||
self.assertEqual(response.data['email'], '[email protected]') | ||
self.assertEqual(response.data["email"], "[email protected]") | ||
self.assertIn("users", list(response.data)) | ||
|
||
for user in response.data["users"]: | ||
|
@@ -476,10 +475,10 @@ def test_role_for_org_non_owner(self): | |
request = self.factory.get("/", **self.extra) | ||
request.user = AnonymousUser() | ||
request.headers = None | ||
request.META['HTTP_AUTHORIZATION'] = "" | ||
request.META["HTTP_AUTHORIZATION"] = "" | ||
response = view(request, user="denoinc") | ||
self.assertEqual(response.status_code, 200) | ||
self.assertFalse('email' in response.data) | ||
self.assertFalse("email" in response.data) | ||
|
||
def test_add_members_to_org_with_anonymous_user(self): | ||
self._org_create() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters