def test_gcs_operations_flight_permission_data_serializer(self): data = self._get_data_for_model('FlightPermission') flight_permission_serializer = FlightPermissionSerializer(data=data) required_keys = {'token'} self.assertTrue(flight_permission_serializer.is_valid()) self.assertEqual(set(flight_permission_serializer.validated_data.keys()), required_keys) self.assertEqual(flight_permission_serializer.errors, dict())
def get(self, request, flightpermission_id): flightpermission = get_object_or_404(FlightPermission, pk=flightoperation_id) serializer = FlightPermissionSerializer(flightpermission) return Response({ 'serializer': serializer, 'flightpermission': flightpermission })
def test_gcs_operations_flight_permission_instance_serializer(self): flight_permission_serializer = FlightPermissionSerializer( instance=FlightPermission.objects.first()) required_keys = { 'id', 'updated_at', 'operation', 'status_code', 'token', 'created_at' } self.assertEqual(set(flight_permission_serializer.data.keys()), required_keys)
def test_gcs_operations_flight_permission_serializer(self): data = self._get_data_for_model('FlightPermission') flight_permission_serializer = FlightPermissionSerializer(data=data) self.assertTrue(flight_permission_serializer.is_valid()) self.assertNotEqual(flight_permission_serializer.validated_data, dict) self.assertEqual(flight_permission_serializer.errors, dict())