Skip to content

Commit

Permalink
Remove fixture with_request_context from action tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pdelboca committed Jan 18, 2022
1 parent 50da8b9 commit 1bd38dd
Showing 1 changed file with 27 additions and 29 deletions.
56 changes: 27 additions & 29 deletions ckan/tests/logic/action/test_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from ckan.lib.search.common import SearchError


@pytest.mark.usefixtures("clean_db", "with_request_context")
@pytest.mark.usefixtures("clean_db")
class TestPackageShow(object):
def test_package_show(self):
# simple dataset, simple checks
Expand Down Expand Up @@ -207,7 +207,7 @@ def foo(key, data, errors, context): # noqa
assert "new_field" not in dataset2


@pytest.mark.usefixtures("clean_db", "with_request_context")
@pytest.mark.usefixtures("clean_db")
class TestGroupList(object):
def test_group_list(self):

Expand Down Expand Up @@ -475,7 +475,7 @@ def test_group_list_wrong_offset(self):
helpers.call_action("group_list", offset="-2")


@pytest.mark.usefixtures("clean_db", "clean_index", "with_request_context")
@pytest.mark.usefixtures("clean_db", "clean_index")
class TestGroupShow(object):
def test_group_show(self):
group = factories.Group(user=factories.User())
Expand Down Expand Up @@ -656,7 +656,7 @@ def test_package_limit_configured(self):
assert len(results["packages"]) == 5 # i.e. ckan.search.rows_max


@pytest.mark.usefixtures("clean_db", "with_request_context")
@pytest.mark.usefixtures("clean_db")
class TestOrganizationList(object):
def test_organization_list(self):

Expand Down Expand Up @@ -767,7 +767,7 @@ def test_all_fields_limit_configured(self):
assert len(results) == 5 # i.e. configured limit


@pytest.mark.usefixtures("clean_db", "with_request_context")
@pytest.mark.usefixtures("clean_db")
class TestOrganizationShow(object):
def test_organization_show(self):
org = factories.Organization()
Expand Down Expand Up @@ -851,7 +851,7 @@ def test_package_limit_configured(self):
assert len(results["packages"]) == 5 # i.e. ckan.search.rows_max


@pytest.mark.usefixtures("clean_db", "with_request_context")
@pytest.mark.usefixtures("clean_db")
class TestUserList(object):
def test_user_list_default_values(self):
# we need to set fullname because user_list by default sorts by
Expand Down Expand Up @@ -1029,7 +1029,7 @@ def test_user_list_order_by_edits(self):
helpers.call_action("user_list", order_by="edits")


@pytest.mark.usefixtures("clean_db", "with_request_context")
@pytest.mark.usefixtures("clean_db")
class TestUserShow(object):
def test_user_show_default_values(self):

Expand Down Expand Up @@ -1224,7 +1224,7 @@ def test_user_show_for_myself_without_passing_id(self):
assert "reset_key" not in got_user


@pytest.mark.usefixtures("clean_db", "clean_index", "with_request_context")
@pytest.mark.usefixtures("clean_db", "clean_index")
class TestCurrentPackageList(object):
def test_current_package_list(self):
"""
Expand Down Expand Up @@ -1299,7 +1299,7 @@ def test_current_package_list_private_datasets_sysadmin_user(self):
assert len(current_package_list) == 2


@pytest.mark.usefixtures("clean_db", "clean_index", "with_request_context")
@pytest.mark.usefixtures("clean_db", "clean_index")
class TestPackageAutocomplete(object):
def test_package_autocomplete_match_name(self):
pkg = factories.Dataset(name="warandpeace")
Expand Down Expand Up @@ -1372,7 +1372,7 @@ def test_package_autocomplete_works_for_the_middle_part_of_title(self):
assert len(package_list) == 2


@pytest.mark.usefixtures("clean_db", "clean_index", "with_request_context")
@pytest.mark.usefixtures("clean_db", "clean_index")
class TestPackageSearch(object):
def test_search(self):
factories.Dataset(title="Rivers")
Expand Down Expand Up @@ -1959,7 +1959,7 @@ def test_local_parameters_not_supported(self):


@pytest.mark.ckan_config("ckan.plugins", "example_idatasetform")
@pytest.mark.usefixtures("clean_db", "with_plugins", "with_request_context")
@pytest.mark.usefixtures("clean_db", "with_plugins")
class TestPackageAutocompleteWithDatasetForm(object):
def test_custom_schema_returned(self):
dataset1 = factories.Dataset(custom_text="foo")
Expand All @@ -1986,7 +1986,7 @@ def test_custom_schema_not_returned(self):
assert query["results"][0]["extras"][0]["value"] == "foo"


@pytest.mark.usefixtures("clean_db", "clean_index", "with_request_context")
@pytest.mark.usefixtures("clean_db", "clean_index")
class TestUserAutocomplete(object):
def test_autocomplete(self):
factories.Sysadmin(name="autocompletesysadmin")
Expand All @@ -2010,7 +2010,7 @@ def test_autocomplete_limit(self):
assert len(result) == 1


@pytest.mark.usefixtures("clean_db", "clean_index", "with_request_context")
@pytest.mark.usefixtures("clean_db", "clean_index")
class TestFormatAutocomplete:
def test_missing_param(self):
with pytest.raises(logic.ValidationError):
Expand All @@ -2024,7 +2024,7 @@ def test_autocomplete(self):
assert result == ["csv"]


@pytest.mark.usefixtures("clean_db", "with_request_context")
@pytest.mark.usefixtures("clean_db")
class TestBadLimitQueryParameters(object):
"""test class for #1258 non-int query parameters cause 500 errors
Expand Down Expand Up @@ -2060,7 +2060,7 @@ def test_package_search_facet_field_is_json(self):
helpers.call_action("package_search", **kwargs)


@pytest.mark.usefixtures("clean_db", "with_request_context")
@pytest.mark.usefixtures("clean_db")
class TestOrganizationListForUser(object):
"""Functional tests for the organization_list_for_user() action function."""

Expand Down Expand Up @@ -2706,7 +2706,7 @@ def test_tag_list_vocab_not_found(self):
helpers.call_action("tag_list", vocabulary_id="does-not-exist")


@pytest.mark.usefixtures("clean_db", "with_request_context")
@pytest.mark.usefixtures("clean_db")
class TestMembersList(object):
def test_dataset_delete_marks_membership_of_group_as_deleted(self):
sysadmin = factories.Sysadmin()
Expand Down Expand Up @@ -2829,7 +2829,7 @@ def test_user_delete_marks_membership_of_org_as_deleted(self):
assert len(org_members) == 0


@pytest.mark.usefixtures("clean_db", "with_request_context")
@pytest.mark.usefixtures("clean_db")
class TestFollow(object):
def test_followee_list(self):

Expand Down Expand Up @@ -2877,9 +2877,7 @@ def test_followee_list_with_q(self):

class TestStatusShow(object):
@pytest.mark.ckan_config("ckan.plugins", "stats")
@pytest.mark.usefixtures(
"clean_db", "with_plugins", "with_request_context"
)
@pytest.mark.usefixtures("clean_db", "with_plugins")
def test_status_show(self):

status = helpers.call_action("status_show")
Expand Down Expand Up @@ -2949,7 +2947,7 @@ def _seconds_since_timestamp(timestamp, format_):
return (now - dt).total_seconds()


@pytest.mark.usefixtures("clean_db", "with_request_context")
@pytest.mark.usefixtures("clean_db")
class TestActivityShow(object):
def test_simple_without_data(self):
dataset = factories.Dataset()
Expand Down Expand Up @@ -3009,7 +3007,7 @@ def _clear_activities():
model.Session.flush()


@pytest.mark.usefixtures("clean_db", "with_request_context")
@pytest.mark.usefixtures("clean_db")
class TestPackageActivityList(object):
def test_create_dataset(self):
user = factories.User()
Expand Down Expand Up @@ -3403,7 +3401,7 @@ def test_sysadmin_user_can_include_hidden_activities(self):
]


@pytest.mark.usefixtures("clean_db", "with_request_context")
@pytest.mark.usefixtures("clean_db")
class TestUserActivityList(object):
def test_create_user(self):
user = factories.User()
Expand Down Expand Up @@ -3606,7 +3604,7 @@ def test_limit_hits_max(self):
assert len(results) == 7 # i.e. ckan.activity_list_limit_max


@pytest.mark.usefixtures("clean_db", "with_request_context")
@pytest.mark.usefixtures("clean_db")
class TestGroupActivityList(object):
def test_create_group(self):
user = factories.User()
Expand Down Expand Up @@ -3847,7 +3845,7 @@ def test_sysadmin_user_can_include_hidden_activities(self):
]


@pytest.mark.usefixtures("clean_db", "with_request_context")
@pytest.mark.usefixtures("clean_db")
class TestOrganizationActivityList(object):
def test_create_organization(self):
user = factories.User()
Expand Down Expand Up @@ -4088,7 +4086,7 @@ def test_sysadmin_user_can_include_hidden_activities(self):
]


@pytest.mark.usefixtures("clean_db", "with_request_context")
@pytest.mark.usefixtures("clean_db")
class TestRecentlyChangedPackagesActivityList(object):
def test_create_dataset(self):
user = factories.User()
Expand Down Expand Up @@ -4231,7 +4229,7 @@ def test_limit_hits_max(self):
assert len(results) == 7 # i.e. ckan.activity_list_limit_max


@pytest.mark.usefixtures("clean_db", "with_request_context")
@pytest.mark.usefixtures("clean_db")
class TestDashboardActivityList(object):
def test_create_user(self):
user = factories.User()
Expand Down Expand Up @@ -4340,7 +4338,7 @@ def test_limit_hits_max(self):
assert len(results) == 7 # i.e. ckan.activity_list_limit_max


@pytest.mark.usefixtures("clean_db", "with_request_context")
@pytest.mark.usefixtures("clean_db")
class TestDashboardNewActivities(object):
def test_users_own_activities(self):
# a user's own activities are not shown as "new"
Expand Down Expand Up @@ -4885,7 +4883,7 @@ def test_search_results_member(self):
assert results["results"][1]["id"] == dataset2["id"]


@pytest.mark.usefixtures("clean_db", "with_request_context")
@pytest.mark.usefixtures("clean_db")
class TestResourceSearch(object):
def test_required_fields(self):
with pytest.raises(logic.ValidationError):
Expand Down

0 comments on commit 1bd38dd

Please sign in to comment.