-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
90a4a76
commit d15884e
Showing
2 changed files
with
32 additions
and
32 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 |
---|---|---|
|
@@ -446,13 +446,13 @@ def test_flight_autorenew_view(self): | |
|
||
# Make it a reporter who can't access | ||
member = UserAdvertiserMember.objects.get(user=self.user, advertiser=self.advertiser) | ||
member.role = "Reporter" | ||
member.role = UserAdvertiserMember.ROLE_REPORTER | ||
member.save() | ||
|
||
resp = self.client.get(url) | ||
self.assertEqual(resp.status_code, 403) | ||
|
||
member.role = "Manager" | ||
member.role = UserAdvertiserMember.ROLE_MANAGER | ||
member.save() | ||
|
||
resp = self.client.get(url) | ||
|
@@ -592,13 +592,13 @@ def test_flight_request_view(self): | |
|
||
# Make it a reporter who can't access | ||
member = UserAdvertiserMember.objects.get(user=self.user, advertiser=self.advertiser) | ||
member.role = "Reporter" | ||
member.role = UserAdvertiserMember.ROLE_REPORTER | ||
member.save() | ||
|
||
resp = self.client.get(url) | ||
self.assertEqual(resp.status_code, 403) | ||
|
||
member.role = "Manager" | ||
member.role = UserAdvertiserMember.ROLE_MANAGER | ||
member.save() | ||
|
||
self.client.force_login(self.user) | ||
|
@@ -726,13 +726,13 @@ def test_ad_update_view(self): | |
|
||
# Make it a reporter who can't access | ||
member = UserAdvertiserMember.objects.get(user=self.user, advertiser=self.advertiser) | ||
member.role = "Reporter" | ||
member.role = UserAdvertiserMember.ROLE_REPORTER | ||
member.save() | ||
|
||
response = self.client.get(url) | ||
self.assertEqual(response.status_code, 403) | ||
|
||
member.role = "Manager" | ||
member.role = UserAdvertiserMember.ROLE_MANAGER | ||
member.save() | ||
|
||
response = self.client.get(url) | ||
|
@@ -773,13 +773,13 @@ def test_ad_create_view(self): | |
|
||
# Make it a reporter who can't access | ||
member = UserAdvertiserMember.objects.get(user=self.user, advertiser=self.advertiser) | ||
member.role = "Reporter" | ||
member.role = UserAdvertiserMember.ROLE_REPORTER | ||
member.save() | ||
|
||
response = self.client.get(url) | ||
self.assertEqual(response.status_code, 403) | ||
|
||
member.role = "Manager" | ||
member.role = UserAdvertiserMember.ROLE_MANAGER | ||
member.save() | ||
|
||
response = self.client.get(url) | ||
|
@@ -820,13 +820,13 @@ def test_ad_copy_view(self): | |
|
||
# Make it a reporter who can't access | ||
member = UserAdvertiserMember.objects.get(user=self.user, advertiser=self.advertiser) | ||
member.role = "Reporter" | ||
member.role = UserAdvertiserMember.ROLE_REPORTER | ||
member.save() | ||
|
||
response = self.client.get(url) | ||
self.assertEqual(response.status_code, 403) | ||
|
||
member.role = "Manager" | ||
member.role = UserAdvertiserMember.ROLE_MANAGER | ||
member.save() | ||
|
||
response = self.client.get(url) | ||
|
@@ -892,7 +892,7 @@ def test_authorized_users(self): | |
|
||
# Make it a manager who can't invite users | ||
member = UserAdvertiserMember.objects.get(user=self.user, advertiser=self.advertiser) | ||
member.role = "Manager" | ||
member.role = UserAdvertiserMember.ROLE_MANAGER | ||
member.save() | ||
|
||
self.client.force_login(self.user) | ||
|
@@ -955,14 +955,14 @@ def test_authorized_users_invite(self): | |
|
||
# Make it a manager who can't invite users | ||
member = UserAdvertiserMember.objects.get(user=self.user, advertiser=self.advertiser) | ||
member.role = "Manager" | ||
member.role = UserAdvertiserMember.ROLE_MANAGER | ||
member.save() | ||
|
||
self.client.force_login(self.user) | ||
response = self.client.get(url) | ||
self.assertEqual(response.status_code, 403) | ||
|
||
member.role = "Admin" | ||
member.role = UserAdvertiserMember.ROLE_ADMIN | ||
member.save() | ||
|
||
response = self.client.get(url) | ||
|
@@ -971,7 +971,7 @@ def test_authorized_users_invite(self): | |
|
||
response = self.client.post( | ||
url, | ||
data={"name": "Another User", "email": "[email protected]", "role": "Manager"}, | ||
data={"name": "Another User", "email": "[email protected]", "role": UserAdvertiserMember.ROLE_MANAGER}, | ||
follow=True, | ||
) | ||
self.assertEqual(response.status_code, 200) | ||
|
@@ -992,7 +992,7 @@ def test_authorized_users_invite_existing(self): | |
|
||
response = self.client.post( | ||
url, | ||
data={"name": name, "email": email, "role": "Manager"}, | ||
data={"name": name, "email": email, "role": UserAdvertiserMember.ROLE_MANAGER}, | ||
follow=True, | ||
) | ||
self.assertEqual(response.status_code, 200) | ||
|
@@ -1002,7 +1002,7 @@ def test_authorized_users_invite_existing(self): | |
# Invite the same user again to check that the user isn't created again | ||
response = self.client.post( | ||
url, | ||
data={"name": "Yet Another User", "email": email, "role": "Manager"}, | ||
data={"name": "Yet Another User", "email": email, "role": UserAdvertiserMember.ROLE_MANAGER}, | ||
follow=True, | ||
) | ||
self.assertEqual(response.status_code, 200) | ||
|
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 |
---|---|---|
|
@@ -156,14 +156,14 @@ def test_publisher_settings(self): | |
member = UserPublisherMember.objects.create( | ||
user=self.user, | ||
publisher=self.publisher1, | ||
role="Manager", | ||
role=UserPublisherMember.ROLE_MANAGER, | ||
) | ||
self.client.force_login(self.user) | ||
|
||
resp = self.client.get(url) | ||
self.assertEqual(resp.status_code, 403) | ||
|
||
member.role = "Admin" | ||
member.role = UserPublisherMember.ROLE_ADMIN | ||
member.save() | ||
|
||
resp = self.client.get(url) | ||
|
@@ -406,7 +406,7 @@ def test_authorized_users(self): | |
member = UserPublisherMember.objects.create( | ||
user=self.user, | ||
publisher=self.publisher1, | ||
role="Manager", | ||
role=UserPublisherMember.ROLE_MANAGER, | ||
) | ||
self.client.force_login(self.user) | ||
|
||
|
@@ -473,15 +473,15 @@ def test_authorized_users_invite(self): | |
member = UserPublisherMember.objects.create( | ||
user=self.user, | ||
publisher=self.publisher1, | ||
role="Manager", | ||
role=UserPublisherMember.ROLE_MANAGER, | ||
) | ||
|
||
self.client.force_login(self.user) | ||
|
||
response = self.client.get(url) | ||
self.assertEqual(response.status_code, 403) | ||
|
||
member.role = "Admin" | ||
member.role = UserPublisherMember.ROLE_ADMIN | ||
member.save() | ||
|
||
response = self.client.get(url) | ||
|
@@ -490,7 +490,7 @@ def test_authorized_users_invite(self): | |
|
||
response = self.client.post( | ||
url, | ||
data={"name": "Another User", "email": "[email protected]", "role": "Reporter"}, | ||
data={"name": "Another User", "email": "[email protected]", "role": UserPublisherMember.ROLE_REPORTER}, | ||
follow=True, | ||
) | ||
self.assertEqual(response.status_code, 200) | ||
|
@@ -514,7 +514,7 @@ def test_authorized_users_invite_existing(self): | |
|
||
response = self.client.post( | ||
url, | ||
data={"name": name, "email": email, "role": "Reporter"}, | ||
data={"name": name, "email": email, "role": UserPublisherMember.ROLE_REPORTER}, | ||
follow=True, | ||
) | ||
self.assertEqual(response.status_code, 200) | ||
|
@@ -524,7 +524,7 @@ def test_authorized_users_invite_existing(self): | |
# Invite the same user again to check that the user isn't created again | ||
response = self.client.post( | ||
url, | ||
data={"name": "Yet Another User", "email": email, "role": "Reporter"}, | ||
data={"name": "Yet Another User", "email": email, "role": UserPublisherMember.ROLE_REPORTER}, | ||
follow=True, | ||
) | ||
self.assertEqual(response.status_code, 200) | ||
|
@@ -603,15 +603,15 @@ def test_fallback_ads_list(self): | |
member = UserPublisherMember.objects.create( | ||
user=self.user, | ||
publisher=self.publisher, | ||
role="Manager", | ||
role=UserPublisherMember.ROLE_MANAGER, | ||
) | ||
|
||
resp = self.client.get(url) | ||
self.assertEqual(resp.status_code, 200) | ||
self.assertContains(resp, "Test Ad 1") | ||
self.assertContains(resp, "Create fallback ad") | ||
|
||
member.role = "Reporter" | ||
member.role = UserPublisherMember.ROLE_REPORTER | ||
member.save() | ||
|
||
resp = self.client.get(url) | ||
|
@@ -637,15 +637,15 @@ def test_fallback_ads_detail(self): | |
member = UserPublisherMember.objects.create( | ||
user=self.user, | ||
publisher=self.publisher, | ||
role="Manager", | ||
role=UserPublisherMember.ROLE_MANAGER, | ||
) | ||
|
||
resp = self.client.get(url) | ||
self.assertEqual(resp.status_code, 200) | ||
self.assertContains(resp, "Test Ad 1") | ||
self.assertContains(resp, "Edit fallback ad") | ||
|
||
member.role = "Reporter" | ||
member.role = UserPublisherMember.ROLE_REPORTER | ||
member.save() | ||
|
||
resp = self.client.get(url) | ||
|
@@ -671,14 +671,14 @@ def test_fallback_ads_update(self): | |
member = UserPublisherMember.objects.create( | ||
user=self.user, | ||
publisher=self.publisher, | ||
role="Reporter", | ||
role=UserPublisherMember.ROLE_REPORTER, | ||
) | ||
|
||
# Reporters can't edit | ||
resp = self.client.get(url) | ||
self.assertEqual(resp.status_code, 403) | ||
|
||
member.role = "Manager" | ||
member.role = UserPublisherMember.ROLE_MANAGER | ||
member.save() | ||
|
||
resp = self.client.get(url) | ||
|
@@ -719,14 +719,14 @@ def test_fallback_ads_create(self): | |
member = UserPublisherMember.objects.create( | ||
user=self.user, | ||
publisher=self.publisher, | ||
role="Reporter", | ||
role=UserPublisherMember.ROLE_REPORTER, | ||
) | ||
|
||
# Reporter can't create | ||
resp = self.client.get(url) | ||
self.assertEqual(resp.status_code, 403) | ||
|
||
member.role = "Manager" | ||
member.role = UserPublisherMember.ROLE_MANAGER | ||
member.save() | ||
|
||
resp = self.client.get(url) | ||
|