def test_target_from_type(self, monkeypatch, op): monkeypatch.setattr(beer_garden.router, "_target_from_type", Mock(return_value="parent")) assert _determine_target(op) == "parent"
def test_mismatch(self, monkeypatch, op): monkeypatch.setattr(beer_garden.router, "_target_from_type", Mock(return_value="child")) op.target_garden_name = "parent" assert _determine_target(op) == "child"
def test_neither(self, monkeypatch, op): monkeypatch.setattr(beer_garden.router, "_target_from_type", Mock(return_value=None)) with pytest.raises(UnknownGardenException): _determine_target(op)