本文整理汇总了Python中API.APIPermissions.add_file方法的典型用法代码示例。如果您正苦于以下问题:Python APIPermissions.add_file方法的具体用法?Python APIPermissions.add_file怎么用?Python APIPermissions.add_file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类API.APIPermissions
的用法示例。
在下文中一共展示了APIPermissions.add_file方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_file_rename_file_by_key_success
# 需要导入模块: from API import APIPermissions [as 别名]
# 或者: from API.APIPermissions import add_file [as 别名]
def test_file_rename_file_by_key_success(self):
key = ps.add_file( FileInfo("testFilernfks",ndb.Key("someKey","rnfks") ) )
self.assertTrue(ps.rename_file_by_key(key,"testFilernfks2"))
fileobj = ps.get_file_by_key(key)
self.assertEqual(fileobj.file_name,"testFilernfks2")
示例2: test_file_get_files_by_owner_key_sucess
# 需要导入模块: from API import APIPermissions [as 别名]
# 或者: from API.APIPermissions import add_file [as 别名]
def test_file_get_files_by_owner_key_sucess(self):
ps.add_file( FileInfo("testFile1",ndb.Key("someKey","gfuks") ) )
ps.add_file( FileInfo("testFile2",ndb.Key("someKey","gfuks") ) )
ps.add_file( FileInfo("testFile3",ndb.Key("someKey","gfuks") ) )
ps.add_file( FileInfo("testFile4",ndb.Key("someKey","gfuks") ) )
iterate = ps.get_file_by_owner_key(ndb.Key("someKey","gfuks"))
for fileobj in iterate:
self.assertEqual(fileobj.owner_key, ndb.Key("someKey","gfuks"))
示例3: generate_gating_feedback
# 需要导入模块: from API import APIPermissions [as 别名]
# 或者: from API.APIPermissions import add_file [as 别名]
def generate_gating_feedback(status, message, new_graph_name = None, existing_name = None, new_axis_a = "FSC-A", new_axis_b = "SSC-A"):
if new_graph_name is not None:
## Authenticate and get user
authed_user = auth.get_current_user()
user_key = ps.get_user_key_by_id(authed_user.user_id())
## Get previous file permissions.
previous_file = ps.get_file_by_name(DATA_BUCKET + existing_name)
previous_permissions = ps.get_user_file_permissions(previous_file.key, user_key)
if isinstance(new_graph_name, list):
new_graph_names = new_graph_name
else:
new_graph_names = [new_graph_name]
# Overwrite new_graph_name for return dictionary
new_graph_name = new_graph_names[0]
logging.info(new_graph_name)
logging.info(new_graph_names)
for new_name in new_graph_names:
new_file = FileInfo(file_name = DATA_BUCKET + new_name,
owner_key = user_key,
friendly_name = previous_file.friendly_name + '-gate',
prev_file_key = previous_file.key,
axis_a = new_axis_a,
axis_b = new_axis_b )
file_key = ps.add_file(new_file)
ps.add_file_permissions(file_key,
user_key,
Permissions (
previous_permissions.read,
previous_permissions.write,
previous_permissions.full_control
),
previous_permissions.colour,
False)
return {
'status': status,
'message': message,
'url': reverse('get_graph', args=[new_graph_name]),
'graphName' : new_graph_name
}
示例4: test_file_get_file_by_name_success
# 需要导入模块: from API import APIPermissions [as 别名]
# 或者: from API.APIPermissions import add_file [as 别名]
def test_file_get_file_by_name_success(self):
ps.add_file( FileInfo("testFilegfns",ndb.Key("someKey","gfns") ) )
fileobj = ps.get_file_by_name("testFilegfns")
self.assertEqual(fileobj.owner_key,ndb.Key("someKey","gfns" ))
示例5: test_file_get_file_by_key_success
# 需要导入模块: from API import APIPermissions [as 别名]
# 或者: from API.APIPermissions import add_file [as 别名]
def test_file_get_file_by_key_success(self):
key = ps.add_file( FileInfo( "testFilegfks",ndb.Key("someKey","gfks") ) )
fileobj = ps.get_file_by_key(key)
self.assertEqual(fileobj.file_name,"testFilegfks")
示例6: test_file_remove_file_by_key_success
# 需要导入模块: from API import APIPermissions [as 别名]
# 或者: from API.APIPermissions import add_file [as 别名]
def test_file_remove_file_by_key_success(self):
key = ps.add_file( FileInfo("testFilerfks",ndb.Key("someKey","rfks") ) )
self.assertTrue(ps.remove_file_by_key(key))
示例7: test_file_add_file
# 需要导入模块: from API import APIPermissions [as 别名]
# 或者: from API.APIPermissions import add_file [as 别名]
def test_file_add_file(self):
ret = ps.add_file( FileInfo("testFileaf",ndb.Key("someKey","af") ) )
self.assertTrue(isinstance(ret, ndb.Key))