示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 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)
示例#4
0
 def create_app(self):
     """Create an instance of the flask_app for the Flask Testing API."""
     napp = app.NetifyApp()
     return napp.flask_app
示例#5
0
 def test_description(self):
     """Verify the string description property of the netify object."""
     napp = app.NetifyApp()
     self.assertIsInstance(napp.description, str)
示例#6
0
 def test_init_config(mock_configure):
     """Test that the configure method is called passed to constructor."""
     app.NetifyApp(config=Mock())
     mock_configure.assert_called()
示例#7
0
 def test_singleton(self):
     """Verify that NetifyApp is a signleton."""
     self.assertEqual(app.NetifyApp().flask_app, self.app)