예제 #1
0
def add_ckan_admin_tab(config_: CKANConfig,
                       route_name: str,
                       tab_label: str,
                       config_var: str = "ckan.admin_tabs",
                       icon: Optional[str] = None):
    """
    Update 'ckan.admin_tabs' dict the passed config dict.
    """
    # get the admin_tabs dict from the config, or an empty dict.
    admin_tabs_dict = config_.get(config_var, {})
    # update the admin_tabs dict with the new values
    admin_tabs_dict.update({route_name: {"label": tab_label, "icon": icon}})
    # update the config with the updated admin_tabs dict
    config_.update({config_var: admin_tabs_dict})
예제 #2
0
def test_get_item_works():
    my_conf = CKANConfig()
    my_conf[u"test_key_1"] = u"Test value 1"
    assert my_conf.get(u"test_key_1") == u"Test value 1"
예제 #3
0
    def test_get_item_works(self):
        my_conf = CKANConfig()

        my_conf[u'test_key_1'] = u'Test value 1'

        eq_(my_conf.get(u'test_key_1'), u'Test value 1')
예제 #4
0
    def test_get_item_works(self):
        my_conf = CKANConfig()

        my_conf[u'test_key_1'] = u'Test value 1'

        eq_(my_conf.get(u'test_key_1'), u'Test value 1')