def test_name_to_sgid(self): _groupname_cache.pop(self.sg_name, None) # make sure test group isn't in the cache sg_name = name_to_sgid(self.aws, self.sg_name) self.aws.SecurityGroups.get.called_with( filters={'group-name': self.sg_name}) self.assertEqual(self.group["GroupName"], sg_name)
def test_lookup_caches_name(self): _groupname_cache.pop(self.sg_name, None) # make sure test group isn't in the cache name_to_sgid(self.aws, self.sg_name) self.assertIn(self.sg_name, _groupname_cache)
def test_multiple_matches(self): self.aws.ec2.SecurityGroups.get.return_value = [self.group, self.group] _groupname_cache.pop(self.sg_name, None) # make sure test group isn't in the cache with self.assertRaises(MultipleNameMatches): name_to_sgid(self.aws, self.sg_name)
def test_name_to_sgid(self): _groupname_cache.pop(self.sg_name, None) # make sure test group isn't in the cache sg_name = name_to_sgid(self.aws, self.sg_name) self.aws.SecurityGroups.get.called_with(filters={'group-name': self.sg_name}) self.assertEqual(self.group["GroupName"], sg_name)