Esempio n. 1
0
def test_inventory_source_update(inventory_source, alice, role_field, allowed):
    if role_field:
        getattr(inventory_source.inventory, role_field).members.add(alice)
    assert allowed == InventorySourceAccess(alice).can_start(
        inventory_source), '{} test failed'.format(role_field)
Esempio n. 2
0
def test_inventory_source_credential_check(rando, inventory_source,
                                           credential):
    inventory_source.inventory.admin_role.members.add(rando)
    access = InventorySourceAccess(rando)
    assert not access.can_attach(inventory_source, credential, 'credentials',
                                 {'id': credential.pk})
Esempio n. 3
0
def test_inventory_source_credential_check(rando, inventory_source,
                                           credential):
    inventory_source.inventory.admin_role.members.add(rando)
    access = InventorySourceAccess(rando)
    assert not access.can_change(inventory_source, {'credential': credential})