예제 #1
0
    def test_clean_update_on_project_update_multiple(self, inventory):
        inv_src1 = InventorySource(inventory=inventory, update_on_project_update=True, source='scm')
        inv_src1.clean_update_on_project_update()
        inv_src1.save()

        inv_src1.source_vars = '---\nhello: world'
        inv_src1.clean_update_on_project_update()

        inv_src2 = InventorySource(inventory=inventory, update_on_project_update=True, source='scm')

        with pytest.raises(ValidationError):
            inv_src2.clean_update_on_project_update()
예제 #2
0
 def test_group_by_azure(self):
     injector = InventorySource.injectors['azure_rm']('2.9')
     inv_src = InventorySource(name='azure source',
                               source='azure_rm',
                               source_vars={'group_by_os_family': True})
     group_by_on = injector.inventory_as_dict(inv_src, '/tmp/foo')
     # suspicious, yes, that is just what the script did
     expected_groups = 6
     assert len(group_by_on['keyed_groups']) == expected_groups
     inv_src.source_vars = json.dumps({'group_by_os_family': False})
     group_by_off = injector.inventory_as_dict(inv_src, '/tmp/foo')
     # much better, everyone should turn off the flag and live in the future
     assert len(group_by_off['keyed_groups']) == expected_groups - 1