コード例 #1
0
ファイル: test_storage.py プロジェクト: scorphus/redisapi
 def test_find_instance_by_name(self):
     from redisapi.storage import MongoStorage
     storage = MongoStorage()
     instance = Instance(
         "xname", "plan", [{"host": "host", "container_id": "id",
                            "port": "port"}])
     storage.add_instance(instance)
     result = storage.find_instance_by_name(instance.name)
     self.assertEqual(instance.endpoints[0]["container_id"],
                      result.endpoints[0]["container_id"])
     storage.remove_instance(instance)
コード例 #2
0
 def test_find_instance_by_name(self):
     from redisapi.storage import MongoStorage
     storage = MongoStorage()
     instance = Instance("xname", "plan", [{
         "host": "host",
         "container_id": "id",
         "port": "port"
     }])
     storage.add_instance(instance)
     result = storage.find_instance_by_name(instance.name)
     self.assertEqual(instance.endpoints[0]["container_id"],
                      result.endpoints[0]["container_id"])
     storage.remove_instance(instance)
コード例 #3
0
ファイル: test_storage.py プロジェクト: scorphus/redisapi
 def test_remove_instance(self):
     from redisapi.storage import MongoStorage
     storage = MongoStorage()
     instance = Instance(
         "xname", "plan",
         [{"host": "host", "container_id": "id", "port": "port"}])
     storage.add_instance(instance)
     result = storage.find_instance_by_name(instance.name)
     endpoint = instance.endpoints[0]
     self.assertEqual(endpoint["container_id"],
                      result.endpoints[0]["container_id"])
     storage.remove_instance(instance)
     length = storage.conn()['redisapi']['instances'].find(
         {"name": instance.name}).count()
     self.assertEqual(length, 0)
コード例 #4
0
 def test_remove_instance(self):
     from redisapi.storage import MongoStorage
     storage = MongoStorage()
     instance = Instance("xname", "plan", [{
         "host": "host",
         "container_id": "id",
         "port": "port"
     }])
     storage.add_instance(instance)
     result = storage.find_instance_by_name(instance.name)
     endpoint = instance.endpoints[0]
     self.assertEqual(endpoint["container_id"],
                      result.endpoints[0]["container_id"])
     storage.remove_instance(instance)
     length = storage.db()['instances'].find({
         "name": instance.name
     }).count()
     self.assertEqual(length, 0)