def test_regex_with_over_255_characters_in_keypair_name(self): over_255_chars = ('abcdefghijklmnopqrstuvwzxyzabcdefghi\ jklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvw\ xyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl\ mnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzab\ cdefghijklmnopqrstuvwxyzcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstu\ vwxyzabcde') response = check_keypair_regex(over_255_chars) self.assertFalse(response, 'This should not have passed the regex rules as it exceeds 255 characters')
def test_regex_with_invalid_character_in_keypair_name(self): response = check_keypair_regex('abc&123') self.assertFalse(response, 'abc%123 should not have passed as it has an invalid character &')
def test_regex_with_pem_extension(self): response = check_keypair_regex('ab12_AU12-Pb.pem') self.assertTrue(response, 'This should have passed as it contains all valid characters')
def test_regex_with_zero_characters_keypair_name(self): zero_characters =('') response = check_keypair_regex(zero_characters) self.assertFalse(response, 'This should not have passed as it contains zero characters keypairs must have at least 1 character')