def test_import_one_js_meta():
    import_one('testone', 'test/samples/alpha/plugins/metaplugin.js', store)

    tiddler = store.get(Tiddler('metaplugin', 'testone'))

    assert tiddler.title == 'metaplugin'
    assert tiddler.tags == ['alpha', 'beta']
def test_import_one_css_type():
    import_one('testone', 'https://github.com/necolas/normalize.css/raw/master/normalize.css text/css', store)
    tiddler = store.get(Tiddler('normalize.css', 'testone'))

    assert tiddler.title == 'normalize.css'
    assert tiddler.type == 'text/css'
    assert tiddler.tags == []
def _process_url(environ, url, bag):
    try:
        import_one(bag.name, url, environ['tiddlyweb.store'])
    except ValueError:
        # automatic detection did not work, fail over to wiki
        # XXX: later add sniffing
        url, handle = get_url_handle(url)
        _process_file(environ, handle, bag)
def _process_url(environ, url, bag):
    try:
        import_one(bag.name, url, environ['tiddlyweb.store'])
    except ValueError:
        # automatic detection did not work, fail over to wiki
        # XXX: later add sniffing
        url, handle = get_url_handle(url)
        _process_file(environ, handle, bag)
def test_import_one_css_meta():
    import_one('testone', 'test/samples/alpha/fnord.css', store)

    tiddler = store.get(Tiddler('fnord.css', 'testone'))

    assert tiddler.title == 'fnord.css'
    assert tiddler.type == 'text/css'
    assert tiddler.tags == ['alpha', 'beta']
def test_import_one_recipe_fragment():
    _cleanup(store)
    import_one('testone', 'test/samples/alpha/index.html.recipe#Greetings', store)

    bag = store.get(Bag('testone'))
    tiddlers = list(store.list_bag_tiddlers(bag))
    assert len(tiddlers) == 1
    assert tiddlers[0].title == 'Greetings'
def test_import_one_wiki_fragment():
    _cleanup(store)
    import_one('testone', 'test/samples/tiddlers.wiki#codeblocked', store)

    bag = store.get(Bag('testone'))
    tiddlers = list(store.list_bag_tiddlers(bag))
    assert len(tiddlers) == 1
    assert tiddlers[0].title == 'codeblocked'
def test_import_one_tiddler():
    import_one('testone', 'test/samples/alpha/plugins/bplugin.js', store)

    bag = store.get(Bag('testone'))
    assert len(list(store.list_bag_tiddlers(bag))) == 19 # bplugin already in store

    tiddler = store.get(Tiddler('bplugin', 'testone'))
    assert tiddler.type == 'text/javascript'
    assert tiddler.text == "alert('i am here');"
Esempio n. 9
0
def setup_module(module):
    bag = Bag('holder')
    store = Store(config['server_store'][0], config['server_store'][1],
                  {'tiddlyweb.config': config})
    store.put(bag)

    import_one('holder', IMAGE, store)
    import_one('holder', ZERO, store)

    tiddler = Tiddler('index', 'holder')
    tiddler.text = open(HTML).read().decode('UTF-8')
    tiddler.type = 'text/html'
    store.put(tiddler)
    module.store = store
def setup_module(module):
    bag = Bag('holder')
    store = Store(config['server_store'][0], config['server_store'][1],
            {'tiddlyweb.config': config})
    store.put(bag)

    import_one('holder', IMAGE, store)
    import_one('holder', ZERO, store)

    tiddler = Tiddler('index', 'holder')
    tiddler.text = open(HTML).read().decode('UTF-8')
    tiddler.type = 'text/html'
    store.put(tiddler)
    module.store = store
def test_import_one_wiki():
    import_one('testone', 'test/samples/tiddlers.wiki', store)

    bag = store.get(Bag('testone'))
    assert len(list(store.list_bag_tiddlers(bag))) == 9
def test_import_one_tiddler():
    import_one('testone', 'test/samples/alpha/plugins/bplugin.js', store)

    bag = store.get(Bag('testone'))
    assert len(bag.list_tiddlers()) == 18 # bplugin already in store
def test_import_one_recipe():
    import_one('testone', 'test/samples/alpha/index.html.recipe', store)

    bag = store.get(Bag('testone'))
    assert len(bag.list_tiddlers()) == 18
def test_import_one_html_wiki():
    import_one('testone', 'test/samples/tiddlers.html', store)

    bag = store.get(Bag('testone'))
    assert len(bag.list_tiddlers()) == 9 # tiddlers overwritten
def test_import_one_wiki():
    import_one('testone', 'test/samples/tiddlers.wiki', store)

    bag = store.get(Bag('testone'))
    assert len(bag.list_tiddlers()) == 9
def test_import_one_html_wiki():
    import_one('testone', 'test/samples/tiddlers.html', store)

    bag = store.get(Bag('testone'))
    assert len(list(store.list_bag_tiddlers(bag))) == 9 # tiddlers overwritten
def test_import_one_recipe():
    import_one('testone', 'test/samples/alpha/index.html.recipe', store)

    bag = store.get(Bag('testone'))
    assert len(list(store.list_bag_tiddlers(bag))) == 19