Merge "Replacing Member role with _member_ in all tests."
This commit is contained in:
commit
b5432731b0
@ -394,8 +394,7 @@ class NewProject(UserNameAction):
|
||||
|
||||
# NOTE(adriant): move these to a config somewhere?
|
||||
default_roles = {
|
||||
"Member", "project_owner", "project_mod", "_member_",
|
||||
"heat_stack_owner"
|
||||
"project_owner", "project_mod", "_member_", "heat_stack_owner"
|
||||
}
|
||||
|
||||
def _validate(self):
|
||||
|
@ -47,7 +47,7 @@ class ActionTests(TestCase):
|
||||
data = {
|
||||
'email': 'test@example.com',
|
||||
'project_id': 'test_project_id',
|
||||
'roles': ['Member']
|
||||
'roles': ['_member_']
|
||||
}
|
||||
|
||||
action = NewUser(data, task=task, order=1)
|
||||
@ -70,7 +70,7 @@ class ActionTests(TestCase):
|
||||
tests.temp_cache['users']["user_id_1"].password,
|
||||
'123456')
|
||||
|
||||
self.assertEquals(project.roles["user_id_1"], ['Member'])
|
||||
self.assertEquals(project.roles["user_id_1"], ['_member_'])
|
||||
|
||||
@mock.patch('stacktask.actions.models.user_store.IdentityManager',
|
||||
FakeManager)
|
||||
@ -98,7 +98,7 @@ class ActionTests(TestCase):
|
||||
data = {
|
||||
'email': 'test@example.com',
|
||||
'project_id': 'test_project_id',
|
||||
'roles': ['Member']
|
||||
'roles': ['_member_']
|
||||
}
|
||||
|
||||
action = NewUser(data, task=task, order=1)
|
||||
@ -113,7 +113,7 @@ class ActionTests(TestCase):
|
||||
action.submit(token_data)
|
||||
self.assertEquals(action.valid, True)
|
||||
|
||||
self.assertEquals(project.roles[user.id], ['Member'])
|
||||
self.assertEquals(project.roles[user.id], ['_member_'])
|
||||
|
||||
@mock.patch('stacktask.actions.models.user_store.IdentityManager',
|
||||
FakeManager)
|
||||
@ -133,7 +133,7 @@ class ActionTests(TestCase):
|
||||
project = mock.Mock()
|
||||
project.id = 'test_project_id'
|
||||
project.name = 'test_project'
|
||||
project.roles = {user.id: ['Member']}
|
||||
project.roles = {user.id: ['_member_']}
|
||||
|
||||
setup_temp_cache({'test_project': project}, {user.id: user})
|
||||
|
||||
@ -145,7 +145,7 @@ class ActionTests(TestCase):
|
||||
data = {
|
||||
'email': 'test@example.com',
|
||||
'project_id': 'test_project_id',
|
||||
'roles': ['Member']
|
||||
'roles': ['_member_']
|
||||
}
|
||||
|
||||
action = NewUser(data, task=task, order=1)
|
||||
@ -161,7 +161,7 @@ class ActionTests(TestCase):
|
||||
action.submit(token_data)
|
||||
self.assertEquals(action.valid, True)
|
||||
|
||||
self.assertEquals(project.roles[user.id], ['Member'])
|
||||
self.assertEquals(project.roles[user.id], ['_member_'])
|
||||
|
||||
@mock.patch('stacktask.actions.models.user_store.IdentityManager',
|
||||
FakeManager)
|
||||
@ -180,7 +180,7 @@ class ActionTests(TestCase):
|
||||
data = {
|
||||
'email': 'test@example.com',
|
||||
'project_id': 'test_project_id',
|
||||
'roles': ['Member']
|
||||
'roles': ['_member_']
|
||||
}
|
||||
|
||||
action = NewUser(data, task=task, order=1)
|
||||
@ -239,7 +239,7 @@ class ActionTests(TestCase):
|
||||
project = tests.temp_cache['projects']['test_project']
|
||||
self.assertEquals(
|
||||
sorted(project.roles["user_id_1"]),
|
||||
sorted(['Member', '_member_', 'project_owner',
|
||||
sorted(['_member_', 'project_owner',
|
||||
'project_mod', 'heat_stack_owner']))
|
||||
|
||||
@mock.patch('stacktask.actions.models.user_store.IdentityManager',
|
||||
@ -291,7 +291,7 @@ class ActionTests(TestCase):
|
||||
project = tests.temp_cache['projects']['test_project']
|
||||
self.assertEquals(
|
||||
sorted(project.roles["user_id_1"]),
|
||||
sorted(['Member', '_member_', 'project_owner',
|
||||
sorted(['_member_', 'project_owner',
|
||||
'project_mod', 'heat_stack_owner']))
|
||||
|
||||
@mock.patch('stacktask.actions.models.user_store.IdentityManager',
|
||||
@ -340,7 +340,7 @@ class ActionTests(TestCase):
|
||||
project = tests.temp_cache['projects']['test_project']
|
||||
self.assertEquals(
|
||||
sorted(project.roles[user.id]),
|
||||
sorted(['Member', '_member_', 'project_owner',
|
||||
sorted(['_member_', 'project_owner',
|
||||
'project_mod', 'heat_stack_owner']))
|
||||
|
||||
@mock.patch('stacktask.actions.models.user_store.IdentityManager',
|
||||
@ -473,7 +473,7 @@ class ActionTests(TestCase):
|
||||
data = {
|
||||
'user_id': 'user_id',
|
||||
'project_id': 'test_project_id',
|
||||
'roles': ['Member', 'project_mod'],
|
||||
'roles': ['_member_', 'project_mod'],
|
||||
'remove': False
|
||||
}
|
||||
|
||||
@ -491,7 +491,7 @@ class ActionTests(TestCase):
|
||||
|
||||
self.assertEquals(len(project.roles[user.id]), 2)
|
||||
self.assertEquals(set(project.roles[user.id]),
|
||||
set(['Member', 'project_mod']))
|
||||
set(['_member_', 'project_mod']))
|
||||
|
||||
@mock.patch('stacktask.actions.models.user_store.IdentityManager',
|
||||
FakeManager)
|
||||
@ -507,7 +507,7 @@ class ActionTests(TestCase):
|
||||
project = mock.Mock()
|
||||
project.id = 'test_project_id'
|
||||
project.name = 'test_project'
|
||||
project.roles = {user.id: ['Member', 'project_mod']}
|
||||
project.roles = {user.id: ['_member_', 'project_mod']}
|
||||
|
||||
setup_temp_cache({'test_project': project}, {user.id: user})
|
||||
|
||||
@ -519,7 +519,7 @@ class ActionTests(TestCase):
|
||||
data = {
|
||||
'user_id': 'user_id',
|
||||
'project_id': 'test_project_id',
|
||||
'roles': ['Member', 'project_mod'],
|
||||
'roles': ['_member_', 'project_mod'],
|
||||
'remove': False
|
||||
}
|
||||
|
||||
@ -538,7 +538,7 @@ class ActionTests(TestCase):
|
||||
|
||||
self.assertEquals(len(project.roles[user.id]), 2)
|
||||
self.assertEquals(set(project.roles[user.id]),
|
||||
set(['Member', 'project_mod']))
|
||||
set(['_member_', 'project_mod']))
|
||||
|
||||
@mock.patch('stacktask.actions.models.user_store.IdentityManager',
|
||||
FakeManager)
|
||||
@ -555,7 +555,7 @@ class ActionTests(TestCase):
|
||||
project = mock.Mock()
|
||||
project.id = 'test_project_id'
|
||||
project.name = 'test_project'
|
||||
project.roles = {user.id: ['Member', 'project_mod']}
|
||||
project.roles = {user.id: ['_member_', 'project_mod']}
|
||||
|
||||
setup_temp_cache({'test_project': project}, {user.id: user})
|
||||
|
||||
@ -583,7 +583,7 @@ class ActionTests(TestCase):
|
||||
action.submit(token_data)
|
||||
self.assertEquals(action.valid, True)
|
||||
|
||||
self.assertEquals(project.roles[user.id], ['Member'])
|
||||
self.assertEquals(project.roles[user.id], ['_member_'])
|
||||
|
||||
@mock.patch('stacktask.actions.models.user_store.IdentityManager',
|
||||
FakeManager)
|
||||
@ -600,7 +600,7 @@ class ActionTests(TestCase):
|
||||
project = mock.Mock()
|
||||
project.id = 'test_project_id'
|
||||
project.name = 'test_project'
|
||||
project.roles = {user.id: ['Member']}
|
||||
project.roles = {user.id: ['_member_']}
|
||||
|
||||
setup_temp_cache({'test_project': project}, {user.id: user})
|
||||
|
||||
@ -629,4 +629,4 @@ class ActionTests(TestCase):
|
||||
action.submit(token_data)
|
||||
self.assertEquals(action.valid, True)
|
||||
|
||||
self.assertEquals(project.roles[user.id], ['Member'])
|
||||
self.assertEquals(project.roles[user.id], ['_member_'])
|
||||
|
@ -34,7 +34,6 @@ def setup_temp_cache(projects, users):
|
||||
'users': users,
|
||||
'projects': projects,
|
||||
'roles': {
|
||||
'Member': 'Member',
|
||||
'_member_': '_member_',
|
||||
'admin': 'admin',
|
||||
'project_owner': 'project_owner',
|
||||
|
@ -73,7 +73,7 @@ class AdminAPITests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "admin,Member",
|
||||
'roles': "admin,_member_",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
@ -202,7 +202,7 @@ class AdminAPITests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "admin,Member",
|
||||
'roles': "admin,_member_",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
@ -244,7 +244,7 @@ class AdminAPITests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "admin,Member",
|
||||
'roles': "admin,_member_",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
@ -291,7 +291,7 @@ class AdminAPITests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "admin,Member",
|
||||
'roles': "admin,_member_",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
@ -343,7 +343,7 @@ class AdminAPITests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "admin,Member",
|
||||
'roles': "admin,_member_",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
@ -415,7 +415,7 @@ class AdminAPITests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "admin,Member",
|
||||
'roles': "admin,_member_",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
@ -456,7 +456,7 @@ class AdminAPITests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "admin,Member",
|
||||
'roles': "admin,_member_",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
@ -490,12 +490,12 @@ class AdminAPITests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "project_owner,Member,project_mod",
|
||||
'roles': "project_owner,_member_,project_mod",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
}
|
||||
data = {'email': "test@example.com", 'roles': ["Member"],
|
||||
data = {'email': "test@example.com", 'roles': ["_member_"],
|
||||
'project_id': 'test_project_id'}
|
||||
response = self.client.post(url, data, format='json', headers=headers)
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
@ -544,7 +544,7 @@ class AdminAPITests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "admin,Member",
|
||||
'roles': "admin,_member_",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
@ -582,7 +582,7 @@ class AdminAPITests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "admin,Member",
|
||||
'roles': "admin,_member_",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
@ -627,7 +627,7 @@ class AdminAPITests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "admin,Member",
|
||||
'roles': "admin,_member_",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
@ -666,12 +666,12 @@ class AdminAPITests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "project_owner,Member,project_mod",
|
||||
'roles': "project_owner,_member_,project_mod",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
}
|
||||
data = {'email': "test@example.com", 'roles': ["Member"],
|
||||
data = {'email': "test@example.com", 'roles': ["_member_"],
|
||||
'project_id': 'test_project_id'}
|
||||
response = self.client.post(url, data, format='json', headers=headers)
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
@ -712,12 +712,12 @@ class AdminAPITests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "project_owner,Member,project_mod",
|
||||
'roles': "project_owner,_member_,project_mod",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
}
|
||||
data = {'email': "test@example.com", 'roles': ["Member"],
|
||||
data = {'email': "test@example.com", 'roles': ["_member_"],
|
||||
'project_id': 'test_project_id'}
|
||||
response = self.client.post(url, data, format='json', headers=headers)
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
@ -746,20 +746,20 @@ class AdminAPITests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "project_owner,Member,project_mod",
|
||||
'roles': "project_owner,_member_,project_mod",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
}
|
||||
data = {'email': "test@example.com", 'roles': ["Member"],
|
||||
data = {'email': "test@example.com", 'roles': ["_member_"],
|
||||
'project_id': 'test_project_id'}
|
||||
response = self.client.post(url, data, format='json', headers=headers)
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
data = {'email': "test2@example.com", 'roles': ["Member"],
|
||||
data = {'email': "test2@example.com", 'roles': ["_member_"],
|
||||
'project_id': 'test_project_id'}
|
||||
response = self.client.post(url, data, format='json', headers=headers)
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
data = {'email': "test3@example.com", 'roles': ["Member"],
|
||||
data = {'email': "test3@example.com", 'roles': ["_member_"],
|
||||
'project_id': 'test_project_id'}
|
||||
response = self.client.post(url, data, format='json', headers=headers)
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
@ -767,7 +767,7 @@ class AdminAPITests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "admin,Member",
|
||||
'roles': "admin,_member_",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
@ -793,16 +793,16 @@ class AdminAPITests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "project_owner,Member,project_mod",
|
||||
'roles': "project_owner,_member_,project_mod",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
}
|
||||
data = {'email': "test@example.com", 'roles': ["Member"],
|
||||
data = {'email': "test@example.com", 'roles': ["_member_"],
|
||||
'project_id': 'test_project_id'}
|
||||
response = self.client.post(url, data, format='json', headers=headers)
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
data = {'email': "test2@example.com", 'roles': ["Member"],
|
||||
data = {'email': "test2@example.com", 'roles': ["_member_"],
|
||||
'project_id': 'test_project_id'}
|
||||
response = self.client.post(url, data, format='json', headers=headers)
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
@ -815,7 +815,7 @@ class AdminAPITests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "admin,Member",
|
||||
'roles': "admin,_member_",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
@ -872,12 +872,12 @@ class AdminAPITests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "project_owner,Member,project_mod",
|
||||
'roles': "project_owner,_member_,project_mod",
|
||||
'username': "owner@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
}
|
||||
data = {'email': "test@example.com", 'roles': ["Member"],
|
||||
data = {'email': "test@example.com", 'roles': ["_member_"],
|
||||
'project_id': 'test_project_id'}
|
||||
response = self.client.post(url, data, format='json', headers=headers)
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
@ -885,7 +885,7 @@ class AdminAPITests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id_2",
|
||||
'roles': "project_owner,Member,project_mod",
|
||||
'roles': "project_owner,_member_,project_mod",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
@ -920,12 +920,12 @@ class AdminAPITests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "project_owner,Member,project_mod",
|
||||
'roles': "project_owner,_member_,project_mod",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
}
|
||||
data = {'email': "test@example.com", 'roles': ["Member"],
|
||||
data = {'email': "test@example.com", 'roles': ["_member_"],
|
||||
'project_id': 'test_project_id'}
|
||||
response = self.client.post(url, data, format='json', headers=headers)
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
@ -933,7 +933,7 @@ class AdminAPITests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "admin,Member",
|
||||
'roles': "admin,_member_",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
|
@ -47,12 +47,12 @@ class OpenstackAPITests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "project_owner,Member,project_mod",
|
||||
'roles': "project_owner,_member_,project_mod",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
}
|
||||
data = {'email': "test@example.com", 'roles': ["Member"],
|
||||
data = {'email': "test@example.com", 'roles': ["_member_"],
|
||||
'project_id': 'test_project_id'}
|
||||
response = self.client.post(url, data, format='json', headers=headers)
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
@ -80,13 +80,13 @@ class OpenstackAPITests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "project_owner,Member,project_mod",
|
||||
'roles': "project_owner,_member_,project_mod",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
}
|
||||
|
||||
data = {'email': "test@example.com", 'roles': ["Member"],
|
||||
data = {'email': "test@example.com", 'roles': ["_member_"],
|
||||
'project_id': 'test_project_id'}
|
||||
response = self.client.post(url, data, format='json', headers=headers)
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
@ -99,7 +99,7 @@ class OpenstackAPITests(APITestCase):
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
|
||||
url = "/v1/openstack/users"
|
||||
data = {'email': "test2@example.com", 'roles': ["Member"],
|
||||
data = {'email': "test2@example.com", 'roles': ["_member_"],
|
||||
'project_id': 'test_project_id'}
|
||||
response = self.client.post(url, data, format='json', headers=headers)
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
@ -129,7 +129,7 @@ class OpenstackAPITests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "Member",
|
||||
'roles': "_member_",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
@ -141,7 +141,7 @@ class OpenstackAPITests(APITestCase):
|
||||
self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)
|
||||
response = self.client.post(url, data, format='json', headers=headers)
|
||||
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
|
||||
headers["roles"] = "admin,Member"
|
||||
headers["roles"] = "admin,_member_"
|
||||
response = self.client.post(url, data, format='json', headers=headers)
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
self.assertEqual(response.data, None)
|
||||
|
@ -47,12 +47,12 @@ class TaskViewTests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "project_owner,Member,project_mod",
|
||||
'roles': "project_owner,_member_,project_mod",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
}
|
||||
data = {'email': "test@example.com", 'roles': ["Member"],
|
||||
data = {'email': "test@example.com", 'roles': ["_member_"],
|
||||
'project_id': 'test_project_id'}
|
||||
response = self.client.post(url, data, format='json', headers=headers)
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
@ -76,12 +76,12 @@ class TaskViewTests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "project_owner,Member,project_mod",
|
||||
'roles': "project_owner,_member_,project_mod",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
}
|
||||
data = {'email': "test@example.com", 'roles': ["Member"],
|
||||
data = {'email': "test@example.com", 'roles': ["_member_"],
|
||||
'project_id': 'test_project_id'}
|
||||
response = self.client.post(url, data, format='json', headers=headers)
|
||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
@ -99,12 +99,12 @@ class TaskViewTests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "Member",
|
||||
'roles': "_member_",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
}
|
||||
data = {'email': "test@example.com", 'roles': ["Member"],
|
||||
data = {'email': "test@example.com", 'roles': ["_member_"],
|
||||
'project_id': 'test_project_id'}
|
||||
response = self.client.post(url, data, format='json', headers=headers)
|
||||
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
|
||||
@ -120,7 +120,7 @@ class TaskViewTests(APITestCase):
|
||||
|
||||
url = "/v1/actions/InviteUser"
|
||||
headers = {}
|
||||
data = {'email': "test@example.com", 'roles': ["Member"],
|
||||
data = {'email': "test@example.com", 'roles': ["_member_"],
|
||||
'project_id': 'test_project_id'}
|
||||
response = self.client.post(url, data, format='json', headers=headers)
|
||||
self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)
|
||||
@ -151,12 +151,12 @@ class TaskViewTests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "project_owner,Member,project_mod",
|
||||
'roles': "project_owner,_member_,project_mod",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
}
|
||||
data = {'email': "test@example.com", 'roles': ["Member"],
|
||||
data = {'email': "test@example.com", 'roles': ["_member_"],
|
||||
'project_id': 'test_project_id'}
|
||||
response = self.client.post(url, data, format='json', headers=headers)
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
@ -184,7 +184,7 @@ class TaskViewTests(APITestCase):
|
||||
project = mock.Mock()
|
||||
project.id = 'test_project_id'
|
||||
project.name = 'test_project'
|
||||
project.roles = {user.id: ['Member']}
|
||||
project.roles = {user.id: ['_member_']}
|
||||
|
||||
setup_temp_cache({'test_project': project}, {user.id: user})
|
||||
|
||||
@ -192,12 +192,12 @@ class TaskViewTests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "project_owner,Member,project_mod",
|
||||
'roles': "project_owner,_member_,project_mod",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
}
|
||||
data = {'email': "test@example.com", 'roles': ["Member"],
|
||||
data = {'email': "test@example.com", 'roles': ["_member_"],
|
||||
'project_id': 'test_project_id'}
|
||||
response = self.client.post(url, data, format='json', headers=headers)
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
@ -224,7 +224,7 @@ class TaskViewTests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "admin,Member",
|
||||
'roles': "admin,_member_",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
@ -262,7 +262,7 @@ class TaskViewTests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "project_owner,Member,project_mod",
|
||||
'roles': "project_owner,_member_,project_mod",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
@ -275,7 +275,7 @@ class TaskViewTests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "admin,Member",
|
||||
'roles': "admin,_member_",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
@ -308,7 +308,7 @@ class TaskViewTests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "project_owner,Member,project_mod",
|
||||
'roles': "project_owner,_member_,project_mod",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
@ -321,7 +321,7 @@ class TaskViewTests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "admin,Member",
|
||||
'roles': "admin,_member_",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
@ -446,7 +446,7 @@ class TaskViewTests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "admin,Member",
|
||||
'roles': "admin,_member_",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
@ -503,12 +503,12 @@ class TaskViewTests(APITestCase):
|
||||
headers = {
|
||||
'project_name': "test_project",
|
||||
'project_id': "test_project_id",
|
||||
'roles': "project_owner,Member,project_mod",
|
||||
'roles': "project_owner,_member_,project_mod",
|
||||
'username': "test@example.com",
|
||||
'user_id': "test_user_id",
|
||||
'authenticated': True
|
||||
}
|
||||
data = {'email': "test@example.com", 'roles': ["Member"],
|
||||
data = {'email': "test@example.com", 'roles': ["_member_"],
|
||||
'project_id': 'test_project_id'}
|
||||
response = self.client.post(url, data, format='json', headers=headers)
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
@ -516,7 +516,7 @@ class TaskViewTests(APITestCase):
|
||||
response = self.client.post(url, data, format='json', headers=headers)
|
||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
data = {'email': "test2@example.com", 'roles': ["Member"],
|
||||
data = {'email': "test2@example.com", 'roles': ["_member_"],
|
||||
'project_id': 'test_project_id'}
|
||||
response = self.client.post(url, data, format='json', headers=headers)
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
|
@ -152,7 +152,7 @@ TASK_SETTINGS = {
|
||||
|
||||
ACTION_SETTINGS = {
|
||||
'NewUser': {
|
||||
'allowed_roles': ['project_mod', 'project_owner', "Member"]
|
||||
'allowed_roles': ['project_mod', 'project_owner', "_member_"]
|
||||
},
|
||||
'ResetUser': {
|
||||
'blacklisted_roles': ['admin']
|
||||
@ -171,14 +171,13 @@ ACTION_SETTINGS = {
|
||||
|
||||
ROLES_MAPPING = {
|
||||
'admin': [
|
||||
'project_owner', 'project_mod', 'Member', 'heat_stack_owner',
|
||||
'_member_'
|
||||
'project_owner', 'project_mod', '_member_', 'heat_stack_owner'
|
||||
],
|
||||
'project_owner': [
|
||||
'project_mod', 'Member', 'heat_stack_owner', '_member_'
|
||||
'project_mod', '_member_', 'heat_stack_owner'
|
||||
],
|
||||
'project_mod': [
|
||||
'Member', 'heat_stack_owner', '_member_'
|
||||
'_member_', 'heat_stack_owner'
|
||||
],
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user