本文整理汇总了Python中dart.client.python.dart_client.Dart.get_datastore方法的典型用法代码示例。如果您正苦于以下问题:Python Dart.get_datastore方法的具体用法?Python Dart.get_datastore怎么用?Python Dart.get_datastore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dart.client.python.dart_client.Dart
的用法示例。
在下文中一共展示了Dart.get_datastore方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestDatastoreCrud
# 需要导入模块: from dart.client.python.dart_client import Dart [as 别名]
# 或者: from dart.client.python.dart_client.Dart import get_datastore [as 别名]
class TestDatastoreCrud(unittest.TestCase):
def setUp(self):
self.dart = Dart(host='localhost', port=5000)
def test_crud(self):
dst = Datastore(data=DatastoreData(
name='test-datastore',
engine_name='no_op_engine',
args={'action_sleep_time_in_seconds': 0},
tags=['foo']
))
posted_datastore = self.dart.save_datastore(dst)
# copy fields that are populated at creation time
dst.data.s3_artifacts_path = posted_datastore.data.s3_artifacts_path
dst.data.s3_logs_path = posted_datastore.data.s3_logs_path
dst.data.user_id = posted_datastore.data.user_id
self.assertEqual(posted_datastore.data.to_dict(), dst.data.to_dict())
datastore = self.dart.get_datastore(posted_datastore.id)
self.assertEqual(posted_datastore.to_dict(), datastore.to_dict())
datastore.data.engine_name = 'not_existing_engine'
datastore.data.state = DatastoreState.ACTIVE
put_datastore = self.dart.save_datastore(datastore)
# not all properties can be modified
self.assertEqual(put_datastore.data.engine_name, 'no_op_engine')
self.assertEqual(put_datastore.data.state, DatastoreState.ACTIVE)
self.assertNotEqual(posted_datastore.to_dict(), put_datastore.to_dict())
self.dart.delete_datastore(datastore.id)
try:
self.dart.get_datastore(datastore.id)
except DartRequestException as e:
self.assertEqual(e.response.status_code, 404)
return
self.fail('datastore should have been missing after delete!')
示例2: Dart
# 需要导入模块: from dart.client.python.dart_client import Dart [as 别名]
# 或者: from dart.client.python.dart_client.Dart import get_datastore [as 别名]
from dart.client.python.dart_client import Dart
from dart.model.datastore import Datastore, DatastoreState
if __name__ == '__main__':
dart = Dart('localhost', 5000)
assert isinstance(dart, Dart)
datastore = dart.get_datastore('KNMUGQWTHT')
assert isinstance(datastore, Datastore)
datastore.data.state = DatastoreState.ACTIVE
dart.save_datastore(datastore)