Skip to content

Commit

Permalink
modify static initializaer to setup_class
Browse files Browse the repository at this point in the history
  • Loading branch information
To-Ki-O committed Mar 27, 2023
1 parent 9380b43 commit 0cb5f27
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
12 changes: 7 additions & 5 deletions ckanext/feedback/tests/controllers/test_download.py
Expand Up @@ -27,11 +27,13 @@ def get_downloads(resource_id):

@pytest.mark.usefixtures('clean_db', 'with_plugins', 'with_request_context')
class TestDownloadController:
model.repo.init_db()
engine = get_engine('db', '5432', 'ckan_test', 'ckan', 'ckan')
create_utilization_tables(engine)
create_resource_tables(engine)
create_download_tables(engine)
@classmethod
def setup_class(cls):
model.repo.init_db()
engine = get_engine('db', '5432', 'ckan_test', 'ckan', 'ckan')
create_utilization_tables(engine)
create_resource_tables(engine)
create_download_tables(engine)

@patch('ckanext.feedback.controllers.download.download')
def test_extended_download(self, mocker):
Expand Down
12 changes: 7 additions & 5 deletions ckanext/feedback/tests/services/download/test_summary.py
Expand Up @@ -28,11 +28,13 @@ def get_downloads(resource_id):

@pytest.mark.usefixtures('clean_db', 'with_plugins', 'with_request_context')
class TestDownloadServices:
model.repo.init_db()
engine = get_engine('db', '5432', 'ckan_test', 'ckan', 'ckan')
create_utilization_tables(engine)
create_resource_tables(engine)
create_download_tables(engine)
@classmethod
def setup_class(cls):
model.repo.init_db()
engine = get_engine('db', '5432', 'ckan_test', 'ckan', 'ckan')
create_utilization_tables(engine)
create_resource_tables(engine)
create_download_tables(engine)

def test_increment_resource_downloads(self):
resource = factories.Resource()
Expand Down

0 comments on commit 0cb5f27

Please sign in to comment.