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


Python app_dashboard_data.AppDashboardData类代码示例

本文整理汇总了Python中app_dashboard_data.AppDashboardData的典型用法代码示例。如果您正苦于以下问题:Python AppDashboardData类的具体用法?Python AppDashboardData怎么用?Python AppDashboardData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AppDashboardData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_application_info

 def test_get_application_info(self):
   self.setupAppStatusMocks()
   data1 = AppDashboardData()
   output = data1.get_application_info()
   self.assertEquals(len(output), 2)
   self.assertEquals(output['app1'], 'http://1.1.1.1:8080')
   self.assertEquals(output['app2'], None)
开发者ID:0xmilk,项目名称:appscale,代码行数:7,代码来源:test_app_dashboard_data.py

示例2: test_get_status_info

 def test_get_status_info(self):
   self.setupServerStatusMocks()
   data1 = AppDashboardData()
   output = data1.get_status_info()
   self.assertEquals(len(output), 2)
   self.assertEquals(output[0]['ip'], '1.1.1.1')
   self.assertEquals(output[1]['ip'], '2.2.2.2')
开发者ID:0xmilk,项目名称:appscale,代码行数:7,代码来源:test_app_dashboard_data.py

示例3: test_update_users

  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,代码行数:35,代码来源:test_app_dashboard_data.py

示例4: test_get_owned_apps

  def test_get_owned_apps(self):
    # slip in some fake users
    self.setupUserInfoMocks()

    # mock out the App Engine Users API
    self.setupUsersAPIMocks()

    data1 = AppDashboardData()

    # First call, not logged in.
    output = data1.get_owned_apps()
    self.assertEqual(len(output), 0)

    # First user: [email protected], apps=app1,app2
    output = data1.get_owned_apps()
    self.assertTrue('app1' in output)
    self.assertTrue('app2' in output)

    # Second user: [email protected], apps=app2
    output = data1.get_owned_apps()
    self.assertTrue('app2' in output)

    # Third user: [email protected], admin=app2.
    output = data1.get_owned_apps()
    self.assertTrue('app2' in output)
开发者ID:0xmilk,项目名称:appscale,代码行数:25,代码来源:test_app_dashboard_data.py

示例5: test_update_status_info

 def test_update_status_info(self):
   self.setupServerStatusMocks()
   self.setupFakePutsAndDeletes()
   fake_get_appcontroller_client = flexmock()
   fake_get_appcontroller_client.should_receive('get_stats') \
     .and_return([
       {'ip' : '1.1.1.1',
        'cpu' : '50',
        'memory' : '50',
        'disk' : '50',
        'roles' : 'roles1'},
       {'ip' : '2.2.2.2',
        'cpu' : '50',
        'memory' : '50',
        'disk' : '50',
        'roles' : 'roles1'}
     ])
   flexmock(AppDashboardHelper).should_receive('get_appcontroller_client') \
     .and_return(fake_get_appcontroller_client).once()
   
   data1 = AppDashboardData()
   data1.update_status_info()
   output = data1.get_status_info()
   self.assertEquals(len(output), 2)
   self.assertEquals(output[0]['ip'], '1.1.1.1')
   self.assertEquals(output[1]['ip'], '2.2.2.2')
开发者ID:0xmilk,项目名称:appscale,代码行数:26,代码来源:test_app_dashboard_data.py

示例6: test_get_api_status

 def test_get_api_status(self):
   self.setupApiStatusMocks()
   data1 = AppDashboardData()
   output = data1.get_api_status()
   self.assertEquals(len(output), 3)
   self.assertEquals(output['api1'], 'running')
   self.assertEquals(output['api2'], 'failed')
   self.assertEquals(output['api3'], 'unknown')
开发者ID:0xmilk,项目名称:appscale,代码行数:8,代码来源:test_app_dashboard_data.py

示例7: test_get_monitoring_url

  def test_get_monitoring_url(self):
    fake_ip  = '1.1.1.1.'
    flexmock(AppDashboardData).should_receive('get_head_node_ip')\
    .and_return(fake_ip).once()

    data1 = AppDashboardData()
    url = data1.get_monitoring_url()
    self.assertEquals(url, "http://{0}:{1}".format(fake_ip, 
      AppDashboardData.MONITOR_PORT))
开发者ID:0xmilk,项目名称:appscale,代码行数:9,代码来源:test_app_dashboard_data.py

示例8: test_delete_app_from_datastore

 def test_delete_app_from_datastore(self):
   flexmock(logging).should_receive('info').and_return()
   self.setupUserInfoMocks()
   self.setupAppStatusMocks()
   data1 = AppDashboardData()
   output = data1.delete_app_from_datastore('app2', email='[email protected]')
   app_list = output.owned_apps
   self.assertEquals(output.email, '[email protected]')
   self.assertFalse('app2' in app_list)
   self.assertTrue('app1' in app_list)
开发者ID:0xmilk,项目名称:appscale,代码行数:10,代码来源:test_app_dashboard_data.py

示例9: test_update_users

  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,代码行数:53,代码来源:test_app_dashboard_data.py

示例10: get

 def get(self):
   """ Retrieves the cached information about applications running in this
   AppScale deployment as a JSON-encoded dict. """
   is_cloud_admin = AppDashboardHelper().is_user_cloud_admin()
   apps_user_is_admin_on = AppDashboardData().get_application_info()
   if not is_cloud_admin:
     apps_user_owns = AppDashboardHelper().get_owned_apps()
     new_app_dict = {}
     for app_name in apps_user_owns:
       if app_name in apps_user_is_admin_on:
         new_app_dict[app_name] = apps_user_is_admin_on.get(app_name)
     apps_user_is_admin_on = new_app_dict
   self.response.out.write(json.dumps(apps_user_is_admin_on))
开发者ID:,项目名称:,代码行数:13,代码来源:

示例11: test_update_application_info_no_apps

  def test_update_application_info_no_apps(self):
    flexmock(AppDashboardHelper).should_receive('get_status_info')\
      .and_return([{
        'apps' : { 'none' :  False }
      }]).once()
    flexmock(AppDashboardHelper).should_receive('get_login_host')\
      .and_return('1.1.1.1').never()
    flexmock(AppDashboardHelper).should_receive('get_app_port')\
      .and_return('8080').never()
    self.setupAppStatusMocks()
    self.setupFakePutsAndDeletes()

    data1 = AppDashboardData()
    output = data1.update_application_info()
    self.assertEquals(len(output), 0)
开发者ID:0xmilk,项目名称:appscale,代码行数:15,代码来源:test_app_dashboard_data.py

示例12: test_update_application_info_two_apps

  def test_update_application_info_two_apps(self):
    flexmock(AppDashboardHelper).should_receive('get_status_info')\
      .and_return([{
        'apps' : { 'app1' : True, 'app2' : False }
      }]).once()
    flexmock(AppDashboardHelper).should_receive('get_login_host')\
      .and_return('1.1.1.1').once()
    flexmock(AppDashboardHelper).should_receive('get_app_ports')\
      .and_return(['8080', '1444']).once()
    self.setupAppStatusMocks()
    self.setupFakePutsAndDeletes()

    data1 = AppDashboardData()
    output = data1.update_application_info()
    self.assertEquals(len(output), 2)
    self.assertEquals(output['app1'], ['http://1.1.1.1:8080',
                                       'https://1.1.1.1:1444'])
    self.assertEquals(output['app2'], None)
开发者ID:daxiaxia,项目名称:appscale,代码行数:18,代码来源:test_app_dashboard_data.py

示例13: test_can_upload_apps

  def test_can_upload_apps(self):
    # slip in some fake users
    self.setupUserInfoMocks()

    # mock out the App Engine Users API
    self.setupUsersAPIMocks()

    data1 = AppDashboardData()

    # First call, not logged in.
    self.assertFalse(data1.can_upload_apps())

    # First user: [email protected], upload=True.
    self.assertTrue(data1.can_upload_apps())

    # Second user: [email protected], upload=True.
    self.assertTrue(data1.can_upload_apps())

    # Third user: [email protected], upload=False.
    self.assertFalse(data1.can_upload_apps())
开发者ID:0xmilk,项目名称:appscale,代码行数:20,代码来源:test_app_dashboard_data.py

示例14: test_is_user_cloud_admin

  def test_is_user_cloud_admin(self):
    # slip in some fake users
    self.setupUserInfoMocks()

    # mock out the App Engine Users API
    self.setupUsersAPIMocks()

    data1 = AppDashboardData()

    # First call, not logged in.
    self.assertFalse(data1.is_user_cloud_admin())

    # First user: [email protected], admin=True.
    self.assertTrue(data1.is_user_cloud_admin())

    # Second user: [email protected], admin=False.
    self.assertFalse(data1.is_user_cloud_admin())

    # Third user: [email protected], admin=False.
    self.assertFalse(data1.is_user_cloud_admin())
开发者ID:0xmilk,项目名称:appscale,代码行数:20,代码来源:test_app_dashboard_data.py

示例15: test_update_api_status

 def test_update_api_status(self):
   self.setupApiStatusMocks()
   self.setupFakePutsAndDeletes()
   fake_get_appcontroller_client = flexmock()
   fake_get_appcontroller_client.should_receive('get_api_status')\
     .and_return({
       'api1' : 'running',
       'api2' : 'failed',
       'api3' : 'unknown',
     })
   flexmock(AppDashboardHelper).should_receive('get_appcontroller_client')\
     .and_return(fake_get_appcontroller_client).once()
   
   data1 = AppDashboardData()
   data1.update_api_status()
   output = data1.get_api_status()
   self.assertEquals(len(output), 3)
   self.assertEquals(output['api1'], 'running')
   self.assertEquals(output['api2'], 'failed')
   self.assertEquals(output['api3'], 'unknown')
开发者ID:0xmilk,项目名称:appscale,代码行数:20,代码来源:test_app_dashboard_data.py


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