Exemplo n.º 1
0
    def test_that_when_checking_if_a_rule_exists_and_a_rule_does_not_exist_the_topic_rule_exists_method_returns_false(self):
        '''
        Tests checking iot rule existence when the iot rule does not exist
        '''
        self.conn.get_topic_rule.side_effect = topic_rule_not_found_error
        result = boto_iot.topic_rule_exists(ruleName='mypolicy', **conn_parameters)

        self.assertFalse(result['exists'])
Exemplo n.º 2
0
    def test_that_when_checking_if_a_rule_exists_and_a_rule_does_not_exist_the_topic_rule_exists_method_returns_false(self):
        '''
        Tests checking iot rule existence when the iot rule does not exist
        '''
        self.conn.get_topic_rule.side_effect = topic_rule_not_found_error
        result = boto_iot.topic_rule_exists(ruleName='mypolicy', **conn_parameters)

        self.assertFalse(result['exists'])
Exemplo n.º 3
0
    def test_that_when_checking_if_a_topic_rule_exists_and_boto3_returns_an_error_the_topic_rule_exists_method_returns_error(self):
        '''
        Tests checking iot topic_rule existence when boto returns an error
        '''
        self.conn.get_topic_rule.side_effect = ClientError(error_content, 'get_topic_rule')
        result = boto_iot.topic_rule_exists(ruleName='myrule', **conn_parameters)

        self.assertEqual(result.get('error', {}).get('message'),
                                      error_message.format('get_topic_rule'))
Exemplo n.º 4
0
    def test_that_when_checking_if_a_topic_rule_exists_and_a_topic_rule_exists_the_topic_rule_exists_method_returns_true(self):
        '''
        Tests checking iot topic_rule existence when the iot topic_rule already exists
        '''
        self.conn.get_topic_rule.return_value = {'rule': topic_rule_ret}
        result = boto_iot.topic_rule_exists(ruleName=topic_rule_ret['ruleName'],
                                            **conn_parameters)

        self.assertTrue(result['exists'])
Exemplo n.º 5
0
    def test_that_when_checking_if_a_topic_rule_exists_and_boto3_returns_an_error_the_topic_rule_exists_method_returns_error(self):
        '''
        Tests checking iot topic_rule existence when boto returns an error
        '''
        self.conn.get_topic_rule.side_effect = ClientError(error_content, 'get_topic_rule')
        result = boto_iot.topic_rule_exists(ruleName='myrule', **conn_parameters)

        self.assertEqual(result.get('error', {}).get('message'),
                                      error_message.format('get_topic_rule'))
Exemplo n.º 6
0
    def test_that_when_checking_if_a_topic_rule_exists_and_a_topic_rule_exists_the_topic_rule_exists_method_returns_true(self):
        '''
        Tests checking iot topic_rule existence when the iot topic_rule already exists
        '''
        self.conn.get_topic_rule.return_value = {'rule': topic_rule_ret}
        result = boto_iot.topic_rule_exists(ruleName=topic_rule_ret['ruleName'],
                                            **conn_parameters)

        self.assertTrue(result['exists'])
Exemplo n.º 7
0
    def test_that_when_checking_if_a_topic_rule_exists_and_boto3_returns_an_error_the_topic_rule_exists_method_returns_error(
        self,
    ):
        """
        Tests checking iot topic_rule existence when boto returns an error
        """
        self.conn.get_topic_rule.side_effect = ClientError(error_content, "get_topic_rule")
        result = boto_iot.topic_rule_exists(ruleName="myrule", **conn_parameters)

        assert result.get("error", {}).get("message") == error_message.format("get_topic_rule")
Exemplo n.º 8
0
    def test_that_when_checking_if_a_rule_exists_and_a_rule_does_not_exist_the_topic_rule_exists_method_returns_false(
        self,
    ):
        """
        Tests checking iot rule existence when the iot rule does not exist
        """
        self.conn.get_topic_rule.side_effect = topic_rule_not_found_error
        result = boto_iot.topic_rule_exists(ruleName="mypolicy", **conn_parameters)

        assert not result["exists"]
Exemplo n.º 9
0
    def test_that_when_checking_if_a_topic_rule_exists_and_a_topic_rule_exists_the_topic_rule_exists_method_returns_true(
        self,
    ):
        """
        Tests checking iot topic_rule existence when the iot topic_rule already exists
        """
        self.conn.get_topic_rule.return_value = {"rule": topic_rule_ret}
        result = boto_iot.topic_rule_exists(ruleName=topic_rule_ret["ruleName"], **conn_parameters)

        assert result["exists"]
Exemplo n.º 10
0
def test_that_when_checking_if_a_topic_rule_exists_and_boto3_returns_an_error_the_topic_rule_exists_method_returns_error(
        boto_conn):
    '''
    Tests checking iot topic_rule existence when boto returns an error
    '''
    boto_conn.get_topic_rule.side_effect = exceptions.ClientError(
        error_content, 'get_topic_rule')
    result = boto_iot.topic_rule_exists(ruleName='myrule',
                                        **pytest.conn_parameters)

    assert result.get('error', {}).get('message') == \
                                  error_message.format('get_topic_rule')