Merge pull request #74 from ckan/ckan-2.11-support

CKAN v2.11 support
This commit is contained in:
Sergey 2024-06-28 19:39:50 +03:00 committed by GitHub
commit 44cb2844a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 17 deletions

View File

@ -19,16 +19,16 @@ jobs:
needs: lint
strategy:
matrix:
ckan-version: ["2.10", 2.9, 2.9-py2, 2.8]
ckan-version: ["2.11", "2.10", 2.9]
fail-fast: false
name: CKAN ${{ matrix.ckan-version }}
runs-on: ubuntu-latest
container:
image: openknowledge/ckan-dev:${{ matrix.ckan-version }}
image: ckan/ckan-dev:${{ matrix.ckan-version }}
services:
solr:
image: ckan/ckan-solr:${{ matrix.ckan-version }}
image: ckan/ckan-solr:${{ matrix.ckan-version }}-solr9
postgres:
image: ckan/ckan-postgres-dev:${{ matrix.ckan-version }}
env:
@ -54,22 +54,16 @@ jobs:
# Replace default path to CKAN core config file with the one on the container
sed -i -e 's/use = config:.*/use = config:\/srv\/app\/src\/ckan\/test-core.ini/' test.ini
- name: Setup extension (CKAN 2.10)
if: ${{ matrix.ckan-version == '2.10' }}
if: ${{ matrix.ckan-version >= '2.10' }}
run: |
pip install -r dev-requirements.txt
ckan -c test.ini db init
ckan -c test.ini db upgrade -p googleanalytics
- name: Setup extension (CKAN == 2.9)
if: ${{ matrix.ckan-version == '2.9' || matrix.ckan-version == '2.9-py2' }}
if: ${{ matrix.ckan-version == '2.9' }}
run: |
pip install -r dev-requirements-2.9.txt
ckan -c test.ini db init
ckan -c test.ini db upgrade -p googleanalytics
- name: Setup extension (CKAN < 2.9)
if: ${{ matrix.ckan-version == '2.8' }}
run: |
pip install -r dev-requirements-2.9.txt
paster --plugin=ckan db init -c test.ini
paster --plugin=ckanext-googleanalytics initdb -c test.ini
- name: Run tests
run: pytest --ckan-ini=test.ini --cov=ckanext.googleanalytics --disable-warnings ckanext/googleanalytics/tests

View File

@ -1,7 +1,7 @@
import pytest
@pytest.mark.usefixtures("clean_db")
@pytest.mark.usefixtures("with_plugins", "clean_db")
def test_script(app):
resp = app.get("/")
assert "GoogleAnalyticsObject" in resp

View File

@ -1,5 +1,5 @@
import pytest
import six
import ckan.plugins.toolkit as tk
from ckanext.googleanalytics import config
@ -23,4 +23,4 @@ class TestCodeSnippets:
monkeypatch.setitem(ckan_config, config.CONFIG_TRACKING_MODE, mode)
snippet = _render_header(mode, tracking_id)
resp = app.get("/about")
assert snippet in resp.body
assert six.ensure_str(snippet) in resp

View File

@ -1,6 +1,6 @@
[metadata]
name = ckanext-googleanalytics
version = 2.3.0
version = 2.4.0
description = Add GA tracking and reporting to CKAN instance
long_description = file: README.md
long_description_content_type = text/markdown
@ -11,16 +11,17 @@ license = AGPL
classifiers =
Development Status :: 4 - Beta
License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
keywords =
CKAN
[options]
# python_requires = >= 3.7
python_requires = >= 3.7
install_requires =
ckantoolkit
google-api-python-client