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

qld-gov-au / ckan / 798aa3e6-67fb-47c0-ac22-452696d4a1a5

23 Jan 2026 05:58AM UTC coverage: 87.882% (+0.002%) from 87.88%
798aa3e6-67fb-47c0-ac22-452696d4a1a5

Pull #241

circleci

ThrawnCA
[QOLSVC-12515] adjust 'show less' link text to reflect different sorts

- 'Show Only Popular' doesn't work when not sorting by popularity
Pull Request #241: [QOLSVC-12515] adjust 'show less' link text to reflect different sorts

47246 of 53761 relevant lines covered (87.88%)

2.14 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
4✔
7

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

12

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

18
    """
19

20
    def test_resource_controller_plugin_create(self):
4✔
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):
4✔
42
        user = factories.Sysadmin()
1✔
43
        resource = factories.Resource(user=user)
1✔
44
        plugin = ckan.plugins.get_plugin("example_iresourcecontroller")
1✔
45

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

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

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

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

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

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

77
    def test_resource_controller_plugin_show(self):
4✔
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
        """
83
        user = factories.Sysadmin()
1✔
84
        package = factories.Dataset(user=user)
1✔
85
        factories.Resource(user=user, package_id=package["id"])
1✔
86

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

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

91
        assert plugin.counter["before_resource_create"] == 1, plugin.counter
1✔
92
        assert plugin.counter["after_resource_create"] == 1, plugin.counter
1✔
93
        assert plugin.counter["before_resource_update"] == 0, plugin.counter
1✔
94
        assert plugin.counter["after_resource_update"] == 0, plugin.counter
1✔
95
        assert plugin.counter["before_resource_delete"] == 0, plugin.counter
1✔
96
        assert plugin.counter["after_resource_delete"] == 0, plugin.counter
1✔
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