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!')
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)