37 lines
905 B
Python
37 lines
905 B
Python
from .test_fixtures import client,app
|
|
import json
|
|
import logging
|
|
import pytest
|
|
|
|
@pytest.fixture
|
|
def index_html(client):
|
|
resp = client.get('/index/')
|
|
data= resp.get_data(as_text=True)
|
|
return data
|
|
|
|
def test_index(app,client):
|
|
# Try to get "index"
|
|
resp = client.get('index.json')
|
|
data = json.loads(resp.get_data(as_text=True))
|
|
assert resp.status_code == 200
|
|
assert data['page']['title'] == "IndexPage"
|
|
|
|
|
|
def test_index_html(app,client):
|
|
# Try to get "index"
|
|
resp = client.get('/index/')
|
|
#data= resp.get_data(as_text=True)
|
|
#app.logger.debug()
|
|
|
|
assert resp.status_code == 200
|
|
|
|
def test_links_in_index(index_html):
|
|
assert 'href="/topic1/"' in index_html
|
|
|
|
def test_text_in_index(index_html):
|
|
assert 'asdfasdfasdf' in index_html
|
|
|
|
def test_jpg(client):
|
|
resp = client.get('/topic1/test.jpg/')
|
|
assert resp.status_code == 200
|