Esempio n. 1
0
 def test_create_telemetry(self):
     telemetry = self.repository.creat_telemetry(
         Telemetry(
             # test data
             t_type="TYPE1",
             content="TelemetryTest"))
     self.assertEqual(telemetry.t_type, 'TYPE1')
Esempio n. 2
0
 def test_retrieve_telemetry(self):
     telemetry = self.repository.creat_telemetry(
         Telemetry(
             # test data
             t_type="TYPE1",
             content="TelemetryTest"))
     self.assertEqual(telemetry.t_type, 'TYPE1')
     telemetries = self.repository.retrieve_telemetry()
     self.assertGreater(len(telemetries), 1)
Esempio n. 3
0
def create():
    identifier = get_jwt_identity()
    telemetry_parameters = request.get_json()
    telemetry_repository = TelemetryRepository()
    result = telemetry_repository.create_telemetry(
        Telemetry(creator=identifier,
                  data_type=telemetry_parameters['data_type'],
                  content=telemetry_parameters['content'],
                  created=TimestampUtility.parse(
                      telemetry_parameters['created']),
                  received=TimestampUtility.now()))
    return Response(ResponseWrapper.wrap(identifier, 'telemetry.create',
                                         result),
                    status=200,
                    mimetype='application/json')
Esempio n. 4
0
 def retrieve_telemetry(self):
     self.logger.debug("Retrieving all teleteries")
     return Telemetry.select()
Esempio n. 5
0
 def retrieve_telemetry_by_data_type(self, data_type):
     self.logger.debug(
         "Retrieving all telemetries with data type {}".format(data_type))
     return Telemetry.select().where(Telemetry.data_type == data_type)