Ejemplo n.º 1
0
def test_custom_basic_urls_with_custom_templates_setup(client):
    template_paths = [rel('../tests/templates/')]
    start('tests/fixtures/paths1.yaml', CUSTOM_TEMPLATE_DIRS=template_paths)
    assert reverse('foobar') == '/foobar2/'
    response = client.get('/foobar2/')
    assert response.status_code == 200
    assert content(response) == "<h1>It's a BAR!</h1>"
Ejemplo n.º 2
0
def test_handling_custom_template_tags(client):
    template_paths = [rel('../tests/templates/')]

    def greeting(name):
        return f"Hello {name}"

    start('tests/fixtures/paths1.yaml', CUSTOM_TEMPLATE_DIRS=template_paths)
    response = client.get(reverse('with_templatetags'))
    assert content(response) == "greeting == Hello world"
Ejemplo n.º 3
0
def test_handling_custom_template_variables(client):
    template_paths = [rel('../tests/templates/')]
    context = {'hello': 'world'}  # NOQA
    start('tests/fixtures/paths1.yaml', CUSTOM_TEMPLATE_DIRS=template_paths)
    response = client.get(reverse('with_variables'))
    assert content(response) == "hello == world"
Ejemplo n.º 4
0
def test_custom_basic_urls_setup(client):
    start('tests/fixtures/paths1.yaml')
    assert reverse('foobar') == '/foobar2/'
    with raises(TemplateDoesNotExist):
        client.get('/foobar2/')
Ejemplo n.º 5
0
def test_basic_urls_setup():
    start()
    assert reverse('home') == '/'
Ejemplo n.º 6
0
        print("Building %s from %s" % (f, url))
        with open(f, 'w') as a_file:
            a_file.write(_response_from_the_url(url))

    print("==================")
    print("Build completed in %s" % (datetime.now() - start))


urls = [
    {
        'name': 'homepage',
        'path': '/',
        'template_name': 'index.html',
        'description': "Showe homepage"
    },
    {
        'name': 'articles',
        'path': '/articles/',
        'template_name': 'articles/list.html',
        'description': "Show all the articles"
    },
    {
        'name': 'article',
        'path': '/articles/<slug>/',
        'template_name': 'articles/detail.html',
        'description': 'Show single article'
    },
]

djamix.start(urls, locals())