Skip to content

Commit

Permalink
Remove xfail from petstore tests for form_data
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Dygalo authored and Stranger6667 committed Sep 28, 2019
1 parent 7cc0de3 commit 87a51ef
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/test_petstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def assert_petstore(passed=1, tests_num=5):
result.stdout.re_match_lines([rf"Hypothesis calls: {tests_num}"])

testdir.assert_petstore = assert_petstore
testdir.param = request.param # `request.param` is not available in test for some reason

return testdir

Expand Down Expand Up @@ -74,15 +75,18 @@ def test_(request, case):
testdir.assert_petstore()


@pytest.mark.xfail(reason="formData generation is not implemented", run=False)
def test_update_pet(testdir):
testdir.make_petstore_test(
"""
@schema.parametrize(method="POST", endpoint="/pet/{petId}$")
@settings(max_examples=5)
def test_(request, case):
request.config.HYPOTHESIS_CASES += 1
assert_int(case.form_data["petId"]) # TODO. Or save it in body?
assert_int(case.path_parameters["petId"])
if "name" in case.form_data:
assert_str(case.form_data["name"])
if "status" in case.form_data:
assert_str(case.form_data["status"])
"""
)
testdir.assert_petstore()
Expand All @@ -102,15 +106,18 @@ def test_(request, case):
testdir.assert_petstore()


@pytest.mark.xfail(reason="formData generation is not implemented", run=False)
def test_upload_image(testdir):
if testdir.param == "petstore_v2.yaml":
pytest.xfail("Type `file` is not supported for Swagger 2.0. See #78.")
testdir.make_petstore_test(
"""
@schema.parametrize(endpoint="/pet/{petId}/uploadImage$")
@settings(max_examples=5)
def test_(request, case):
request.config.HYPOTHESIS_CASES += 1
assert_int(case.path_parameters["petId"])
if "additionalMetadata" in case.form_data:
assert_str(case.form_data["additionalMetadata"])
"""
)
testdir.assert_petstore()
Expand Down

0 comments on commit 87a51ef

Please sign in to comment.