示例#1
0
 def test_create_Context_with_targets_ranks(self):
     """Check that the target <=> rank mapping is consistent."""
     check_targets(required=4, available=len(self.client))
     targets = [3, 2]
     dac = Context(self.client, targets=targets)
     self.assertEqual(set(dac.targets), set(targets))
     dac.close()
示例#2
0
 def test_create_Context_with_targets_ranks(self):
     """Check that the target <=> rank mapping is consistent."""
     check_targets(required=4, available=len(self.client))
     targets = [3, 2]
     dac = Context(self.client, targets=targets)
     self.assertEqual(set(dac.targets), set(targets))
     dac.close()
示例#3
0
 def test_create_delete_key(self):
     """ Check that a key can be created and then destroyed. """
     dac = Context()
     # Create and push a key/value.
     key, value = dac._generate_key(), 'test'
     dac._push({key: value}, targets=dac.targets)
     # Delete the key.
     dac.delete_key(key)
     dac.close()
示例#4
0
 def test_create_delete_key(self):
     """ Check that a key can be created and then destroyed. """
     dac = Context()
     # Create and push a key/value.
     key, value = dac._generate_key(), 'test'
     dac._push({key: value}, targets=dac.targets)
     # Delete the key.
     dac.delete_key(key)
     dac.close()
示例#5
0
 def test_context_target_reordering(self):
     """Are contexts' targets reordered in a consistent way?"""
     orig_targets = self.client.ids
     targets1 = orig_targets[:]
     targets2 = orig_targets[:]
     shuffle(targets1)
     shuffle(targets2)
     ctx1 = Context(self.client, targets=targets1)
     ctx2 = Context(self.client, targets=targets2)
     self.assertEqual(ctx1.targets, ctx2.targets)
     ctx1.close()
     ctx2.close()
示例#6
0
 def test_context_target_reordering(self):
     """Are contexts' targets reordered in a consistent way?"""
     orig_targets = self.client.ids
     targets1 = orig_targets[:]
     targets2 = orig_targets[:]
     shuffle(targets1)
     shuffle(targets2)
     ctx1 = Context(self.client, targets=targets1)
     ctx2 = Context(self.client, targets=targets2)
     self.assertEqual(ctx1.targets, ctx2.targets)
     ctx1.close()
     ctx2.close()
示例#7
0
 def test_create_Context_with_targets(self):
     """Can we create a context with a subset of engines?"""
     check_targets(required=2, available=len(self.client))
     dac = Context(self.client, targets=[0, 1])
     self.assertIs(dac.client, self.client)
     dac.close()
示例#8
0
 def test_create_Context_with_targets(self):
     """Can we create a context with a subset of engines?"""
     check_targets(required=2, available=len(self.client))
     dac = Context(self.client, targets=[0, 1])
     self.assertIs(dac.client, self.client)
     dac.close()