Skip to content

Commit

Permalink
fixed test_waf and test_was_GMI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jin-Sun-tts committed Feb 27, 2025
1 parent 5e36b96 commit 3b55d6c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG CKAN_VERSION

USER root

RUN apt-get update && apt-get install -y postgresql-client
RUN apt-get update && apt-get install -y postgresql-client openjdk-17-jre

# Download Saxon jar for FGDC2ISO transform (geodatagov)
ARG saxon_ver=9.9.1-7
Expand Down
24 changes: 19 additions & 5 deletions ckanext/geodatagov/tests/test_waf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,38 @@

from ckan.tests.helpers import reset_db
from ckan.tests.factories import Organization, SysadminWithToken
import pytest
import os
from ckan.model.meta import Session, metadata

log = logging.getLogger(__name__)


@pytest.mark.usefixtures("with_plugins")
class TestWafHarvester(object):

@classmethod
def setup_class(cls):
log.info('Starting mock http server')
mock_static_file_server.serve()

@classmethod
def setup(cls):
# @classmethod
# def setup(cls):
# reset_db()
# cls.organization = Organization()

def setup_method(self):
# https://github.com/ckan/ckan/issues/4764
# drop extension postgis so we can reset db
os.system("PGPASSWORD=ckan psql -h db -U ckan -d ckan -c 'drop extension IF EXISTS postgis cascade;'")
reset_db()
cls.organization = Organization()
os.system("PGPASSWORD=ckan psql -h db -U ckan -d ckan -c 'create extension postgis;'")
# os.system("ckan -c test.ini db upgrade -p harvest")
metadata.create_all(bind=Session.bind)

def run_gather(self, url, source_config):
self.organization = Organization()

def run_gather(self, url, source_config):

sc = json.loads(source_config)

source = WafHarvestSourceObj(url=url,
Expand Down
18 changes: 13 additions & 5 deletions ckanext/geodatagov/tests/test_waf_GMI.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,32 @@

from ckan.tests.helpers import reset_db
from ckan.tests.factories import Organization
import pytest
import os
from ckan.model.meta import Session, metadata

log = logging.getLogger(__name__)


@pytest.mark.usefixtures("with_plugins")
class TestWafHarvester(object):

@classmethod
def setup_class(cls):
log.info('Starting mock http server')
mock_static_file_server.serve()

@classmethod
def setup(cls):
def setup_method(self):
# https://github.com/ckan/ckan/issues/4764
# drop extension postgis so we can reset db
os.system("PGPASSWORD=ckan psql -h db -U ckan -d ckan -c 'drop extension IF EXISTS postgis cascade;'")
reset_db()
cls.organization = Organization()
os.system("PGPASSWORD=ckan psql -h db -U ckan -d ckan -c 'create extension postgis;'")
# os.system("ckan -c test.ini db upgrade -p harvest")
metadata.create_all(bind=Session.bind)

def run_gather(self, url, source_config):
self.organization = Organization()

def run_gather(self, url, source_config):
sc = json.loads(source_config)

source = WafHarvestSourceObj(url=url,
Expand Down

0 comments on commit 3b55d6c

Please sign in to comment.