-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HDX-10398 only sysadmins can access the url
- Loading branch information
1 parent
915af9c
commit b16e21d
Showing
4 changed files
with
19 additions
and
3 deletions.
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
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 |
---|---|---|
|
@@ -17,6 +17,8 @@ | |
|
||
|
||
USER = 'some_user' | ||
SYSADMIN = 'test_sysadmin' | ||
SYSADMIN_EMAIL = '[email protected]' | ||
LOCATION = 'some_location' | ||
LOCATION_DISPLAY_NAME = LOCATION_TITLE = 'Some Location' | ||
ORG = 'org_name_4_completeness' | ||
|
@@ -91,6 +93,7 @@ def _generate_dataset_dict(dataset_name, org_id, group_name, review_date, user=U | |
@pytest.fixture() | ||
def setup_data(): | ||
factories.User(name=USER, email='[email protected]') | ||
factories.Sysadmin(name=SYSADMIN, email=SYSADMIN_EMAIL, fullname='Sysadmin User') | ||
group = factories.Group(name=LOCATION, title=LOCATION_TITLE, display_name=LOCATION_DISPLAY_NAME) | ||
factories.Organization( | ||
name=ORG, | ||
|
@@ -245,9 +248,15 @@ def test_data_completeness_dataset_up_to_date(self, patched_DataCompleteness): | |
@mock.patch('ckanext.hdx_org_group.helpers.data_completeness.DataCompleteness') | ||
def test_data_completeness_datagrid_show(self, patched_DataCompleteness): | ||
data = self.__compute_data_completeness(_generate_test_yaml_dict(), patched_DataCompleteness) | ||
# datagrid_dict = grp_h.hdx_replace_datagrid_labels(data, {'name':LOCATION, 'title': LOCATION_TITLE, 'display_name': LOCATION_DISPLAY_NAME}) | ||
context = {'model': model, 'session': model.Session, 'user': USER, 'ignore_auth': True} | ||
datagrid_dict = _get_action('hdx_datagrid_show')(context, {'id':LOCATION}) | ||
context_sysadmin = {'model': model, 'session': model.Session, 'user': SYSADMIN} | ||
context_user = {'model': model, 'session': model.Session, 'user': USER} | ||
try: | ||
datagrid_dict = _get_action('hdx_datagrid_show')(context_user, {'id': LOCATION}) | ||
assert False | ||
except Exception: | ||
assert True | ||
datagrid_dict = _get_action('hdx_datagrid_show')(context_sysadmin, {'id':LOCATION}) | ||
|
||
assert datagrid_dict['iso3'] == LOCATION | ||
assert datagrid_dict['title'] == LOCATION_TITLE | ||
assert 'date' in datagrid_dict | ||
|