-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6304 from AlanCoding/workflow_role
Add workflow to tower_role module Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
- Loading branch information
Showing
3 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from __future__ import (absolute_import, division, print_function) | ||
__metaclass__ = type | ||
|
||
import pytest | ||
|
||
from awx.main.models import WorkflowJobTemplate, User | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_grant_organization_permission(run_module, admin_user, organization): | ||
rando = User.objects.create(username='rando') | ||
|
||
result = run_module('tower_role', { | ||
'user': rando.username, | ||
'organization': organization.name, | ||
'role': 'admin', | ||
'state': 'present' | ||
}, admin_user) | ||
assert not result.get('failed', False), result.get('msg', result) | ||
|
||
assert rando in organization.execute_role | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_grant_workflow_permission(run_module, admin_user, organization): | ||
wfjt = WorkflowJobTemplate.objects.create(organization=organization, name='foo-workflow') | ||
rando = User.objects.create(username='rando') | ||
|
||
result = run_module('tower_role', { | ||
'user': rando.username, | ||
'workflow': wfjt.name, | ||
'role': 'execute', | ||
'state': 'present' | ||
}, admin_user) | ||
assert not result.get('failed', False), result.get('msg', result) | ||
|
||
assert rando in wfjt.execute_role |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters