Ejemplo n.º 1
0
    def test_gcs_operations_transaction_data_serializer(self):
        data = self._get_data_for_model('Transaction')
        transaction_serializer = TransactionSerializer(data=data)
        required_keys = {'prefix', 'aircraft'}

        self.assertTrue(transaction_serializer.is_valid())
        self.assertEqual(set(transaction_serializer.validated_data.keys()), required_keys)
        self.assertEqual(transaction_serializer.errors, dict())
Ejemplo n.º 2
0
 def get(self, request, transaction_id):
     digitalskytransaction = get_object_or_404(Transaction,
                                               pk=transaction_id)
     serializer = TransactionSerializer(digitalskytransaction)
     return Response({
         'serializer': serializer,
         'digitalskytransaction': digitalskytransaction
     })
 def test_gcs_operations_transaction_instance_serializer(self):
     transaction_serializer = TransactionSerializer(
         instance=Transaction.objects.first())
     required_keys = {
         'id', 'prefix', 'updated_at', 'created_at', 'aircraft'
     }
     self.assertEqual(set(transaction_serializer.data.keys()),
                      required_keys)
Ejemplo n.º 4
0
 def test_gcs_operations_transaction_serializer(self):
     data = self._get_data_for_model('Transaction')
     transaction_serializer = TransactionSerializer(data=data)
     self.assertTrue(transaction_serializer.is_valid())
     self.assertNotEqual(transaction_serializer.validated_data, dict)
     self.assertEqual(transaction_serializer.errors, dict())