Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a failing test #1670

Merged
merged 2 commits into from
Jan 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions epictrack-api/tests/unit/apis/test_work_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_create_and_fetch_work_issues(client):
assert retrieved_issue_json["title"] == work_issue.title


def test_create_and_update_work_issues(client):
def test_create_and_update_work_issues(client, jwt):
"""Test create and update WorkIssues with updates."""
work = factory_work_model()
issue_data = TestWorkIssuesInfo.issue1.value
Expand All @@ -90,11 +90,14 @@ def test_create_and_update_work_issues(client):
result_get = client.get(url)
assert work_issue_update.description == result_get.json[0].get('updates')[0]['description']

updates_id = result_get.json[0].get('updates')[0]['id']
new_description = fake.sentence()
updated_update_data = {"id": work_issue_update.id, "description": new_description}
url_update = urljoin(API_BASE_URL, f'work/{work.id}/issues/{work_issue.id}')
result_update = client.put(url_update, json={"updates": [updated_update_data]})
assert result_update.status_code == HTTPStatus.CREATED
staff_user = TestJwtClaims.staff_admin_role
headers = factory_auth_header(jwt=jwt, claims=staff_user)
url_update = urljoin(API_BASE_URL, f'work/{work.id}/issues/{work_issue.id}/update/{updates_id}')
result_update = client.patch(url_update, headers=headers, json=updated_update_data)
assert result_update.status_code == HTTPStatus.OK

url = urljoin(API_BASE_URL, f'work/{work.id}/issues')
result_get = client.get(url)
Expand Down
Loading