def test_configure_obj(self, mock_update_flask): """Verify the configure method accepts a config object.""" config_obj = config.Config('blah/blah/blah') napp = app.NetifyApp() napp.configure(config_obj) self.assertEqual(napp.config, config_obj) self.assertTrue(mock_update_flask.called)
def test_configure_path(self, mock_update_flask): """Verify the configure method accepts a config path.""" path = 'some/fake/path' napp = app.NetifyApp() napp.configure(path) self.assertIsInstance(napp.config, config.Config) self.assertTrue(mock_update_flask.called)
def test_run(mflask_app): """Verify the run method behaves as expected.""" host = 'host' port = 8080 debug = True napp = app.NetifyApp() napp.run(host, port, debug) mflask_app.run.assert_called_once_with(host, port, debug)
def create_app(self): """Create an instance of the flask_app for the Flask Testing API.""" napp = app.NetifyApp() return napp.flask_app
def test_description(self): """Verify the string description property of the netify object.""" napp = app.NetifyApp() self.assertIsInstance(napp.description, str)
def test_init_config(mock_configure): """Test that the configure method is called passed to constructor.""" app.NetifyApp(config=Mock()) mock_configure.assert_called()
def test_singleton(self): """Verify that NetifyApp is a signleton.""" self.assertEqual(app.NetifyApp().flask_app, self.app)