def create_app(is_hd=True): state.set_model(is_hd) app = Flask(__name__) app.register_blueprint(index) app.config['ERROR_404_HELP'] = False api = Api(app) api.add_resource(SetProgram, '/api/program/<string:program>') api.add_resource(StopProgram, '/api/stop') atexit.register(state.stop_program) return app
def test_start_all_original(self): state.set_model(is_hd=False) for name, _ in app.programs.original.items(): with self.subTest(program=name): r = self.app.put("/api/program/" + name) self.assertEqual(r.status_code, 200)
def test_start_all_hd(self): state.set_model(is_hd=True) self.start_all(app.programs.hd.list)
def test_start_all_original(self): state.set_model(is_hd=False) self.start_all(app.programs.original.list)
def test_start_all_original(self): state.set_model(is_hd=False) for name, _ in app.programs.original.items(): with self.subTest(program=name): r = state.start_program(name) self.assertTrue(state._process.is_alive())