Skip to content

Commit

Permalink
tests: rename default_user to user0
Browse files Browse the repository at this point in the history
  • Loading branch information
DaanRosendal committed Nov 9, 2023
1 parent 24413cd commit 5aaee87
Show file tree
Hide file tree
Showing 2 changed files with 158 additions and 178 deletions.
22 changes: 9 additions & 13 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
# under the terms of the MIT License; see LICENSE file for more details.
"""REANA-Workflow-Controller utility tests."""

import os
import json
import os
import stat
import uuid
from contextlib import nullcontext as does_not_raise
Expand All @@ -18,12 +18,12 @@
import mock
import pytest
from reana_db.models import (
InteractiveSession,
InteractiveSessionType,
Job,
JobCache,
RunStatus,
Workflow,
InteractiveSession,
InteractiveSessionType,
)
from reana_db.utils import (
get_disk_usage_or_zero,
Expand Down Expand Up @@ -53,9 +53,7 @@
pytest.param(RunStatus.running, marks=pytest.mark.xfail(strict=True)),
],
)
def test_delete_workflow(
app, session, default_user, sample_yadage_workflow_in_db, status
):
def test_delete_workflow(app, session, user0, sample_yadage_workflow_in_db, status):
"""Test deletion of a workflow in all possible statuses."""
sample_yadage_workflow_in_db.status = status
session.add(sample_yadage_workflow_in_db)
Expand All @@ -65,16 +63,14 @@ def test_delete_workflow(
assert sample_yadage_workflow_in_db.status == RunStatus.deleted


def test_delete_all_workflow_runs(
app, session, default_user, yadage_workflow_with_name
):
def test_delete_all_workflow_runs(app, session, user0, yadage_workflow_with_name):
"""Test deletion of all runs of a given workflow."""
# add 5 workflows in the database with the same name
for i in range(5):
workflow = Workflow(
id_=uuid.uuid4(),
name=yadage_workflow_with_name["name"],
owner_id=default_user.id_,
owner_id=user0.id_,
reana_specification=yadage_workflow_with_name["reana_specification"],
operational_options={},
type_=yadage_workflow_with_name["reana_specification"]["workflow"]["type"],
Expand Down Expand Up @@ -138,7 +134,7 @@ def test_workspace_deletion(
mock_update_workflow_quota,
app,
session,
default_user,
user0,
sample_yadage_workflow_in_db,
workspace,
):
Expand Down Expand Up @@ -206,7 +202,7 @@ def test_workspace_deletion(


def test_deletion_of_workspace_of_an_already_deleted_workflow(
app, session, default_user, sample_yadage_workflow_in_db
app, session, user0, sample_yadage_workflow_in_db
):
"""Test workspace deletion of an already deleted workflow."""
create_workflow_workspace(sample_yadage_workflow_in_db.workspace_path)
Expand Down Expand Up @@ -272,7 +268,7 @@ def test_list_recursive_wildcard(tmp_shared_volume_path):


def test_workspace_permissions(
app, session, default_user, sample_yadage_workflow_in_db, tmp_shared_volume_path
app, session, user0, sample_yadage_workflow_in_db, tmp_shared_volume_path
):
"""Test workspace dir permissions."""
create_workflow_workspace(sample_yadage_workflow_in_db.workspace_path)
Expand Down
Loading

0 comments on commit 5aaee87

Please sign in to comment.