def test_get_servers_with_consul_cache(self): """If consul fail without being cached, empty list should be returned.""" params = PARAMS params["CONSUL_CACHE"] = "consul-memcached" params["CONSUL_TTL"] = 30 params["CONSUL_ALT_TTL"] = 60 self.assertEqual(memcached.get_servers(PARAMS), [])
def test_get_servers_without_consul_cache(self): """Test that it's possible to return servers list without using cache.""" @all_requests def response_content(url, request): content = get_file("consul_api_health_mock.json") return response(200, content, CONSUL_HEADERS, None, 5, request) with HTTMock(response_content): self.assertEqual( memcached.get_servers(PARAMS), ['memcached-mock-node1:80', 'memcached-mock-node2:80'])
def test_get_servers_fail_without_consul_cache(self): """If consul fail without being cached, empty list should be returned.""" self.assertEqual(memcached.get_servers(PARAMS), [])