コード例 #1
0
 def test_find_keys_that_has_kv_structure(self, *args):
     step = MockedStep()
     step.context.stash = [
         {
             'address': 'some_resource.id',
             'type': 'some_resource_type',
             'name': 'some_name',
             'values': [
                 {
                     'key': 'some_other_key',
                     'value': 'some_other_value'
                 },
                 {
                     'key': 'some_key',
                     'value': 'some_value'
                 }
             ]
         }
     ]
     step.context.type = 'resource'
     step.context.name = 'some_name'
     step.context.property_name = 'tags'
     step.context_sensitive_sentence = 'must'
     it_contains_something_old(step, 'some_key')
     self.assertEqual(step.context.stash[0]['values'], 'some_value')
コード例 #2
0
 def test_it_condition_contain_something_resource_is_not_dict_failure(
         self, *args):
     step = MockedStep()
     step.context_sensitive_sentence = 'it must contain something'
     step.context.type = 'resource'
     step.context.stash = ['some_resource']
     with self.assertRaises(Failure):
         self.assertIsNone(it_contains_something_old(step, 'something'))
コード例 #3
0
    def test_it_condition_contain_something_resource_found(self, *args):
        step = MockedStep()
        step.context_sensitive_sentence = 'it contains something'
        step.context.type = 'resource'
        step.context.stash = [{
            'address': 'some_address',
            'type': 'resource',
            'values': {
                'something': True
            }
        }]

        self.assertTrue(it_contains_something_old(step, 'something'))
コード例 #4
0
 def test_it_condition_contain_something_resource_not_found(self, *args):
     step = MockedStep()
     step.context_sensitive_sentence = 'it must contain something'
     step.context.type = 'resource'
     step.context.stash = [{
         'address': 'some_address',
         'type': 'resource',
         'values': {
             'something': True
         }
     }]
     with self.assertRaises(Failure) as err:
         self.assertIsNone(it_contains_something_old(
             step, 'something else'))
     self.assertEqual(
         str(err.exception), '{} ({}) does not have {} property.'.format(
             'some_address', 'resource', 'something else'))
コード例 #5
0
    def test_it_condition_contain_something_provider_found(self, *args):
        step = MockedStep()
        step.context.type = 'provider'
        step.context.stash = [{'name': 'test'}]

        self.assertTrue(it_contains_something_old(step, 'something'))
コード例 #6
0
    def test_it_condition_contain_something_provider_not_found(self, *args):
        step = MockedStep()
        step.context.type = 'provider'
        step.context.stash = []

        self.assertIsNone(it_contains_something_old(step, 'something'))