• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

qld-gov-au / ckan / a0d61f9f-2314-4143-bd97-cb1a9ba97b29

21 Jan 2026 03:01AM UTC coverage: 79.542% (-8.4%) from 87.895%
a0d61f9f-2314-4143-bd97-cb1a9ba97b29

Pull #239

circleci

ThrawnCA
[QOLSVC-12515] add support for specifying facet sorts via query parameters

- Use '_{facet}_sort' as a parallel to '_{facet}_limit', with comma separation for the ordering, eg
'_tags_sort=count,desc' to mimic the default popularity-based sorting.
Pull Request #239: QOLSVC-12515 alphabetical facet sort

11 of 35 new or added lines in 2 files covered. (31.43%)

12045 existing lines in 303 files now uncovered.

42761 of 53759 relevant lines covered (79.54%)

1.62 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/ckanext/example_iresourcecontroller/tests/test_example_iresourcecontroller.py
1
# encoding: utf-8
2

3
"""Tests for the ckanext.example_iauthfunctions extension.
4

5
"""
6
import pytest
3✔
7

8
import ckan.plugins
3✔
9
import ckan.tests.factories as factories
3✔
10
import ckan.tests.helpers as helpers
3✔
11

12

13
@pytest.mark.ckan_config("ckan.plugins", "example_iresourcecontroller")
3✔
14
@pytest.mark.usefixtures("non_clean_db", "with_plugins")
3✔
15
class TestExampleIResourceController(object):
3✔
16
    """Tests for the plugin that uses IResourceController.
17

18
    """
19

20
    def test_resource_controller_plugin_create(self):
3✔
21
        user = factories.Sysadmin()
1✔
22
        package = factories.Dataset(user=user)
1✔
23

24
        plugin = ckan.plugins.get_plugin("example_iresourcecontroller")
1✔
25

26
        helpers.call_action(
1✔
27
            "resource_create",
28
            package_id=package["id"],
29
            name="test-resource",
30
            url="http://resource.create/",
31
            apikey=user["apikey"],
32
        )
33

34
        assert plugin.counter["before_resource_create"] == 1, plugin.counter
1✔
35
        assert plugin.counter["after_resource_create"] == 1, plugin.counter
1✔
36
        assert plugin.counter["before_resource_update"] == 0, plugin.counter
1✔
37
        assert plugin.counter["after_resource_update"] == 0, plugin.counter
1✔
38
        assert plugin.counter["before_resource_delete"] == 0, plugin.counter
1✔
39
        assert plugin.counter["after_resource_delete"] == 0, plugin.counter
1✔
40

41
    def test_resource_controller_plugin_update(self):
3✔
UNCOV
42
        user = factories.Sysadmin()
1✔
UNCOV
43
        resource = factories.Resource(user=user)
1✔
UNCOV
44
        plugin = ckan.plugins.get_plugin("example_iresourcecontroller")
1✔
45

UNCOV
46
        helpers.call_action(
1✔
47
            "resource_update",
48
            id=resource["id"],
49
            url="http://resource.updated/",
50
            apikey=user["apikey"],
51
        )
52

UNCOV
53
        assert plugin.counter["before_resource_create"] == 1, plugin.counter
1✔
UNCOV
54
        assert plugin.counter["after_resource_create"] == 1, plugin.counter
1✔
UNCOV
55
        assert plugin.counter["before_resource_update"] == 1, plugin.counter
1✔
UNCOV
56
        assert plugin.counter["after_resource_update"] == 1, plugin.counter
1✔
UNCOV
57
        assert plugin.counter["before_resource_delete"] == 0, plugin.counter
1✔
UNCOV
58
        assert plugin.counter["after_resource_delete"] == 0, plugin.counter
1✔
59

60
    def test_resource_controller_plugin_delete(self):
3✔
UNCOV
61
        user = factories.Sysadmin()
1✔
UNCOV
62
        resource = factories.Resource(user=user)
1✔
63

UNCOV
64
        plugin = ckan.plugins.get_plugin("example_iresourcecontroller")
1✔
65

UNCOV
66
        helpers.call_action(
1✔
67
            "resource_delete", id=resource["id"], apikey=user["apikey"]
68
        )
69

UNCOV
70
        assert plugin.counter["before_resource_create"] == 1, plugin.counter
1✔
UNCOV
71
        assert plugin.counter["after_resource_create"] == 1, plugin.counter
1✔
UNCOV
72
        assert plugin.counter["before_resource_update"] == 0, plugin.counter
1✔
UNCOV
73
        assert plugin.counter["after_resource_update"] == 0, plugin.counter
1✔
UNCOV
74
        assert plugin.counter["before_resource_delete"] == 1, plugin.counter
1✔
UNCOV
75
        assert plugin.counter["after_resource_delete"] == 1, plugin.counter
1✔
76

77
    def test_resource_controller_plugin_show(self):
3✔
78
        """
79
        Before show gets called by the other methods but we test it
80
        separately here and make sure that it doesn't call the other
81
        methods.
82
        """
UNCOV
83
        user = factories.Sysadmin()
1✔
UNCOV
84
        package = factories.Dataset(user=user)
1✔
UNCOV
85
        factories.Resource(user=user, package_id=package["id"])
1✔
86

UNCOV
87
        plugin = ckan.plugins.get_plugin("example_iresourcecontroller")
1✔
88

UNCOV
89
        helpers.call_action("package_show", name_or_id=package["id"])
1✔
90

UNCOV
91
        assert plugin.counter["before_resource_create"] == 1, plugin.counter
1✔
UNCOV
92
        assert plugin.counter["after_resource_create"] == 1, plugin.counter
1✔
UNCOV
93
        assert plugin.counter["before_resource_update"] == 0, plugin.counter
1✔
UNCOV
94
        assert plugin.counter["after_resource_update"] == 0, plugin.counter
1✔
UNCOV
95
        assert plugin.counter["before_resource_delete"] == 0, plugin.counter
1✔
UNCOV
96
        assert plugin.counter["after_resource_delete"] == 0, plugin.counter
1✔
UNCOV
97
        assert plugin.counter["before_resource_show"] == 4, plugin.counter
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc