本文整理汇总了Python中app_dashboard_data.AppDashboardData.update_users方法的典型用法代码示例。如果您正苦于以下问题:Python AppDashboardData.update_users方法的具体用法?Python AppDashboardData.update_users怎么用?Python AppDashboardData.update_users使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app_dashboard_data.AppDashboardData
的用法示例。
在下文中一共展示了AppDashboardData.update_users方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_update_users
# 需要导入模块: from app_dashboard_data import AppDashboardData [as 别名]
# 或者: from app_dashboard_data.AppDashboardData import update_users [as 别名]
def test_update_users(self):
flexmock(AppDashboardHelper).should_receive('list_all_users')\
.and_return(['[email protected]', '[email protected]', '[email protected]']).once()
flexmock(AppDashboardHelper).should_receive('is_user_cloud_admin')\
.with_args('[email protected]').and_return(True).once()
flexmock(AppDashboardHelper).should_receive('is_user_cloud_admin')\
.with_args('[email protected]').and_return(False).once()
flexmock(AppDashboardHelper).should_receive('is_user_cloud_admin')\
.with_args('[email protected]').and_return(False).once()
flexmock(AppDashboardHelper).should_receive('can_upload_apps')\
.with_args('[email protected]').and_return(True).once()
flexmock(AppDashboardHelper).should_receive('can_upload_apps')\
.with_args('[email protected]').and_return(True).once()
flexmock(AppDashboardHelper).should_receive('can_upload_apps')\
.with_args('[email protected]').and_return(False).once()
flexmock(AppDashboardHelper).should_receive('get_owned_apps')\
.with_args('[email protected]').and_return(['app1', 'app2']).once()
flexmock(AppDashboardHelper).should_receive('get_owned_apps')\
.with_args('[email protected]').and_return(['app2']).once()
flexmock(AppDashboardHelper).should_receive('get_owned_apps')\
.with_args('[email protected]').and_return(['app2']).once()
self.setupUserInfoMocks()
data1 = AppDashboardData()
output = data1.update_users()
self.assertEquals(len(output), 3)
self.assertTrue(output[0].is_user_cloud_admin)
self.assertFalse(output[1].is_user_cloud_admin)
self.assertFalse(output[2].is_user_cloud_admin)
self.assertTrue(output[0].can_upload_apps)
self.assertTrue(output[1].can_upload_apps)
self.assertFalse(output[2].can_upload_apps)
示例2: test_update_users
# 需要导入模块: from app_dashboard_data import AppDashboardData [as 别名]
# 或者: from app_dashboard_data.AppDashboardData import update_users [as 别名]
def test_update_users(self):
flexmock(ndb).should_receive('put_multi').and_return()
flexmock(AppDashboardHelper).should_receive('list_all_users')\
.and_return(['[email protected]', '[email protected]', '[email protected]', '[email protected]']).once()
flexmock(AppDashboardHelper).should_receive('is_user_cloud_admin')\
.with_args('[email protected]').and_return(True).once()
flexmock(AppDashboardHelper).should_receive('is_user_cloud_admin')\
.with_args('[email protected]').and_return(False).once()
flexmock(AppDashboardHelper).should_receive('is_user_cloud_admin')\
.with_args('[email protected]').and_return(False).once()
flexmock(AppDashboardHelper).should_receive('is_user_cloud_admin') \
.with_args('[email protected]').and_return(False).once()
flexmock(AppDashboardHelper).should_receive('can_upload_apps')\
.with_args('[email protected]').and_return(True).once()
flexmock(AppDashboardHelper).should_receive('can_upload_apps')\
.with_args('[email protected]').and_return(True).once()
flexmock(AppDashboardHelper).should_receive('can_upload_apps')\
.with_args('[email protected]').and_return(False).once()
flexmock(AppDashboardHelper).should_receive('can_upload_apps') \
.with_args('[email protected]').and_return(False).once()
flexmock(AppDashboardHelper).should_receive('get_owned_apps')\
.with_args('[email protected]').and_return(['app1', 'app2']).once()
flexmock(AppDashboardHelper).should_receive('get_owned_apps')\
.with_args('[email protected]').and_return(['app2']).once()
flexmock(AppDashboardHelper).should_receive('get_owned_apps')\
.with_args('[email protected]').and_return(['app2']).once()
flexmock(AppDashboardHelper).should_receive('get_owned_apps') \
.with_args('[email protected]').and_return([]).once()
self.setupUserInfoMocks()
data1 = AppDashboardData()
output = data1.update_users()
self.assertEquals(len(output), 4)
self.assertTrue(output[0].is_user_cloud_admin)
self.assertFalse(output[1].is_user_cloud_admin)
self.assertFalse(output[2].is_user_cloud_admin)
self.assertFalse(output[3].is_user_cloud_admin)
self.assertTrue(output[0].can_upload_apps)
self.assertTrue(output[1].can_upload_apps)
self.assertFalse(output[2].can_upload_apps)
self.assertFalse(output[3].can_upload_apps)
self.assertEqual(self.flatten_dash_layout(output[0].dash_layout_settings),
self.user_info1_cloud_admin_dict)
self.assertEqual(self.flatten_dash_layout(output[1].dash_layout_settings),
self.user_info2_can_upload_apps_dict)
self.assertEqual(self.flatten_dash_layout(output[2].dash_layout_settings),
self.user_info3_cannot_upload_apps_dict)
self.assertEqual(self.flatten_dash_layout(output[3].dash_layout_settings),
self.user_info4_cannot_upload_and_owns_no_apps_dict)