当前位置: 首页>>代码示例>>Python>>正文


Python AppDashboardData.update_users方法代码示例

本文整理汇总了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)
开发者ID:0xmilk,项目名称:appscale,代码行数:37,代码来源:test_app_dashboard_data.py

示例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)
开发者ID:menivaitsi,项目名称:appscale,代码行数:55,代码来源:test_app_dashboard_data.py


注:本文中的app_dashboard_data.AppDashboardData.update_users方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。