|
@@ 1377-1419 (lines=43) @@
|
| 1374 |
|
params=params, |
| 1375 |
|
) |
| 1376 |
|
|
| 1377 |
|
def test_api__create_workspace_member_role__ok_200__new_user(self): # nopep8 |
| 1378 |
|
""" |
| 1379 |
|
Create workspace member role |
| 1380 |
|
:return: |
| 1381 |
|
""" |
| 1382 |
|
self.testapp.authorization = ( |
| 1383 |
|
'Basic', |
| 1384 |
|
( |
| 1385 |
|
'[email protected]', |
| 1386 |
|
'[email protected]' |
| 1387 |
|
) |
| 1388 |
|
) |
| 1389 |
|
# create workspace role |
| 1390 |
|
params = { |
| 1391 |
|
'user_id': None, |
| 1392 |
|
'user_email_or_public_name': '[email protected]', |
| 1393 |
|
'role': 'content-manager', |
| 1394 |
|
} |
| 1395 |
|
res = self.testapp.post_json( |
| 1396 |
|
'/api/v2/workspaces/1/members', |
| 1397 |
|
status=200, |
| 1398 |
|
params=params, |
| 1399 |
|
) |
| 1400 |
|
user_role_found = res.json_body |
| 1401 |
|
assert user_role_found['role'] == 'content-manager' |
| 1402 |
|
assert user_role_found['user_id'] |
| 1403 |
|
user_id = user_role_found['user_id'] |
| 1404 |
|
assert user_role_found['workspace_id'] == 1 |
| 1405 |
|
assert user_role_found['newly_created'] is True |
| 1406 |
|
assert user_role_found['email_sent'] is False |
| 1407 |
|
assert user_role_found['do_notify'] is False |
| 1408 |
|
|
| 1409 |
|
res = self.testapp.get('/api/v2/workspaces/1/members', |
| 1410 |
|
status=200).json_body # nopep8 |
| 1411 |
|
assert len(res) == 2 |
| 1412 |
|
user_role = res[0] |
| 1413 |
|
assert user_role['role'] == 'workspace-manager' |
| 1414 |
|
assert user_role['user_id'] == 1 |
| 1415 |
|
assert user_role['workspace_id'] == 1 |
| 1416 |
|
user_role = res[1] |
| 1417 |
|
assert user_role_found['role'] == user_role['role'] |
| 1418 |
|
assert user_role_found['user_id'] == user_role['user_id'] |
| 1419 |
|
assert user_role_found['workspace_id'] == user_role['workspace_id'] |
| 1420 |
|
|
| 1421 |
|
def test_api__update_workspace_member_role__ok_200__nominal_case(self): |
| 1422 |
|
""" |
|
@@ 1287-1327 (lines=41) @@
|
| 1284 |
|
assert user_role_found['user_id'] == user_role['user_id'] |
| 1285 |
|
assert user_role_found['workspace_id'] == user_role['workspace_id'] |
| 1286 |
|
|
| 1287 |
|
def test_api__create_workspace_member_role__ok_200__user_public_name(self): |
| 1288 |
|
""" |
| 1289 |
|
Create workspace member role |
| 1290 |
|
:return: |
| 1291 |
|
""" |
| 1292 |
|
self.testapp.authorization = ( |
| 1293 |
|
'Basic', |
| 1294 |
|
( |
| 1295 |
|
'[email protected]', |
| 1296 |
|
'[email protected]' |
| 1297 |
|
) |
| 1298 |
|
) |
| 1299 |
|
# create workspace role |
| 1300 |
|
params = { |
| 1301 |
|
'user_id': None, |
| 1302 |
|
'user_email_or_public_name': 'Lawrence L.', |
| 1303 |
|
'role': 'content-manager', |
| 1304 |
|
} |
| 1305 |
|
res = self.testapp.post_json( |
| 1306 |
|
'/api/v2/workspaces/1/members', |
| 1307 |
|
status=200, |
| 1308 |
|
params=params, |
| 1309 |
|
) |
| 1310 |
|
user_role_found = res.json_body |
| 1311 |
|
assert user_role_found['role'] == 'content-manager' |
| 1312 |
|
assert user_role_found['user_id'] == 2 |
| 1313 |
|
assert user_role_found['workspace_id'] == 1 |
| 1314 |
|
assert user_role_found['newly_created'] is False |
| 1315 |
|
assert user_role_found['email_sent'] is False |
| 1316 |
|
assert user_role_found['do_notify'] is False |
| 1317 |
|
|
| 1318 |
|
res = self.testapp.get('/api/v2/workspaces/1/members', status=200).json_body # nopep8 |
| 1319 |
|
assert len(res) == 2 |
| 1320 |
|
user_role = res[0] |
| 1321 |
|
assert user_role['role'] == 'workspace-manager' |
| 1322 |
|
assert user_role['user_id'] == 1 |
| 1323 |
|
assert user_role['workspace_id'] == 1 |
| 1324 |
|
user_role = res[1] |
| 1325 |
|
assert user_role_found['role'] == user_role['role'] |
| 1326 |
|
assert user_role_found['user_id'] == user_role['user_id'] |
| 1327 |
|
assert user_role_found['workspace_id'] == user_role['workspace_id'] |
| 1328 |
|
|
| 1329 |
|
def test_api__create_workspace_member_role__err_400__nothing(self): |
| 1330 |
|
""" |
|
@@ 1245-1285 (lines=41) @@
|
| 1242 |
|
assert user_role_found['user_id'] == user_role['user_id'] |
| 1243 |
|
assert user_role_found['workspace_id'] == user_role['workspace_id'] |
| 1244 |
|
|
| 1245 |
|
def test_api__create_workspace_member_role__ok_200__user_email(self): |
| 1246 |
|
""" |
| 1247 |
|
Create workspace member role |
| 1248 |
|
:return: |
| 1249 |
|
""" |
| 1250 |
|
self.testapp.authorization = ( |
| 1251 |
|
'Basic', |
| 1252 |
|
( |
| 1253 |
|
'[email protected]', |
| 1254 |
|
'[email protected]' |
| 1255 |
|
) |
| 1256 |
|
) |
| 1257 |
|
# create workspace role |
| 1258 |
|
params = { |
| 1259 |
|
'user_id': None, |
| 1260 |
|
'user_email_or_public_name': '[email protected]', |
| 1261 |
|
'role': 'content-manager', |
| 1262 |
|
} |
| 1263 |
|
res = self.testapp.post_json( |
| 1264 |
|
'/api/v2/workspaces/1/members', |
| 1265 |
|
status=200, |
| 1266 |
|
params=params, |
| 1267 |
|
) |
| 1268 |
|
user_role_found = res.json_body |
| 1269 |
|
assert user_role_found['role'] == 'content-manager' |
| 1270 |
|
assert user_role_found['user_id'] == 2 |
| 1271 |
|
assert user_role_found['workspace_id'] == 1 |
| 1272 |
|
assert user_role_found['newly_created'] is False |
| 1273 |
|
assert user_role_found['email_sent'] is False |
| 1274 |
|
assert user_role_found['do_notify'] is False |
| 1275 |
|
|
| 1276 |
|
res = self.testapp.get('/api/v2/workspaces/1/members', status=200).json_body # nopep8 |
| 1277 |
|
assert len(res) == 2 |
| 1278 |
|
user_role = res[0] |
| 1279 |
|
assert user_role['role'] == 'workspace-manager' |
| 1280 |
|
assert user_role['user_id'] == 1 |
| 1281 |
|
assert user_role['workspace_id'] == 1 |
| 1282 |
|
user_role = res[1] |
| 1283 |
|
assert user_role_found['role'] == user_role['role'] |
| 1284 |
|
assert user_role_found['user_id'] == user_role['user_id'] |
| 1285 |
|
assert user_role_found['workspace_id'] == user_role['workspace_id'] |
| 1286 |
|
|
| 1287 |
|
def test_api__create_workspace_member_role__ok_200__user_public_name(self): |
| 1288 |
|
""" |
|
@@ 1203-1243 (lines=41) @@
|
| 1200 |
|
assert 'message' in res.json.keys() |
| 1201 |
|
assert 'details' in res.json.keys() |
| 1202 |
|
|
| 1203 |
|
def test_api__create_workspace_member_role__ok_200__user_id(self): |
| 1204 |
|
""" |
| 1205 |
|
Create workspace member role |
| 1206 |
|
:return: |
| 1207 |
|
""" |
| 1208 |
|
self.testapp.authorization = ( |
| 1209 |
|
'Basic', |
| 1210 |
|
( |
| 1211 |
|
'[email protected]', |
| 1212 |
|
'[email protected]' |
| 1213 |
|
) |
| 1214 |
|
) |
| 1215 |
|
# create workspace role |
| 1216 |
|
params = { |
| 1217 |
|
'user_id': 2, |
| 1218 |
|
'user_email_or_public_name': None, |
| 1219 |
|
'role': 'content-manager', |
| 1220 |
|
} |
| 1221 |
|
res = self.testapp.post_json( |
| 1222 |
|
'/api/v2/workspaces/1/members', |
| 1223 |
|
status=200, |
| 1224 |
|
params=params, |
| 1225 |
|
) |
| 1226 |
|
user_role_found = res.json_body |
| 1227 |
|
assert user_role_found['role'] == 'content-manager' |
| 1228 |
|
assert user_role_found['user_id'] == 2 |
| 1229 |
|
assert user_role_found['workspace_id'] == 1 |
| 1230 |
|
assert user_role_found['newly_created'] is False |
| 1231 |
|
assert user_role_found['email_sent'] is False |
| 1232 |
|
assert user_role_found['do_notify'] is False |
| 1233 |
|
|
| 1234 |
|
res = self.testapp.get('/api/v2/workspaces/1/members', status=200).json_body # nopep8 |
| 1235 |
|
assert len(res) == 2 |
| 1236 |
|
user_role = res[0] |
| 1237 |
|
assert user_role['role'] == 'workspace-manager' |
| 1238 |
|
assert user_role['user_id'] == 1 |
| 1239 |
|
assert user_role['workspace_id'] == 1 |
| 1240 |
|
user_role = res[1] |
| 1241 |
|
assert user_role_found['role'] == user_role['role'] |
| 1242 |
|
assert user_role_found['user_id'] == user_role['user_id'] |
| 1243 |
|
assert user_role_found['workspace_id'] == user_role['workspace_id'] |
| 1244 |
|
|
| 1245 |
|
def test_api__create_workspace_member_role__ok_200__user_email(self): |
| 1246 |
|
""" |