コード例 #1
0
def test_get_registries_no_authorization(app_client, fake_registry):
    response = app_client.get(utils.build_registries_path())
    utils.assert_status_code(200, response.status_code)
    assert response.data, "Empty response"
    data = json.loads(response.data)
    logger.debug("Response %r", data)
    assert len(data['items']) == 2, "Invalid number of registries"
コード例 #2
0
def test_get_registry_not_authorized_api_key(app_client,
                                             client_credentials_registry,
                                             client_auth_method, user1,
                                             user1_auth):
    response = app_client.get(utils.build_registries_path('current'),
                              headers=user1_auth)
    utils.assert_status_code(401, response.status_code)
コード例 #3
0
def test_get_registries(app_client, client_auth_method, user1, user1_auth):
    response = app_client.get(utils.build_registries_path(),
                              headers=user1_auth)
    utils.assert_status_code(200, response.status_code)
    assert response.data, "Empty response"
    data = json.loads(response.data)
    logger.debug("Response %r", data)
    assert len(data['items']) == 1, "Invalid number of registries"
コード例 #4
0
def test_get_registry(app_client, client_credentials_registry,
                      client_auth_method, user1, user1_auth):
    response = app_client.get(utils.build_registries_path('current'),
                              headers=user1_auth)
    utils.assert_status_code(200, response.status_code)
    assert response.data, "Empty response"
    data = json.loads(response.data)
    logger.debug("Response %r", data)
    utils.assert_properties_exist(['uuid', 'name', 'uri'], data)
    assert data['uuid'] == str(client_credentials_registry.uuid), \
        "Unexpected workflow registry"
コード例 #5
0
def test_get_registry_not_authorized_code_flow(app_client,
                                               client_credentials_registry,
                                               client_auth_method, user1,
                                               user1_auth):
    response = app_client.get(utils.build_registries_path('current'),
                              headers=user1_auth)
    data = json.loads(response.data)
    logger.debug("Response %r", data)
    assert "Provided token doesn't have the required scope" in data[
        "detail"], "Unexpected response"
    utils.assert_status_code(403, response.status_code)
コード例 #6
0
def test_get_registry_by_uuid_not_authorized(app_client, random_valid_uuid):
    response = app_client.get(utils.build_registries_path(random_valid_uuid))
    utils.assert_status_code(401, response.status_code)
コード例 #7
0
def test_get_registry_by_uuid_not_found(app_client, random_valid_uuid,
                                        client_auth_method, user1, user1_auth):
    response = app_client.get(utils.build_registries_path(random_valid_uuid),
                              headers=user1_auth)
    utils.assert_status_code(404, response.status_code)