Skip to content
Snippets Groups Projects
Commit 00c09f7e authored by lass's avatar lass
Browse files

Add tests for get role

parent 4b5c0eed
No related branches found
No related tags found
1 merge request!407Make role-list and role-detail return comments
Pipeline #208325 failed
...@@ -58,6 +58,7 @@ def role_data_guest( ...@@ -58,6 +58,7 @@ def role_data_guest(
"start_date": "2021-06-10", "start_date": "2021-06-10",
"end_date": "2021-08-10", "end_date": "2021-08-10",
"sponsor": sponsor_bar.id, "sponsor": sponsor_bar.id,
"comments": "Test Comment",
"orgunit": unit_foo.id, "orgunit": unit_foo.id,
} }
...@@ -156,6 +157,18 @@ def test_add_role( ...@@ -156,6 +157,18 @@ def test_add_role(
assert len(roles_for_person) == 1 assert len(roles_for_person) == 1
assert roles_for_person[0]["id"] == response_data["id"] assert roles_for_person[0]["id"] == response_data["id"]
@pytest.mark.django_db
def test_get_role(client, person_foo, role_data_guest):
# Check role list
url = reverse("v1:person_role-list", kwargs={"person_id": person_foo.id})
client.post(url, role_data_guest)
response = client.get(url).json()["results"]
assert response[0]["type"] == role_data_guest["type"]
# Check for single role
url_detail = reverse("v1:person_role-detail", kwargs={"person_id": person_foo.id, "id": 1})
response_detail = client.get(url_detail).json()
assert response_detail["type"] == role_data_guest["type"]
@pytest.mark.django_db @pytest.mark.django_db
def test_update_role(client, person_foo, role_data_guest): def test_update_role(client, person_foo, role_data_guest):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment