def test_cloto_client(self): """Tests if method gets a window size from fiware-cloto component.""" import facts.cloto_db_client as Cloto cloto = Cloto.cloto_db_client() cloto.conn = self.mockedClient response = cloto.get_window_size(self.tenantId) self.assertEqual(response, 5)
def test_cloto_client_no_connection(self, mock_mysql, mock_logging): """Tests if method fails when try to get a window size of a fake tenantId from fiware-cloto component.""" import facts.cloto_db_client as Cloto cloto = Cloto.cloto_db_client() try: response = cloto.get_window_size(self.tenantId) except NotFound as ex: self.assertTrue(mock_mysql.connect.called) self.assertTrue(mock_logging.error.called) self.assertRaises(ex)
from facts.config import config, cfg_filename, cfg_defaults """Flask server initialization. Uses Redis server as a message queue and server exchange with the fiware-cloto. """ app = Flask(__name__) """ Initialize the redis connection library """ mredis = myredis() """ Initialize the mysql connection library """ myClotoDBClient = cloto_db_client.cloto_db_client() """ Initialize the pid of the process """ pid = 0 # Flask/Gevent server need to send {'serverId': 'serverId', 'cpu': 80, 'mem': 80, 'time': '2014-03-24 16:21:29.384631'} # to the topic @app.route('/v1.0', methods=['GET']) def factsinfo(): """API endpoint for receiving keep alive information """ return Response(response="{\"fiware-facts\":\"Up and running...\"}\n", status=httplib.OK,
"""Flask server initialization. Uses Redis server as a message queue and server exchange with the fiware-cloto. """ app = Flask(__name__) """ Initialize the redis connection library """ mredis = myredis() """ Initialize the mysql connection library """ myClotoDBClient = cloto_db_client.cloto_db_client() """ Initialize the pid of the process """ pid = 0 # Flask/Gevent server need to send {'serverId': 'serverId', 'cpu': 80, 'mem': 80, 'time': '2014-03-24 16:21:29.384631'} # to the topic @app.route('/v1.0', methods=['GET']) def factsinfo(): """API endpoint for receiving keep alive information """ return Response(response="{\"fiware-facts\":\"Up and running...\"}\n",