Exemple #1
0
    def test_batching(self):
        delivery_request = create_delivery_request()

        with Firestore.batch('packages') as batch:
            dr_dict = delivery_request.to_dict()
            uid = batch.create_with_random_id(dr_dict)
            batch.update(uid, {
                'status': Status.ACCEPTED,
                'assistant': 'pIAeLAvHXp0KZKWDzTMz'
            })
            batch.set(uid, dr_dict)

        self.assertTrue(
            any(request.to_dict()['uid'] == "TEST"
                for request in Firestore.get('packages')))

        with Firestore.batch('packages') as batch:
            batch.delete(uid)
Exemple #2
0
 def test_get_packages(self):
     delivery_requests = Firestore.get("packages")
     for delivery_request in delivery_requests:
         self.assertIsNotNone(delivery_request.get("item"))