def test_remove_garden_cleans_up_remote_user_entries(self, bg_garden): """remove_garden should remove any RemoteUser entries for that garden""" garden = create_garden(bg_garden) remote_user = RemoteUser(username="******", garden=garden.name).save() remove_garden(garden.name) remote_user_count = len( RemoteUser.objects.filter(username=remote_user.username, garden=garden.name)) assert remote_user_count == 0
def test_create_garden_loads_default_config(self, bg_garden): """create_garden should explicitly load default HTTP configs from brewtils""" http_params = { "host": "localhost", "port": 1337, "url_prefix": "/", "ssl": True, "ca_cert": "/abc", "ca_verify": True, "client_cert": "/def", } bg_garden.connection_params = {"http": http_params} garden = create_garden(bg_garden) for key in http_params: assert garden.connection_params["http"][key] == http_params[key]
def test_create_garden_with_empty_connection_params(self, bg_garden): """create_garden should explicitly load default HTTP configs from brewtils when empty""" config_map = { "bg_host": "host", "bg_port": "port", "ssl_enabled": "ssl", "bg_url_prefix": "url_prefix", "ca_cert": "ca_cert", "ca_verify": "ca_verify", "client_cert": "client_cert", } spec = YapconfSpec(_CONNECTION_SPEC) # bg_host is required by brewtils garden spec defaults = spec.load_config({"bg_host": ""}) garden = create_garden(bg_garden) for key in config_map: assert garden.connection_params["http"][ config_map[key]] == defaults[key]
def remotegarden(remotegarden_system): yield create_garden( BrewtilsGarden(name="remotegarden", connection_type="HTTP", systems=[remotegarden_system]))
def localgarden(localgarden_system): yield create_garden( BrewtilsGarden(name="localgarden", connection_type="LOCAL", systems=[localgarden_system]))