Пример #1
0
def setup_app(command, conf, vars):
    """Place any commands to setup ututi here"""

    load_environment(conf.global_conf, conf.local_conf)

    if asbool(conf.get("reset_database", "false")):
        reset_db(meta.engine)

    initialize_dictionaries(meta.engine)

    initialize_db_defaults(meta.engine)
Пример #2
0
def test_setup(test):
    """Create some models needed for the tests."""
    ututi.tests.setUp(test)
    initialize_dictionaries(meta.engine)
    config = pylons.test.pylonsapp.config
    config['default_search_dict'] = 'public.universal'

    l = LocationTag(u'Kauno technologijos universitetas', u'ktu', u'', member_policy='PUBLIC')
    f = LocationTag(u'Ekologijos fakultetas', u'ef', u'', l, member_policy='PUBLIC')
    meta.Session.add(l)
    meta.Session.add(f)

    meta.Session.execute("SET default_text_search_config TO 'public.lt'")
Пример #3
0
def test_setup(test):
    """Create some models needed for the tests."""
    ututi.tests.setUp(test)
    initialize_dictionaries(meta.engine)
    config = pylons.test.pylonsapp.config
    config['default_search_dict'] = 'public.universal'

    vu = LocationTag(u'Vilniaus universitetas', u'vu', u'', member_policy='PUBLIC')
    ef = LocationTag(u'Ekonomikos fakultetas', u'ef', u'', vu, member_policy='PUBLIC')

    meta.Session.add(vu)
    meta.Session.add(ef)

    # We need someone who can create subjects and groups
    user = User(u'User', '*****@*****.**', vu, 'password')
    meta.Session.add(user)
    meta.Session.commit()

    meta.Session.execute("SET default_text_search_config TO 'public.universal'")
    meta.set_active_user(user.id)

    l = LocationTag(u'Kauno technologijos universitetas', u'ktu', u'', member_policy='PUBLIC')
    f = LocationTag(u'Ekologijos fakultetas', u'ef', u'', l, member_policy='PUBLIC')

    mtag = SimpleTag(u'Ekologijos fakultetas') #a mixed tag

    meta.Session.add(l)
    meta.Session.add(f)

    g = Group('agroup', u'Ekologai', description=u'testas')
    g.location = f
    meta.Session.add(g)

    g = Group('new_group', u'Bioinformatikai', description=u'Grup\u0117 kurioje domimasi biologija ir informatika')
    meta.Session.add(g)

    # a tagged group
    g2 = Group('new_grp', u'Biology students', description=u'biologija matematika informatikos mokslas')
    g2.location = LocationTag.get(u'vu/ef')

    meta.Session.add(g2)
    tg = SimpleTag(u'test tag')
    g2.tags.append(tg)

    s = Subject(u'subj_id', u'Test subject', LocationTag.get(u'VU'))
    s.description = u'pagrindai'
    t = SimpleTag(u'a tag')
    meta.Session.add(t)
    s.tags.append(t)
    s.tags.append(mtag)
    meta.Session.add(s)
    p = Page(u'page title', u'Puslapio tekstas')
    meta.Session.add(p)
    s.pages.append(p)

    s = Subject('biologija', u'Biologijos pagrindai', LocationTag.get(u'vu'))
    p = Page(u'page title', u'Puslapio tekstas')
    s.pages.append(p)
    meta.Session.add(s)
    meta.Session.add(p)

    f = File(u'test.txt', u'geografija', 'text/txt')
    f.parent = s
    meta.Session.add(f)

    meta.Session.commit()
    meta.Session.execute("SET default_text_search_config TO 'public.universal'")