def test_that_when_checking_if_a_trail_exists_and_a_trail_does_not_exist_the_trail_exists_method_returns_false(self): ''' Tests checking cloudtrail trail existence when the cloudtrail trail does not exist ''' self.conn.get_trail_status.side_effect = not_found_error result = boto_cloudtrail.exists(Name='mytrail', **conn_parameters) self.assertFalse(result['exists'])
def test_that_when_checking_if_a_trail_exists_and_boto3_returns_an_error_the_trail_exists_method_returns_error(self): ''' Tests checking cloudtrail trail existence when boto returns an error ''' self.conn.get_trail_status.side_effect = ClientError(error_content, 'get_trail_status') result = boto_cloudtrail.exists(Name='mytrail', **conn_parameters) self.assertEqual(result.get('error', {}).get('message'), error_message.format('get_trail_status'))
def test_that_when_checking_if_a_trail_exists_and_a_trail_exists_the_trail_exists_method_returns_true(self): ''' Tests checking cloudtrail trail existence when the cloudtrail trail already exists ''' self.conn.get_trail_status.return_value = trail_ret result = boto_cloudtrail.exists(Name=trail_ret['Name'], **conn_parameters) self.assertTrue(result['exists'])
def test_that_when_checking_if_a_trail_exists_and_a_trail_does_not_exist_the_trail_exists_method_returns_false( self, ): """ Tests checking cloudtrail trail existence when the cloudtrail trail does not exist """ self.conn.get_trail_status.side_effect = not_found_error result = boto_cloudtrail.exists(Name="mytrail", **conn_parameters) assert not result["exists"]
def test_that_when_checking_if_a_trail_exists_and_a_trail_exists_the_trail_exists_method_returns_true( self, ): """ Tests checking cloudtrail trail existence when the cloudtrail trail already exists """ self.conn.get_trail_status.return_value = trail_ret result = boto_cloudtrail.exists(Name=trail_ret["Name"], **conn_parameters) assert result["exists"]
def test_that_when_checking_if_a_trail_exists_and_boto3_returns_an_error_the_trail_exists_method_returns_error( self, ): """ Tests checking cloudtrail trail existence when boto returns an error """ self.conn.get_trail_status.side_effect = ClientError( error_content, "get_trail_status") result = boto_cloudtrail.exists(Name="mytrail", **conn_parameters) assert result.get( "error", {}).get("message") == error_message.format("get_trail_status")