예제 #1
0
    def test_its_value_condition_equals(self):
        step = MockedStep()
        expected_value = r"https://www.stackoverflow.com[as](.*)\s\t+$"
        step.context.stash = [{
            'address': 'some_resource.id',
            'type': 'some_resource_type',
            'name': 'some_name',
            'values': {
                'some_key': expected_value
            }
        }]
        step.context.type = 'resource'
        step.context.name = 'some_name'
        step.context.property_name = 'tags'
        step.context_sensitive_sentence = 'must'

        self.assertEqual(
            its_value_condition_equal(step, 'must', expected_value), None)
        self.assertEqual(
            its_value_condition_equal(step, 'must not', expected_value * 2),
            None)

        with self.assertRaises(Failure):
            self.assertEqual(
                its_value_condition_equal(step, 'must', expected_value + ' '),
                None)
            self.assertEqual(
                its_value_condition_equal(step, 'must not', expected_value),
                None)
예제 #2
0
    def test_its_value_condition_match_the_search_regex_regex_null_value_is_parsed(
            self):
        step = MockedStep()
        step.context.stash = [{
            'address': 'some_resource.id',
            'type': 'some_resource_type',
            'name': 'some_name',
            'values': None
        }]
        step.context.type = 'resource'
        step.context.name = 'some_name'
        step.context.property_name = 'tags'
        step.context_sensitive_sentence = 'must'

        with self.assertRaises(Failure):
            its_value_condition_match_the_search_regex_regex(
                step, 'must', 'something')
        with self.assertRaises(Failure):
            its_value_condition_equal(step, 'must', 'something')