From 97f762da1d6efe0c49880db911958bff78ecb29a Mon Sep 17 00:00:00 2001 From: Dan Mihaila Date: Tue, 19 Sep 2023 17:18:16 +0300 Subject: [PATCH] HDX-9010 - adding test for adding inactive in title --- .../hdx_org_group/tests/test_closed_organization.py | 6 +++--- .../ckanext/hdx_org_group/tests/test_org_custom_fields.py | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ckanext-hdx_org_group/ckanext/hdx_org_group/tests/test_closed_organization.py b/ckanext-hdx_org_group/ckanext/hdx_org_group/tests/test_closed_organization.py index a0e053efad..07415f5922 100644 --- a/ckanext-hdx_org_group/ckanext/hdx_org_group/tests/test_closed_organization.py +++ b/ckanext-hdx_org_group/ckanext/hdx_org_group/tests/test_closed_organization.py @@ -23,9 +23,9 @@ def test_closed_organization(self, app): orgadmin = 'orgadmin' context = {'model': model, 'session': model.Session, 'user': orgadmin} - user_list = _get_action('user_list')(context, {}) - log.warning("0 =====display user_list=====") - log.warning(user_list) + # user_list = _get_action('user_list')(context, {}) + # log.warning("0 =====display user_list=====") + # log.warning(user_list) org_dict = _get_action('organization_show')(context, {'id': 'hdx-test-org', 'include_users':True}) diff --git a/ckanext-hdx_org_group/ckanext/hdx_org_group/tests/test_org_custom_fields.py b/ckanext-hdx_org_group/ckanext/hdx_org_group/tests/test_org_custom_fields.py index b3b5149d05..61425c3652 100644 --- a/ckanext-hdx_org_group/ckanext/hdx_org_group/tests/test_org_custom_fields.py +++ b/ckanext-hdx_org_group/ckanext/hdx_org_group/tests/test_org_custom_fields.py @@ -482,7 +482,7 @@ def test_closed_organization_api(self): new_org_dict = { 'name': 'test_org_d', 'title': 'Test Org D', - 'closed_organization': 'true', + 'closed_organization': True, 'org_url': 'www.exampleorganization.org', 'description': 'just a simple description', 'hdx_org_type': ORGANIZATION_TYPE_LIST[0][1] @@ -491,6 +491,7 @@ def test_closed_organization_api(self): org_dict = self._get_action('organization_create')(context_sysadmin, new_org_dict) assert 'closed_organization' in org_dict assert org_dict.get('closed_organization') == True + assert '(inactive)' in org_dict.get('title') except Exception as ex: assert False @@ -499,7 +500,7 @@ def test_closed_organization_api(self): 'id': org_dict.get('id'), 'name': org_dict.get('name'), 'title': org_dict.get('title'), - 'closed_organization': 'false', + 'closed_organization': False, 'org_url': org_dict.get('org_url'), 'description': org_dict.get('description'), 'hdx_org_type': org_dict.get('hdx_org_type'), @@ -508,6 +509,7 @@ def test_closed_organization_api(self): org_updated_dict = self._get_action('organization_show')(context_sysadmin, {'id': org_dict.get('id')}) assert 'closed_organization' in org_updated_dict assert org_updated_dict.get('closed_organization') == False + assert '(inactive)' not in org_updated_dict.get('title') except Exception as ex: assert False @@ -532,6 +534,7 @@ def test_closed_organization_api(self): org_updated_dict = self._get_action('organization_show')(context_sysadmin, {'id': _org_update_dict.get('id')}) assert 'closed_organization' in org_updated_dict assert org_updated_dict.get('closed_organization') == False + assert '(inactive)' not in org_updated_dict.get('title') except Exception as ex: assert False @@ -549,6 +552,7 @@ def test_closed_organization_api(self): org_updated_dict = self._get_action('organization_show')(context_sysadmin, {'id': org_dict.get('id')}) assert 'closed_organization' in org_updated_dict assert org_updated_dict.get('closed_organization') == True + assert '(inactive)' in org_updated_dict.get('title') except Exception as ex: assert False