Ejemplo n.º 1
0
    def test_aws_access_key_id__none(self):
        expected_exception_message = "AWS Access Key ID cannot be `None`."

        aws_access_key_id = None
        aws_secret_access_key = "K*(Ihuu9(*UJnp*&^%$))"
        aws_region = AWSRegion.US_EAST_1

        with self.assertRaises(ValueError) as context_manager:
            AWSSecret(aws_access_key_id, aws_secret_access_key,
                      aws_region)  # System Under Test

        exception = context_manager.exception
        self.assertEqual(expected_exception_message, str(exception))
Ejemplo n.º 2
0
    def test_aws_access_key_id__wrong_type(self):
        expected_exception_message = "AWS Access Key ID has to be an instance of <class 'str'> or a subclass of it and not <class 'int'>."

        aws_access_key_id = 45
        aws_secret_access_key = "K*(Ihuu9(*UJnp*&^%$))"
        aws_region = AWSRegion.US_EAST_1

        with self.assertRaises(TypeError) as context_manager:
            AWSSecret(aws_access_key_id, aws_secret_access_key,
                      aws_region)  # System Under Test

        exception = context_manager.exception
        self.assertEqual(expected_exception_message, str(exception))
Ejemplo n.º 3
0
    def test_repr(self):
        aws_access_key_id_1 = "OIUHJBKNKLKSID"
        aws_secret_access_key_1 = "K*(Ihuu9(*UJnp*&^%$))"
        aws_region_1 = AWSRegion.US_EAST_1

        aws_secret_1 = AWSSecret(aws_access_key_id_1, aws_secret_access_key_1,
                                 aws_region_1)

        string_representation = repr(aws_secret_1)  # System Under Test
        aws_secret_2 = eval(string_representation)

        self.assertEqual(aws_secret_1, aws_secret_2)
        self.assertEqual(aws_secret_1.access_key_id,
                         aws_secret_2.access_key_id)
        self.assertEqual(aws_secret_1.secret_access_key,
                         aws_secret_2.secret_access_key)
        self.assertEqual(aws_secret_1.region, aws_secret_2.region)