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 = [
# 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):
def initialize_gcloud(): datastore.set_defaults() storage.set_defaults()
def initialize(): datastore.set_defaults(dataset_id=DATASET_ID)