Skip to content

Commit

Permalink
Responses test refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
azgabur committed Jul 21, 2023
1 parent c7b495b commit 5a39f66
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import json

import pytest
from testsuite.objects import ResponseProperties, JsonProperty


@pytest.fixture(scope="module")
Expand All @@ -27,7 +28,7 @@ def path_and_value(request):
def responses(path_and_value):
"""Returns response to be added to the AuthConfig"""
path, _ = path_and_value
return [{"name": "header", "json": {"properties": [{"name": "anything", "valueFrom": {"authJSON": path}}]}}]
return [ResponseProperties(name="header", properties=[JsonProperty(name="anything", jsonPath=path)])]


def test_auth_json_path(auth, client, path_and_value):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
import json

import pytest
from testsuite.objects import ResponseProperties, JsonProperty


@pytest.fixture(scope="module")
def responses():
"""Returns response to be added to the AuthConfig"""
return [
{"name": "Header", "json": {"properties": [{"name": "anything", "value": "one"}]}},
{"name": "X-Test", "json": {"properties": [{"name": "anything", "value": "two"}]}},
ResponseProperties(name="Header", properties=[JsonProperty(name="anything", value="one")]),
ResponseProperties(name="X-Test", properties=[JsonProperty(name="anything", value="two")]),
]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
import json

import pytest
from testsuite.objects import ResponseProperties, JsonProperty


@pytest.fixture(scope="module")
def responses():
"""Returns response to be added to the AuthConfig"""
return [{"name": "header", "json": {"properties": [{"name": "anything", "value": "one"}]}}]
return [ResponseProperties(name="header", properties=[JsonProperty(name="anything", value="one")])]


def test_simple_response_with(auth, client):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json

import pytest
from testsuite.objects import ResponseProperties, JsonProperty


@pytest.fixture(scope="module", params=["123456789", "standardCharacters", "specialcharacters+*-."])
Expand All @@ -14,7 +15,11 @@ def header_name(request):
def responses(header_name):
"""Returns response to be added to the AuthConfig"""
return [
{"name": "header", "wrapperKey": header_name, "json": {"properties": [{"name": "anything", "value": "one"}]}}
ResponseProperties(
name="header",
wrapperKey=header_name,
properties=[JsonProperty(name="anything", value="one")],
)
]


Expand Down

0 comments on commit 5a39f66

Please sign in to comment.