Add offline mode for Semantic UI.

Following a similar guide to:
https://github.com/Semantic-Org/Semantic-UI/issues/1521

Using a new endpoint to handle offline mode to host semantic.min.css and
other CSS files.  Need to wrap these in templates to provide URL for
static font files when hosting under a directory.
This commit is contained in:
Mike Terzo
2017-07-07 17:01:33 -04:00
parent 548599bc59
commit e5c9b300ef
11 changed files with 78 additions and 2 deletions

View File

@@ -266,6 +266,9 @@ def test_offline_mode(client, mocker):
assert soup.title.contents[0] == 'Puppetboard'
for link in soup.find_all('link'):
assert "//" not in link['href']
if 'offline' in link['href']:
static_rv = client.get(link['href'])
assert rv.status_code == 200
for script in soup.find_all('script'):
if "src" in script.attrs:
@@ -821,3 +824,16 @@ def test_node_facts_json(client, mocker,
assert len(line) == 2
assert 'chart' not in result_json
def test_offline_static(client):
rv = client.get('/offline/css/google_fonts.css')
assert 'Content-Type' in rv.headers
assert 'text/css' in rv.headers['Content-Type']
assert rv.status_code == 200
rv = client.get('/offline/Semantic-UI-2.1.8/semantic.min.css')
assert 'Content-Type' in rv.headers
assert 'text/css' in rv.headers['Content-Type']
assert rv.status_code == 200