Beispiel #1
0
 def test_add_ip_name(self):
     ip_to_add = '123.45.67.89'
     add_ip(self.target_security_group.group_name, ip_to_add)
     self.target_security_group.reload()
     self.admin_security_group.reload()
     self.assertTrue(self.group_contains_ip(self.target_security_group, ip_to_add))
     self.assertFalse(self.group_contains_ip(self.admin_security_group, ip_to_add))
Beispiel #2
0
 def test_add_ip_description(self):
     ip_to_add = '123.45.67.89'
     description = 'Test description for {}'.format(ip_to_add)
     add_ip(self.target_security_group, ip_to_add, description=description)
     self.target_security_group.reload()
     self.admin_security_group.reload()
     print(list(self.target_security_group.ip_permissions))
     self.assertTrue(self.group_contains_ip(self.target_security_group, ip_to_add))
     self.assertFalse(self.group_contains_ip(self.admin_security_group, ip_to_add))
Beispiel #3
0
 def test_add_ip_dont_add_twicee(self):
     ip_to_add = '123.45.67.89'
     add_ip(self.target_security_group.group_name, ip_to_add)
     self.target_security_group.reload()
     self.admin_security_group.reload()
     self.assertTrue(self.group_contains_ip(self.target_security_group, ip_to_add))
     self.assertFalse(self.group_contains_ip(self.admin_security_group, ip_to_add))
     # now add the same IP a second time
     add_ip(self.target_security_group.group_name, ip_to_add)
     self.assertTrue(self.group_contains_ip(self.target_security_group, ip_to_add))
     self.assertFalse(self.group_contains_ip(self.admin_security_group, ip_to_add))
Beispiel #4
0
 def test_add_ip_bad_ip(self):
     ip_to_add = '123.45.67.899'
     with self.assertRaises(ClientError):
         add_ip(self.target_security_group, ip_to_add)