Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#4332] Fix datapusher "DataStore" tab render following template changes
- Loading branch information
David Read
committed
Jul 27, 2018
1 parent
e1dafe6
commit 1e2a913
Showing
2 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import nose | ||
import sqlalchemy.orm as orm | ||
|
||
import ckan.plugins as p | ||
import ckan.tests.legacy as tests | ||
from ckan.tests import helpers | ||
import ckan.tests.factories as factories | ||
|
||
import ckanext.datastore.backend.postgres as db | ||
from ckanext.datastore.tests.helpers import rebuild_all_dbs, set_url_type | ||
|
||
|
||
class TestController(): | ||
sysadmin_user = None | ||
normal_user = None | ||
|
||
@classmethod | ||
def setup_class(cls): | ||
cls.app = helpers._get_test_app() | ||
if not tests.is_datastore_supported(): | ||
raise nose.SkipTest("Datastore not supported") | ||
p.load('datastore') | ||
p.load('datapusher') | ||
engine = db.get_write_engine() | ||
cls.Session = orm.scoped_session(orm.sessionmaker(bind=engine)) | ||
|
||
@classmethod | ||
def teardown_class(cls): | ||
rebuild_all_dbs(cls.Session) | ||
p.unload('datastore') | ||
p.unload('datapusher') | ||
|
||
def test_resource_data(self): | ||
user = factories.User() | ||
dataset = factories.Dataset(creator_user_id=user['id']) | ||
resource = factories.Resource(package_id=dataset['id'], | ||
creator_user_id=user['id']) | ||
auth = {'Authorization': str(user['apikey'])} | ||
|
||
self.app.get( | ||
url='/dataset/{id}/resource_data/{resource_id}' | ||
.format(id=str(dataset['name']), | ||
resource_id=str(resource['id'])), | ||
extra_environ=auth) |