Skip to content

Commit

Permalink
some parts of monkeypatching not needed anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyber1000 committed May 8, 2021
1 parent 954a61d commit b1741f0
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions testing/test_plain_coap.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,77 +61,71 @@ def plain_coap_server(self, status_resource, control_resource):
yield server
server.stop()

def test_set_values(self, air_client, monkeypatch):
def test_set_values(self, air_client):
values = {}
values["mode"] = "A"
result = air_client.set_values(values)
assert result

def test_get_status_is_valid(self, air_client, test_data, monkeypatch):
def test_get_status_is_valid(self, air_client, test_data):
self.assert_json_data(
air_client.get_status,
"status",
test_data,
monkeypatch,
air_client,
)

def test_get_firmware_is_valid(self, air_client, test_data, monkeypatch):
def test_get_firmware_is_valid(self, air_client, test_data):
self.assert_json_data(
air_client.get_firmware,
"status",
test_data,
monkeypatch,
air_client,
)

def test_get_filters_is_valid(self, air_client, test_data, monkeypatch):
def test_get_filters_is_valid(self, air_client, test_data):
self.assert_json_data(
air_client.get_filters,
"status",
test_data,
monkeypatch,
air_client,
)

def test_get_cli_status_is_valid(self, air_cli, test_data, monkeypatch, capfd):
def test_get_cli_status_is_valid(self, air_cli, test_data, capfd):
self.assert_cli_data(
air_cli.get_status,
"status-cli",
test_data,
monkeypatch,
air_cli,
capfd,
)

def test_get_cli_firmware_is_valid(self, air_cli, test_data, monkeypatch, capfd):
def test_get_cli_firmware_is_valid(self, air_cli, test_data, capfd):
self.assert_cli_data(
air_cli.get_firmware,
"firmware-cli",
test_data,
monkeypatch,
air_cli,
capfd,
)

def test_get_cli_filters_is_valid(self, air_cli, test_data, monkeypatch, capfd):
def test_get_cli_filters_is_valid(self, air_cli, test_data, capfd):
self.assert_cli_data(
air_cli.get_filters,
"fltsts-cli",
test_data,
monkeypatch,
air_cli,
capfd,
)

def assert_json_data(self, air_func, dataset, test_data, monkeypatch, air_client):
def assert_json_data(self, air_func, dataset, test_data, air_client):
result = air_func()
data = test_data["plain-coap"][dataset]["data"]
json_data = json.loads(data)
assert result == json_data

def assert_cli_data(
self, air_func, dataset, test_data, monkeypatch, air_cli, capfd
self, air_func, dataset, test_data, air_cli, capfd
):
air_func()
result, err = capfd.readouterr()
Expand Down

0 comments on commit b1741f0

Please sign in to comment.