def check_remote_memcache_context_with_memcache(self, os_release, ip, formated_ip): memcached_servers = [{'private-address': formated_ip, 'port': '11211'}] self.relation_ids.return_value = ['cache:0'] self.relations_for_id.return_value = memcached_servers self.related_units.return_value = 'memcached/0' remote_memcache = context.RemoteMemcacheContext() os_release.return_value = 'icehouse' self.maxDiff = None self.assertEqual({'memcached_servers': "%s:11211" % (formated_ip, )}, remote_memcache())
def test_remote_memcache_context_without_memcache(self, os_release, log_): self.relation_ids.return_value = 'cache:0' self.related_units.return_value = 'memcached/0' remote_memcache = context.RemoteMemcacheContext() os_release.return_value = 'icehouse' self.assertEqual({}, remote_memcache())