def test_home_page_returns_correct_html(self): request = HttpRequest() response = index(request) self.assertTrue(response.content.startswith(b'<!DOCTYPE html>')) self.assertTrue(response.content.endswith(b'</html>'), msg=str(response.content)) self.assertIn(b'<title>RD Emprende</title>', response.content)
def test_main_app(): # Fetch index resp = views.index() # Check that app returns 200 with response content length > 0 assert resp.status_code == 200 assert len(resp.data) > 0
def test_main_api_page(self): """Test for app.views.index""" with app.test_request_context(): server_info = dict(json.loads(index().data)) self.assertTrue('name' in server_info and 'type' in server_info and 'status' in server_info and 'version' in server_info and server_info['version'] == VERSION, msg="Can't get basic server info.")
def test_index_status_code(self): url = index(requests) self.assertEqual(url.status_code, 200)
def test_index_verify_response(self): url = index(requests) self.assertEqual(url.content, b'Hello World!')
def index(): return views.index()
#!flask/bin/python from app import app from app import views app.run(debug=True) if __name__ == '__main__': views.index()
from app.views.index import * from app.controllers.application_controller import * import os while True: i = index() if int(i) == 1: application_controller.new() elif int(i) == 2: application_controller.all_() elif int(i) == 3: application_controller.update() elif int(i) == 4: application_controller.delete() os.system("black config/root.py")