Example #1
0
 def test_fuel_battery(self):
     for id in ids:
         response1 = sc.get_fuel(id)
         response2 = sc.get_battery(id)
         self.assertNotEqual(response1,
                             'Status code other than 200 received!')
         self.assertNotEqual(response2,
                             'Status code other than 200 received!')
Example #2
0
 def get(self, request, id):
     info = sc.get_battery(id)
     if info == 'Status code other than 200 received!':
         response = Response()
         response.status_code = 404
         return response
     battery = Battery()
     battery.percent = info['percent']
     serializer = BatterySerializer(battery)
     return Response(serializer.data)