@@ 1803-1844 (lines=42) @@ | ||
1800 | assert 'code' in res.json.keys() |
|
1801 | assert res.json_body['code'] == error.USER_DELETED |
|
1802 | ||
1803 | def test_api__create_workspace_member_role__ok_200__user_public_name(self): |
|
1804 | """ |
|
1805 | Create workspace member role |
|
1806 | :return: |
|
1807 | """ |
|
1808 | self.testapp.authorization = ( |
|
1809 | 'Basic', |
|
1810 | ( |
|
1811 | '[email protected]', |
|
1812 | '[email protected]' |
|
1813 | ) |
|
1814 | ) |
|
1815 | # create workspace role |
|
1816 | params = { |
|
1817 | 'user_id': None, |
|
1818 | 'user_email': None, |
|
1819 | 'user_public_name': 'Lawrence L.', |
|
1820 | 'role': 'content-manager', |
|
1821 | } |
|
1822 | res = self.testapp.post_json( |
|
1823 | '/api/v2/workspaces/1/members', |
|
1824 | status=200, |
|
1825 | params=params, |
|
1826 | ) |
|
1827 | user_role_found = res.json_body |
|
1828 | assert user_role_found['role'] == 'content-manager' |
|
1829 | assert user_role_found['user_id'] == 2 |
|
1830 | assert user_role_found['workspace_id'] == 1 |
|
1831 | assert user_role_found['newly_created'] is False |
|
1832 | assert user_role_found['email_sent'] is False |
|
1833 | assert user_role_found['do_notify'] is False |
|
1834 | ||
1835 | res = self.testapp.get('/api/v2/workspaces/1/members', status=200).json_body # nopep8 |
|
1836 | assert len(res) == 2 |
|
1837 | user_role = res[0] |
|
1838 | assert user_role['role'] == 'workspace-manager' |
|
1839 | assert user_role['user_id'] == 1 |
|
1840 | assert user_role['workspace_id'] == 1 |
|
1841 | user_role = res[1] |
|
1842 | assert user_role_found['role'] == user_role['role'] |
|
1843 | assert user_role_found['user_id'] == user_role['user_id'] |
|
1844 | assert user_role_found['workspace_id'] == user_role['workspace_id'] |
|
1845 | ||
1846 | def test_api__create_workspace_member_role__ok_400__user_public_name_user_already_in_workspace(self): |
|
1847 | """ |
|
@@ 1676-1717 (lines=42) @@ | ||
1673 | assert user_role['user_id'] == user_id |
|
1674 | assert user_role['workspace_id'] == workspace_id |
|
1675 | ||
1676 | def test_api__create_workspace_member_role__ok_200__user_email(self): |
|
1677 | """ |
|
1678 | Create workspace member role |
|
1679 | :return: |
|
1680 | """ |
|
1681 | self.testapp.authorization = ( |
|
1682 | 'Basic', |
|
1683 | ( |
|
1684 | '[email protected]', |
|
1685 | '[email protected]' |
|
1686 | ) |
|
1687 | ) |
|
1688 | # create workspace role |
|
1689 | params = { |
|
1690 | 'user_id': None, |
|
1691 | 'user_email': '[email protected]', |
|
1692 | 'user_public_name': None, |
|
1693 | 'role': 'content-manager', |
|
1694 | } |
|
1695 | res = self.testapp.post_json( |
|
1696 | '/api/v2/workspaces/1/members', |
|
1697 | status=200, |
|
1698 | params=params, |
|
1699 | ) |
|
1700 | user_role_found = res.json_body |
|
1701 | assert user_role_found['role'] == 'content-manager' |
|
1702 | assert user_role_found['user_id'] == 2 |
|
1703 | assert user_role_found['workspace_id'] == 1 |
|
1704 | assert user_role_found['newly_created'] is False |
|
1705 | assert user_role_found['email_sent'] is False |
|
1706 | assert user_role_found['do_notify'] is False |
|
1707 | ||
1708 | res = self.testapp.get('/api/v2/workspaces/1/members', status=200).json_body # nopep8 |
|
1709 | assert len(res) == 2 |
|
1710 | user_role = res[0] |
|
1711 | assert user_role['role'] == 'workspace-manager' |
|
1712 | assert user_role['user_id'] == 1 |
|
1713 | assert user_role['workspace_id'] == 1 |
|
1714 | user_role = res[1] |
|
1715 | assert user_role_found['role'] == user_role['role'] |
|
1716 | assert user_role_found['user_id'] == user_role['user_id'] |
|
1717 | assert user_role_found['workspace_id'] == user_role['workspace_id'] |
|
1718 | ||
1719 | def test_api__create_workspace_member_role__err_400__user_email__user_deactivated(self): # nopep8 |
|
1720 | """ |
|
@@ 1488-1529 (lines=42) @@ | ||
1485 | assert 'message' in res.json.keys() |
|
1486 | assert 'details' in res.json.keys() |
|
1487 | ||
1488 | def test_api__create_workspace_member_role__ok_200__user_id(self): |
|
1489 | """ |
|
1490 | Create workspace member role |
|
1491 | :return: |
|
1492 | """ |
|
1493 | self.testapp.authorization = ( |
|
1494 | 'Basic', |
|
1495 | ( |
|
1496 | '[email protected]', |
|
1497 | '[email protected]' |
|
1498 | ) |
|
1499 | ) |
|
1500 | # create workspace role |
|
1501 | params = { |
|
1502 | 'user_id': 2, |
|
1503 | 'user_email': None, |
|
1504 | 'user_public_name': None, |
|
1505 | 'role': 'content-manager', |
|
1506 | } |
|
1507 | res = self.testapp.post_json( |
|
1508 | '/api/v2/workspaces/1/members', |
|
1509 | status=200, |
|
1510 | params=params, |
|
1511 | ) |
|
1512 | user_role_found = res.json_body |
|
1513 | assert user_role_found['role'] == 'content-manager' |
|
1514 | assert user_role_found['user_id'] == 2 |
|
1515 | assert user_role_found['workspace_id'] == 1 |
|
1516 | assert user_role_found['newly_created'] is False |
|
1517 | assert user_role_found['email_sent'] is False |
|
1518 | assert user_role_found['do_notify'] is False |
|
1519 | ||
1520 | res = self.testapp.get('/api/v2/workspaces/1/members', status=200).json_body # nopep8 |
|
1521 | assert len(res) == 2 |
|
1522 | user_role = res[0] |
|
1523 | assert user_role['role'] == 'workspace-manager' |
|
1524 | assert user_role['user_id'] == 1 |
|
1525 | assert user_role['workspace_id'] == 1 |
|
1526 | user_role = res[1] |
|
1527 | assert user_role_found['role'] == user_role['role'] |
|
1528 | assert user_role_found['user_id'] == user_role['user_id'] |
|
1529 | assert user_role_found['workspace_id'] == user_role['workspace_id'] |
|
1530 | ||
1531 | def test_api__create_workspace_members_role_ok_200__user_email_as_admin(self): |
|
1532 | """ |