Ejemplo n.º 1
0
def test_get_workflows_with_registry(m, request_context, mock_registry):
    assert auth.current_user.is_anonymous, "Unexpected user in session"
    assert auth.current_registry, "Unexpected registry in session"
    # add one fake workflow
    data = {"uuid": "123456"}
    m.get_registry_workflows.return_value = [data]
    response = controllers.workflows_get()
    m.get_registry_workflows.assert_called_once()
    assert isinstance(response, dict), "Unexpected result type"
    assert response == serializers.WorkflowSchema().dump([data], many=True)
Ejemplo n.º 2
0
def test_get_workflows_with_registry(m, request_context, mock_registry,
                                     fake_uri):
    assert auth.current_user.is_anonymous, "Unexpected user in session"
    assert auth.current_registry, "Unexpected registry in session"
    # add one fake workflow
    data = {"uuid": "123456", "version": "1.0", "uri": fake_uri}
    w = models.Workflow(uuid=data['uuid'])
    w.add_version(data["version"], data['uri'], MagicMock())
    m.get_registry_workflows.return_value = [w]
    response = controllers.workflows_get()
    m.get_registry_workflows.assert_called_once()
    assert isinstance(response, dict), "Unexpected result type"
    assert response == serializers.ListOfWorkflows(workflow_status=True).dump(
        [w])
Ejemplo n.º 3
0
def test_get_workflows_no_authorization(m, request_context):
    assert auth.current_user.is_anonymous, "Unexpected user in session"
    assert auth.current_registry is not None, "Unexpected registry in session"
    with pytest.raises(auth.NotAuthorizedException):
        controllers.workflows_get()