Skip to content

Commit

Permalink
fix: flip the dataset resource logic around in the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ChasNelson1990 committed Jul 21, 2023
1 parent 71595be commit 2ffa7e5
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions ckanext/validation/tests/test_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,9 @@ def test_run_non_auth_user(self):
user = factories.User()
org = factories.Organization()
dataset = factories.Dataset(
owner_org=org["id"], resources=[factories.Resource()]
owner_org=org["id"]
)
resource = factories.Resource(package_id=dataset['id'])

context = {"user": user["name"], "model": model}

Expand All @@ -357,7 +358,7 @@ def test_run_non_auth_user(self):
call_auth,
"resource_validation_run",
context=context,
resource_id=dataset["resources"][0]["id"],
resource_id=resource["id"],
)

def test_run_auth_user(self):
Expand All @@ -367,16 +368,17 @@ def test_run_auth_user(self):
users=[{"name": user["name"], "capacity": "editor"}]
)
dataset = factories.Dataset(
owner_org=org["id"], resources=[factories.Resource()]
owner_org=org["id"]
)
resource = factories.Resource(package_id=dataset['id'])

context = {"user": user["name"], "model": model}

assert (
call_auth(
"resource_validation_run",
context=context,
resource_id=dataset["resources"][0]["id"],
resource_id=resource["id"],
)
is True
)
Expand Down Expand Up @@ -416,8 +418,9 @@ def test_delete_non_auth_user(self):
user = factories.User()
org = factories.Organization()
dataset = factories.Dataset(
owner_org=org["id"], resources=[factories.Resource()]
owner_org=org["id"]
)
resource = factories.Resource(package_id=dataset['id'])

context = {"user": user["name"], "model": model}

Expand All @@ -426,7 +429,7 @@ def test_delete_non_auth_user(self):
call_auth,
"resource_validation_delete",
context=context,
resource_id=dataset["resources"][0]["id"],
resource_id=resource["id"],
)

def test_delete_auth_user(self):
Expand All @@ -436,16 +439,17 @@ def test_delete_auth_user(self):
users=[{"name": user["name"], "capacity": "editor"}]
)
dataset = factories.Dataset(
owner_org=org["id"], resources=[factories.Resource()]
owner_org=org["id"]
)
resource = factories.Resource(package_id=dataset['id'])

context = {"user": user["name"], "model": model}

assert (
call_auth(
"resource_validation_delete",
context=context,
resource_id=dataset["resources"][0]["id"],
resource_id=resource["id"],
)
is True
)
Expand Down

0 comments on commit 2ffa7e5

Please sign in to comment.