コード例 #1
0
ファイル: test_gathering.py プロジェクト: glyph/otter
 def test_mark_deleted_servers_no_old(self):
     """
     If old list does not have any servers then it just returns new list
     """
     new = [{'id': 'd', 'd': 3}, {'id': 'b', 'b': 4}]
     self.assertEqual(
         self.freeze(mark_deleted_servers([], new)), self.freeze(new))
コード例 #2
0
ファイル: test_gathering.py プロジェクト: manishtomar/otter
 def test_mark_deleted_servers_no_old(self):
     """
     If old list does not have any servers then it just returns new list
     """
     new = [{'id': 'd', 'd': 3}, {'id': 'b', 'b': 4}]
     self.assertEqual(
         self.freeze(mark_deleted_servers([], new)), self.freeze(new))
コード例 #3
0
ファイル: test_gathering.py プロジェクト: pratikmallya/otter
 def test_updated_deleted_servers_no_new(self):
     """
     If new list does not have any servers then old list is updated as
     DELETED and returned
     """
     old = [{"id": "d", "d": 3}, {"id": "b", "b": 4}]
     exp_old = deepcopy(old)
     exp_old[0]["status"] = "DELETED"
     exp_old[1]["status"] = "DELETED"
     self.assertEqual(self.freeze(mark_deleted_servers(old, [])), self.freeze(exp_old))
コード例 #4
0
ファイル: test_gathering.py プロジェクト: pratikmallya/otter
 def test_mark_deleted_servers_precedence(self):
     """
     In :func:`mark_deleted_servers`, if old list has common servers with
     new list, the new one takes precedence
     """
     old = [{"id": "a", "a": 1}, {"id": "b", "b": 2}]
     new = [{"id": "d", "d": 3}, {"id": "b", "b": 4}]
     old_server = deepcopy(old[0])
     old_server["status"] = "DELETED"
     self.assertEqual(self.freeze(mark_deleted_servers(old, new)), self.freeze([old_server] + new))
コード例 #5
0
 def test_updated_deleted_servers_no_new(self):
     """
     If new list does not have any servers then old list is updated as
     DELETED and returned
     """
     old = [{'id': 'd', 'd': 3}, {'id': 'b', 'b': 4}]
     exp_old = deepcopy(old)
     exp_old[0]["status"] = "DELETED"
     exp_old[1]["status"] = "DELETED"
     self.assertEqual(self.freeze(mark_deleted_servers(old, [])),
                      self.freeze(exp_old))
コード例 #6
0
 def test_mark_deleted_servers_precedence(self):
     """
     In :func:`mark_deleted_servers`, if old list has common servers with
     new list, the new one takes precedence
     """
     old = [{'id': 'a', 'a': 1}, {'id': 'b', 'b': 2}]
     new = [{'id': 'd', 'd': 3}, {'id': 'b', 'b': 4}]
     old_server = deepcopy(old[0])
     old_server["status"] = "DELETED"
     self.assertEqual(self.freeze(mark_deleted_servers(old, new)),
                      self.freeze([old_server] + new))
コード例 #7
0
ファイル: test_gathering.py プロジェクト: glyph/otter
 def test_mark_deleted_servers_precedence(self):
     """
     In :func:`mark_deleted_servers`, if old list has common servers with
     new list, the new one takes precedence
     """
     old = [{'id': 'a', 'a': 1}, {'id': 'b', 'b': 2}]
     new = [{'id': 'd', 'd': 3}, {'id': 'b', 'b': 4}]
     old_server = deepcopy(old[0])
     old_server["status"] = "DELETED"
     self.assertEqual(
         self.freeze(mark_deleted_servers(old, new)),
         self.freeze([old_server] + new))
コード例 #8
0
ファイル: test_gathering.py プロジェクト: pratikmallya/otter
 def test_mark_deleted_servers_no_old(self):
     """
     If old list does not have any servers then it just returns new list
     """
     new = [{"id": "d", "d": 3}, {"id": "b", "b": 4}]
     self.assertEqual(self.freeze(mark_deleted_servers([], new)), self.freeze(new))