Beispiel #1
0
 def _callFUT(self, dataset_id=None, connection=None):
     from gcloud.datastore import set_defaults
     return set_defaults(dataset_id=dataset_id, connection=connection)
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Script to populate datastore with regression test data."""

from six.moves import zip

from gcloud import datastore

datastore._DATASET_ENV_VAR_NAME = 'GCLOUD_TESTS_DATASET_ID'
datastore.set_defaults()

ANCESTOR = ('Book', 'GoT')
RICKARD = ANCESTOR + ('Character', 'Rickard')
EDDARD = RICKARD + ('Character', 'Eddard')
KEY_PATHS = [
    RICKARD,
    EDDARD,
    ANCESTOR + ('Character', 'Catelyn'),
    EDDARD + ('Character', 'Arya'),
    EDDARD + ('Character', 'Sansa'),
    EDDARD + ('Character', 'Robb'),
    EDDARD + ('Character', 'Bran'),
    EDDARD + ('Character', 'Jon Snow'),
]
CHARACTERS = [
Beispiel #3
0
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import datetime
import pytz
import unittest2

from gcloud import datastore
# This assumes the command is being run via tox hence the
# repository root is the current directory.
from regression import populate_datastore


datastore._DATASET_ENV_VAR_NAME = 'GCLOUD_TESTS_DATASET_ID'
datastore.set_defaults()


class TestDatastore(unittest2.TestCase):

    def setUp(self):
        self.case_entities_to_delete = []

    def tearDown(self):
        with datastore.Transaction():
            keys = [entity.key for entity in self.case_entities_to_delete]
            datastore.delete(keys)


class TestDatastoreAllocateIDs(TestDatastore):
Beispiel #4
0
def initialize_gcloud():
    datastore.set_defaults()
    storage.set_defaults()
Beispiel #5
0
    def _callFUT(self, dataset_id=None, connection=None):
        from gcloud.datastore import set_defaults

        return set_defaults(dataset_id=dataset_id, connection=connection)
Beispiel #6
0
def initialize():
    datastore.set_defaults(dataset_id=DATASET_ID)
Beispiel #7
0
def initialize():
    datastore.set_defaults(dataset_id=DATASET_ID)