Esempio n. 1
0
def getActiveQhawaxModeCustomer():
    """To get all active qHAWAXs that are in field in mode costumer - No parameters required"""
    try:
        customer_qhawaxs = get_business_helper.queryQhawaxModeCustomer()
        if customer_qhawaxs != []:
            return make_response(jsonify(customer_qhawaxs), 200)
        return make_response(jsonify({"Warning": "qHAWAXs not found"}), 400)
    except TypeError as e:
        json_message = jsonify({"error": " '%s' " % (e)})
        return make_response(json_message, 400)
Esempio n. 2
0
def getActiveQhawaxModeCustomer():
    """
    To get all active qHAWAXs that are in field in mode costumer
    No parameters required
    """
    try:
        qhawaxs = get_business_helper.queryQhawaxModeCustomer()
        if qhawaxs != []:
            qhawaxs_list = [qhawax._asdict() for qhawax in qhawaxs]
            return make_response(jsonify(qhawaxs_list), 200)
        return make_response({'Warning': 'There are no qHAWAXs in field'}, 200)
    except TypeError as e:
        json_message = jsonify({'error': ' \'%s\' ' % (e)})
        return make_response(json_message, 400)
Esempio n. 3
0
 def test_query_qhawax_mode_customer_valid(self):
     y = [{
         'name': 'qH021',
         'mode': 'Customer',
         'state': 'ON',
         'qhawax_type': 'STATIC',
         'main_inca': 100.0,
         'id': 327,
         'qhawax_id': 307,
         'eca_noise_id': 3,
         'comercial_name':
         'Universidad Nacional de San Antonio Abad del Cusco',
         'lat': -12.598634,
         'lon': -69.187518,
         'area_name': 'Comercial Zone'
     }]
     self.assertAlmostEqual(get_business_helper.queryQhawaxModeCustomer(),
                            [])
 def test_query_qhawax_mode_customer_valid(self):
     y = [
         {
             "name": "qH021",
             "mode": "Customer",
             "state": "ON",
             "qhawax_type": "STATIC",
             "main_inca": 100.0,
             "id": 327,
             "qhawax_id": 307,
             "eca_noise_id": 3,
             "comercial_name": "Universidad Nacional de San Antonio Abad del Cusco",
             "lat": -12.598634,
             "lon": -69.187518,
             "area_name": "Comercial Zone",
         }
     ]
     self.assertAlmostEqual(
         get_business_helper.queryQhawaxModeCustomer(), []
     )
Esempio n. 5
0
 def test_query_qhawax_mode_customer_valid(self):
     y = [(4, 'qH004', 50.0, 'STATIC', 'Test Aguitas 2.0',
           'Zona de Protección Especial')]
     self.assertAlmostEqual(get_business_helper.queryQhawaxModeCustomer(),
                            [])