def update_file(file_name, content): file_path = os.path.abspath(os.path.dirname(__file__)) path = os.path.join(file_path, 'content/', file_name) with open(path, 'w') as f: f.write(content) cache.clear()
def test_routes(): response = client.get('/') assert response.status_code == 200 response = client.get('/test_routes') assert response.status_code == 404 content = ('This is my unit test. ' 'There are many like it but this one is mine') with temp_file('manufactorum/templates/_test_routes.html', content): response = client.get('/test_routes') assert response.data.decode('utf8') == content cache.clear() response = client.get('/test_routes') assert response.status_code == 404