@@ 1540-1580 (lines=41) @@ | ||
1537 | assert user_role_found['user_id'] == user_role['user_id'] |
|
1538 | assert user_role_found['workspace_id'] == user_role['workspace_id'] |
|
1539 | ||
1540 | def test_api__create_workspace_member_role__ok_200__user_public_name(self): |
|
1541 | """ |
|
1542 | Create workspace member role |
|
1543 | :return: |
|
1544 | """ |
|
1545 | self.testapp.authorization = ( |
|
1546 | 'Basic', |
|
1547 | ( |
|
1548 | '[email protected]', |
|
1549 | '[email protected]' |
|
1550 | ) |
|
1551 | ) |
|
1552 | # create workspace role |
|
1553 | params = { |
|
1554 | 'user_id': None, |
|
1555 | 'user_email_or_public_name': 'Lawrence L.', |
|
1556 | 'role': 'content-manager', |
|
1557 | } |
|
1558 | res = self.testapp.post_json( |
|
1559 | '/api/v2/workspaces/1/members', |
|
1560 | status=200, |
|
1561 | params=params, |
|
1562 | ) |
|
1563 | user_role_found = res.json_body |
|
1564 | assert user_role_found['role'] == 'content-manager' |
|
1565 | assert user_role_found['user_id'] == 2 |
|
1566 | assert user_role_found['workspace_id'] == 1 |
|
1567 | assert user_role_found['newly_created'] is False |
|
1568 | assert user_role_found['email_sent'] is False |
|
1569 | assert user_role_found['do_notify'] is False |
|
1570 | ||
1571 | res = self.testapp.get('/api/v2/workspaces/1/members', status=200).json_body # nopep8 |
|
1572 | assert len(res) == 2 |
|
1573 | user_role = res[0] |
|
1574 | assert user_role['role'] == 'workspace-manager' |
|
1575 | assert user_role['user_id'] == 1 |
|
1576 | assert user_role['workspace_id'] == 1 |
|
1577 | user_role = res[1] |
|
1578 | assert user_role_found['role'] == user_role['role'] |
|
1579 | assert user_role_found['user_id'] == user_role['user_id'] |
|
1580 | assert user_role_found['workspace_id'] == user_role['workspace_id'] |
|
1581 | ||
1582 | def test_api__create_workspace_member_role__err_400__nothing(self): |
|
1583 | """ |
|
@@ 1498-1538 (lines=41) @@ | ||
1495 | assert user_role_found['user_id'] == user_role['user_id'] |
|
1496 | assert user_role_found['workspace_id'] == user_role['workspace_id'] |
|
1497 | ||
1498 | def test_api__create_workspace_member_role__ok_200__user_email(self): |
|
1499 | """ |
|
1500 | Create workspace member role |
|
1501 | :return: |
|
1502 | """ |
|
1503 | self.testapp.authorization = ( |
|
1504 | 'Basic', |
|
1505 | ( |
|
1506 | '[email protected]', |
|
1507 | '[email protected]' |
|
1508 | ) |
|
1509 | ) |
|
1510 | # create workspace role |
|
1511 | params = { |
|
1512 | 'user_id': None, |
|
1513 | 'user_email_or_public_name': '[email protected]', |
|
1514 | 'role': 'content-manager', |
|
1515 | } |
|
1516 | res = self.testapp.post_json( |
|
1517 | '/api/v2/workspaces/1/members', |
|
1518 | status=200, |
|
1519 | params=params, |
|
1520 | ) |
|
1521 | user_role_found = res.json_body |
|
1522 | assert user_role_found['role'] == 'content-manager' |
|
1523 | assert user_role_found['user_id'] == 2 |
|
1524 | assert user_role_found['workspace_id'] == 1 |
|
1525 | assert user_role_found['newly_created'] is False |
|
1526 | assert user_role_found['email_sent'] is False |
|
1527 | assert user_role_found['do_notify'] is False |
|
1528 | ||
1529 | res = self.testapp.get('/api/v2/workspaces/1/members', status=200).json_body # nopep8 |
|
1530 | assert len(res) == 2 |
|
1531 | user_role = res[0] |
|
1532 | assert user_role['role'] == 'workspace-manager' |
|
1533 | assert user_role['user_id'] == 1 |
|
1534 | assert user_role['workspace_id'] == 1 |
|
1535 | user_role = res[1] |
|
1536 | assert user_role_found['role'] == user_role['role'] |
|
1537 | assert user_role_found['user_id'] == user_role['user_id'] |
|
1538 | assert user_role_found['workspace_id'] == user_role['workspace_id'] |
|
1539 | ||
1540 | def test_api__create_workspace_member_role__ok_200__user_public_name(self): |
|
1541 | """ |
|
@@ 1313-1353 (lines=41) @@ | ||
1310 | assert 'message' in res.json.keys() |
|
1311 | assert 'details' in res.json.keys() |
|
1312 | ||
1313 | def test_api__create_workspace_member_role__ok_200__user_id(self): |
|
1314 | """ |
|
1315 | Create workspace member role |
|
1316 | :return: |
|
1317 | """ |
|
1318 | self.testapp.authorization = ( |
|
1319 | 'Basic', |
|
1320 | ( |
|
1321 | '[email protected]', |
|
1322 | '[email protected]' |
|
1323 | ) |
|
1324 | ) |
|
1325 | # create workspace role |
|
1326 | params = { |
|
1327 | 'user_id': 2, |
|
1328 | 'user_email_or_public_name': None, |
|
1329 | 'role': 'content-manager', |
|
1330 | } |
|
1331 | res = self.testapp.post_json( |
|
1332 | '/api/v2/workspaces/1/members', |
|
1333 | status=200, |
|
1334 | params=params, |
|
1335 | ) |
|
1336 | user_role_found = res.json_body |
|
1337 | assert user_role_found['role'] == 'content-manager' |
|
1338 | assert user_role_found['user_id'] == 2 |
|
1339 | assert user_role_found['workspace_id'] == 1 |
|
1340 | assert user_role_found['newly_created'] is False |
|
1341 | assert user_role_found['email_sent'] is False |
|
1342 | assert user_role_found['do_notify'] is False |
|
1343 | ||
1344 | res = self.testapp.get('/api/v2/workspaces/1/members', status=200).json_body # nopep8 |
|
1345 | assert len(res) == 2 |
|
1346 | user_role = res[0] |
|
1347 | assert user_role['role'] == 'workspace-manager' |
|
1348 | assert user_role['user_id'] == 1 |
|
1349 | assert user_role['workspace_id'] == 1 |
|
1350 | user_role = res[1] |
|
1351 | assert user_role_found['role'] == user_role['role'] |
|
1352 | assert user_role_found['user_id'] == user_role['user_id'] |
|
1353 | assert user_role_found['workspace_id'] == user_role['workspace_id'] |
|
1354 | ||
1355 | def test_api__create_workspace_members_role_ok_200__user_email_as_admin(self): |
|
1356 | """ |