Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBurchLog committed Sep 6, 2024
1 parent 2ae729f commit 166f962
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions test/rest/system_client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,26 +304,28 @@ def test_missing_field(self, monkeypatch, client, remove_kwarg):
with pytest.raises(ValidationError):
client._construct_bg_request(**kwargs)

def test_requester_field(self, monkeypatch, client, remove_kwarg):
def test_requester_field(self, monkeypatch, client):
monkeypatch.setattr(client, "_resolve_parameters", Mock())

kwargs = {
"_command": "",
"_system_name": "",
"_system_version": "",
"_instance_name": "",
"_requester":"test"
"_requester": "test",
}

request = client._construct_bg_request(**kwargs)
assert request.requester == "test"

def test_requester_from_parent_field(self, monkeypatch, client, remove_kwarg):
def test_requester_from_parent_field(self, monkeypatch, client):
monkeypatch.setattr(client, "_resolve_parameters", Mock())
monkeypatch.setattr(
brewtils.plugin, "request_context", Mock(current_request=Mock(id="1", requester="test"))
brewtils.plugin,
"request_context",
Mock(current_request=Mock(id="1", requester="test")),
)

kwargs = {
"_command": "",
"_system_name": "",
Expand All @@ -334,20 +336,19 @@ def test_requester_from_parent_field(self, monkeypatch, client, remove_kwarg):
request = client._construct_bg_request(**kwargs)
assert request.requester == "test"

def test_no_requester_from_provided_parent(self, monkeypatch, client, remove_kwarg):
def test_no_requester_from_provided_parent(self, monkeypatch, client):
monkeypatch.setattr(client, "_resolve_parameters", Mock())

kwargs = {
"_command": "",
"_system_name": "",
"_system_version": "",
"_instance_name": "",
"_parent":Mock(id="1"),
"_parent": Mock(id="1"),
}

request = client._construct_bg_request(**kwargs)
assert request.requester is None


def test_positional_parameter(self, client, easy_client, mock_success):
easy_client.create_request.return_value = mock_success
Expand Down

0 comments on commit 166f962

Please sign in to comment.