def test_patch_project_null_organization(patch, organization, project, admin):
    patch(reverse('api:project_detail', kwargs={'pk':project.id,}), { 'name': 't', 'organization': organization.id}, admin, expect=200)
def test_notification_template_simple_patch(patch, notification_template,
                                            admin):
    patch(reverse('api:notification_template_detail',
                  kwargs={'pk': notification_template.id}), {'name': 'foo'},
          admin,
          expect=200)
Beispiel #3
0
def test_logging_aggregrator_connection_test_requires_superuser(
        get, post, alice):
    url = reverse('api:setting_logging_test')
    post(url, {}, user=alice, expect=403)
Beispiel #4
0
def test_list_as_unauthorized_xfail(get):
    response = get(reverse('api:credential_type_list'))
    assert response.status_code == 401
Beispiel #5
0
 def get(self, request, format=None):
     '''List top level resources'''
     data = OrderedDict()
     data['ping'] = reverse('api:api_v2_ping_view', request=request)
     data['instances'] = reverse('api:instance_list', request=request)
     data['instance_groups'] = reverse('api:instance_group_list',
                                       request=request)
     data['config'] = reverse('api:api_v2_config_view', request=request)
     data['settings'] = reverse('api:setting_category_list',
                                request=request)
     data['me'] = reverse('api:user_me_list', request=request)
     data['dashboard'] = reverse('api:dashboard_view', request=request)
     data['organizations'] = reverse('api:organization_list',
                                     request=request)
     data['users'] = reverse('api:user_list', request=request)
     data['execution_environments'] = reverse(
         'api:execution_environment_list', request=request)
     data['projects'] = reverse('api:project_list', request=request)
     data['project_updates'] = reverse('api:project_update_list',
                                       request=request)
     data['teams'] = reverse('api:team_list', request=request)
     data['credentials'] = reverse('api:credential_list', request=request)
     data['credential_types'] = reverse('api:credential_type_list',
                                        request=request)
     data['credential_input_sources'] = reverse(
         'api:credential_input_source_list', request=request)
     data['applications'] = reverse('api:o_auth2_application_list',
                                    request=request)
     data['tokens'] = reverse('api:o_auth2_token_list', request=request)
     data['metrics'] = reverse('api:metrics_view', request=request)
     data['inventory'] = reverse('api:inventory_list', request=request)
     data['inventory_sources'] = reverse('api:inventory_source_list',
                                         request=request)
     data['inventory_updates'] = reverse('api:inventory_update_list',
                                         request=request)
     data['groups'] = reverse('api:group_list', request=request)
     data['hosts'] = reverse('api:host_list', request=request)
     data['job_templates'] = reverse('api:job_template_list',
                                     request=request)
     data['jobs'] = reverse('api:job_list', request=request)
     data['ad_hoc_commands'] = reverse('api:ad_hoc_command_list',
                                       request=request)
     data['system_job_templates'] = reverse('api:system_job_template_list',
                                            request=request)
     data['system_jobs'] = reverse('api:system_job_list', request=request)
     data['schedules'] = reverse('api:schedule_list', request=request)
     data['roles'] = reverse('api:role_list', request=request)
     data['notification_templates'] = reverse(
         'api:notification_template_list', request=request)
     data['notifications'] = reverse('api:notification_list',
                                     request=request)
     data['labels'] = reverse('api:label_list', request=request)
     data['unified_job_templates'] = reverse(
         'api:unified_job_template_list', request=request)
     data['unified_jobs'] = reverse('api:unified_job_list', request=request)
     data['activity_stream'] = reverse('api:activity_stream_list',
                                       request=request)
     data['workflow_job_templates'] = reverse(
         'api:workflow_job_template_list', request=request)
     data['workflow_jobs'] = reverse('api:workflow_job_list',
                                     request=request)
     data['workflow_approvals'] = reverse('api:workflow_approval_list',
                                          request=request)
     data['workflow_job_template_nodes'] = reverse(
         'api:workflow_job_template_node_list', request=request)
     data['workflow_job_nodes'] = reverse('api:workflow_job_node_list',
                                          request=request)
     data['mesh_visualizer'] = reverse('api:mesh_visualizer_view',
                                       request=request)
     return Response(data)
Beispiel #6
0
def o_auth2_token_get_absolute_url(self, request=None):
    return reverse('api:o_auth2_token_detail',
                   kwargs={'pk': self.pk},
                   request=request)
Beispiel #7
0
def test_options_valid_kinds(method, valid, options, admin):
    response = options(reverse('api:credential_type_list'), admin)
    choices = sorted(
        dict(response.data['actions'][method]['kind']['choices']).keys())
    assert valid == choices
Beispiel #8
0
 def get_absolute_url(self, request=None):
     return reverse('api:workflow_approval_detail',
                    kwargs={'pk': self.pk},
                    request=request)
Beispiel #9
0
 def user_get_absolute_url(user, request=None):
     return reverse('api:user_detail',
                    kwargs={'pk': user.pk},
                    request=request)
Beispiel #10
0
def test_project_unset_custom_virtualenv(get, patch, project, admin, value):
    url = reverse('api:project_detail', kwargs={'pk': project.id})
    resp = patch(url, {'custom_virtualenv': value}, user=admin, expect=200)
    assert resp.data['custom_virtualenv'] is None
Beispiel #11
0
 def get_absolute_url(self, request=None):
     return reverse('api:workflow_job_template_node_detail',
                    kwargs={'pk': self.pk},
                    request=request)
Beispiel #12
0
def test_system_tracking_license_options(hosts, options, user):
    hosts = hosts(host_count=1)
    url = reverse('api:host_fact_versions_list', kwargs={'pk': hosts[0].pk})
    response = options(url, None, user('admin', True))

    check_system_tracking_feature_forbidden(response)
def test_project_delete(delete, organization, admin_user):
    proj = Project(name='foo', organization=organization)
    proj.save()
    delete(reverse('api:project_detail', kwargs={'pk':proj.id,}), admin_user)
def test_patch_project_null_organization_xfail(patch, project, org_admin):
    patch(reverse('api:project_detail', kwargs={'pk':project.id,}), { 'name': 't', 'organization': None}, org_admin, expect=400)
def test_prevent_delete_iso_and_control_groups(delete, isolated_instance_group, admin):
    iso_url = reverse("api:instance_group_detail", kwargs={'pk': isolated_instance_group.pk})
    controller_url = reverse("api:instance_group_detail", kwargs={'pk': isolated_instance_group.controller.pk})
    delete(iso_url, None, admin, expect=403)
    delete(controller_url, None, admin, expect=403)
Beispiel #16
0
 def get_absolute_url(self, request=None):
     return reverse('api:ad_hoc_command_detail', kwargs={'pk': self.pk}, request=request)
def test_delete_instance_group_jobs(delete, instance_group_jobs_successful, instance_group, admin):
    url = reverse("api:instance_group_detail", kwargs={'pk': instance_group.pk})
    delete(url, None, admin, expect=204)
Beispiel #18
0
 def get_absolute_url(self, request=None):
     return reverse('api:activity_stream_detail',
                    kwargs={'pk': self.pk},
                    request=request)
Beispiel #19
0
def test_delete_as_unauthorized_xfail(delete):
    ssh = CredentialType.defaults['ssh']()
    ssh.save()
    response = delete(
        reverse('api:credential_type_detail', kwargs={'pk': ssh.pk}), )
    assert response.status_code == 401
Beispiel #20
0
def test_search_on_notification_configuration_is_prevented(get, admin):
    url = reverse('api:notification_template_list')
    response = get(url, {'notification_configuration__regex': 'ABCDEF'}, admin)
    assert response.status_code == 403
    assert response.data == {"detail": "Filtering on notification_configuration is not allowed."}
Beispiel #21
0
def test_list_as_admin(get, admin):
    ssh = CredentialType.defaults['ssh']()
    ssh.save()
    response = get(reverse('api:credential_type_list'), admin)
    assert response.status_code == 200
    assert response.data['count'] == 1
Beispiel #22
0
def test_get_inv_src_running_notification(get, admin, inventory_source):
    url = reverse('api:inventory_source_notification_templates_started_list', kwargs={'pk': inventory_source.pk})
    response = get(url, admin)
    assert response.status_code == 200
    assert len(response.data['results']) == 0
Beispiel #23
0
 def get_absolute_url(self, request=None):
     return reverse('api:instance_group_detail', kwargs={'pk': self.pk}, request=request)
Beispiel #24
0
def test_get_org_running_notification(get, admin, organization):
    url = reverse('api:organization_notification_templates_started_list', kwargs={'pk': organization.pk})
    response = get(url, admin)
    assert response.status_code == 200
    assert len(response.data['results']) == 0
Beispiel #25
0
 def test_user_list_can_not_add(self, org_member, org_admin, options):
     response = options(reverse('api:user_list'), org_member)
     assert 'POST' not in response.data['actions']
Beispiel #26
0
def test_get_sys_jt_running_notification(get, admin, system_job_template):
    url = reverse('api:system_job_template_notification_templates_started_list', kwargs={'pk': system_job_template.pk})
    response = get(url, admin)
    assert response.status_code == 200
    assert len(response.data['results']) == 0
def test_get_notification_template_list(get, user, notification_template):
    url = reverse('api:notification_template_list')
    response = get(url, user('admin', True))
    assert response.status_code == 200
    assert len(response.data['results']) == 1
Beispiel #28
0
 def get_absolute_url(self, request=None):
     return reverse('api:role_detail', kwargs={'pk': self.pk}, request=request)
Beispiel #29
0
def test_logging_aggregrator_connection_test_bad_request(
        get, post, admin, key):
    url = reverse('api:setting_logging_test')
    resp = post(url, {}, user=admin, expect=400)
    assert 'This field is required.' in resp.data.get(key, [])
def test_create_project_null_organization_xfail(post, organization, org_admin):
    post(reverse('api:project_list'), { 'name': 't', 'organization': None}, org_admin, expect=403)