Skip to content

Commit

Permalink
tests/test_workflow: fix testing integrity error
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatsh committed Sep 15, 2023
1 parent b0b25fd commit 4a36a1e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def test_put_too_many_nuspecs_post(client: Client, nuget_user: NugetUser) -> Non
assert response.status_code == 400


@pytest.mark.django_db
@pytest.mark.django_db(transaction=True)
def test_put(client: Client, nuget_user: NugetUser) -> None:
with NamedTemporaryFile('rb', prefix='minchoc_test', suffix='.nuget') as tf:
temp_name = tf.name
Expand Down Expand Up @@ -199,15 +199,15 @@ def test_put(client: Client, nuget_user: NugetUser) -> None:
'x-nuget-apikey': nuget_user.token.hex
}) # type: ignore[arg-type]
assert response.status_code == 201
# response = client.post('/api/v2/package/',
# content,
# 'multipart/form-data; boundary=1234abc',
# headers={
# 'content-length': f'{len(content)}',
# 'x-nuget-apikey': nuget_user.token.hex
# }) # type: ignore[arg-type])
# assert response.json()['error'] == 'Integrity error (has this already been uploaded?)'
# assert response.status_code == 400
response = client.post('/api/v2/package/',
content,
'multipart/form-data; boundary=1234abc',
headers={
'content-length': f'{len(content)}',
'x-nuget-apikey': nuget_user.token.hex
}) # type: ignore[arg-type])
assert response.json()['error'] == 'Integrity error (has this already been uploaded?)'
assert response.status_code == 400
# find_packages_by_id
response = client.get('/FindPackagesById()?semVerLevel=2.0.0&id=somename')
assert re.search(GALLERY_RE, response.content) is not None
Expand Down

0 comments on commit 4a36a1e

Please sign in to comment.