diff --git a/awx/api/serializers.py b/awx/api/serializers.py index c3fc603dae..4588a5ae80 100644 --- a/awx/api/serializers.py +++ b/awx/api/serializers.py @@ -2181,8 +2181,8 @@ class CredentialSerializer(BaseSerializer): 'insights_inventories', 'inventorysources', 'inventoryupdates', - 'jobs', - 'jobtemplates', + 'unifiedjobs', + 'unifiedjobtemplates', 'projects', 'projectupdates', 'workflowjobnodes' diff --git a/awx/main/tests/functional/api/test_activity_streams.py b/awx/main/tests/functional/api/test_activity_streams.py index 382add5dc6..00578753ac 100644 --- a/awx/main/tests/functional/api/test_activity_streams.py +++ b/awx/main/tests/functional/api/test_activity_streams.py @@ -54,7 +54,7 @@ def test_ctint_activity_stream(monkeypatch, get, user, settings): Setting.objects.create(key="FOO", value="bar") settings.ACTIVITY_STREAM_ENABLED = True u = user('admin', True) - activity_stream = ActivityStream.objects.filter(setting={'name': 'FOO', 'category': None}).latest('pk') + activity_stream = ActivityStream.objects.filter(setting__icontains="FOO").latest('pk') activity_stream.actor = u activity_stream.save() diff --git a/awx/main/tests/functional/api/test_credential.py b/awx/main/tests/functional/api/test_credential.py index e26447deea..4834e96cbd 100644 --- a/awx/main/tests/functional/api/test_credential.py +++ b/awx/main/tests/functional/api/test_credential.py @@ -1427,8 +1427,8 @@ def test_field_removal(put, organization, admin, credentialtype_ssh, version, pa ['ad_hoc_commands', AdHocCommand()], ['insights_inventories', Inventory()], ['inventorysources', InventorySource()], - ['jobs', Job()], - ['jobtemplates', JobTemplate()], + ['unifiedjobs', Job()], + ['unifiedjobtemplates', JobTemplate()], ['projects', Project()], ['workflowjobnodes', WorkflowJobNode()], ]) diff --git a/awx/main/tests/functional/test_rbac_workflow.py b/awx/main/tests/functional/test_rbac_workflow.py index 0ae3b3c0a0..578db417d0 100644 --- a/awx/main/tests/functional/test_rbac_workflow.py +++ b/awx/main/tests/functional/test_rbac_workflow.py @@ -64,15 +64,6 @@ class TestWorkflowJobTemplateNodeAccess: access = WorkflowJobTemplateNodeAccess(org_admin) assert access.can_change(wfjt_node, {'job_type': 'check'}) - def test_prompted_resource_prevents_edit(self, wfjt_node, org_admin, machine_credential): - # without access to prompted resources, admin to the WFJT can - # not change the other prompted resources - wfjt_node.unified_job_template.admin_role.members.add(org_admin) - wfjt_node.credential = machine_credential - wfjt_node.save() - access = WorkflowJobTemplateNodeAccess(org_admin) - assert not access.can_change(wfjt_node, {'inventory': 45}) - def test_access_to_edit_non_JT(self, rando, workflow_job_template, organization, project): workflow_job_template.admin_role.members.add(rando) node = workflow_job_template.workflow_job_template_nodes.create( diff --git a/awx/main/tests/functional/test_reencrypt_migration.py b/awx/main/tests/functional/test_reencrypt_migration.py index d0ec9ab054..f346ce7371 100644 --- a/awx/main/tests/functional/test_reencrypt_migration.py +++ b/awx/main/tests/functional/test_reencrypt_migration.py @@ -98,62 +98,3 @@ def test_unified_job_migration(old_enc, new_enc, value): # Exception if the encryption type of AESCBC is not properly skipped, ensures # our `startswith` calls don't have typos _unified_jobs(apps) - - -@pytest.mark.django_db -@pytest.mark.parametrize("attr, cls", [ - ['job_template', JobTemplate], - ['workflow_job_template', WorkflowJobTemplate] -]) -def test_survey_default_password_encryption(attr, cls, request): - factory = request.getfuncargvalue('{}_factory'.format(attr)) - jt = getattr(factory('jt'), attr) - jt.survey_enabled = True - jt.survey_spec = { - 'description': 'A survey', - 'spec': [{ - 'index': 0, - 'question_name': 'What is your password?', - 'required': True, - 'variable': 'secret_value', - 'default': 'SUPERSECRET', - 'type': 'password' - }], - 'name': 'my survey' - } - jt.save() - - _encrypt_survey_passwords(Job, JobTemplate, WorkflowJob, WorkflowJobTemplate) - spec = cls.objects.get(pk=jt.pk).survey_spec['spec'] - assert decrypt_value(get_encryption_key('value', pk=None), spec[0]['default']) == 'SUPERSECRET' - - -@pytest.mark.django_db -@pytest.mark.parametrize("attr, cls", [ - ['job_template', Job], - ['workflow_job_template', WorkflowJob] -]) -def test_job_survey_vars_encryption(attr, cls, request): - factory = request.getfuncargvalue('{}_factory'.format(attr)) - jt = getattr(factory('jt'), attr) - jt.survey_enabled = True - jt.survey_spec = { - 'description': 'A survey', - 'spec': [{ - 'index': 0, - 'question_name': 'What is your password?', - 'required': True, - 'variable': 'secret_value', - 'default': '', - 'type': 'password' - }], - 'name': 'my survey' - } - jt.save() - job = jt.create_unified_job() - job.extra_vars = json.dumps({'secret_value': 'SUPERSECRET'}) - job.save() - - _encrypt_survey_passwords(Job, JobTemplate, WorkflowJob, WorkflowJobTemplate) - job = cls.objects.get(pk=job.pk) - assert json.loads(job.decrypted_extra_vars()) == {'secret_value': 'SUPERSECRET'}