예제 #1
0
    def test_allocate_ids_w_partial_key(self):
        from gcloud.datastore.test_batch import _Key
        from gcloud.datastore.test_connection import _Connection

        connection = _Connection()
        client = self._makeOne(connection=connection)
        NUM_IDS = 2

        INCOMPLETE_KEY = _Key(self.DATASET_ID)
        INCOMPLETE_KEY._id = None
        result = client.allocate_ids(INCOMPLETE_KEY, NUM_IDS)

        # Check the IDs returned.
        self.assertEqual([key._id for key in result], list(range(NUM_IDS)))
예제 #2
0
    def test_allocate_ids_w_partial_key(self):
        from gcloud.datastore.test_batch import _Key

        NUM_IDS = 2

        INCOMPLETE_KEY = _Key(self.PROJECT)
        INCOMPLETE_KEY._id = None

        creds = object()
        client = self._makeOne(credentials=creds)

        result = client.allocate_ids(INCOMPLETE_KEY, NUM_IDS)

        # Check the IDs returned.
        self.assertEqual([key._id for key in result], list(range(NUM_IDS)))
예제 #3
0
    def test_allocate_ids_w_partial_key(self):
        from gcloud.datastore.test_batch import _Key

        NUM_IDS = 2

        INCOMPLETE_KEY = _Key(self.PROJECT)
        INCOMPLETE_KEY._id = None

        creds = object()
        client = self._makeOne(credentials=creds)

        result = client.allocate_ids(INCOMPLETE_KEY, NUM_IDS)

        # Check the IDs returned.
        self.assertEqual([key._id for key in result], list(range(NUM_IDS)))