コード例 #1
0
ファイル: admin_test.py プロジェクト: eunchong/infra
 def test_gs_config_bad(self):
   auth_testing.mock_is_admin(self, True)
   with self.call_should_fail(400):
     self.call_api('gs_config', {
       'cas_gs_path': 'bucket/gs_path',
       'cas_gs_temp': '/bucket/gs_temp/'
     })
コード例 #2
0
ファイル: acl_test.py プロジェクト: eunchong/infra
 def test_has_role_admin(self):
   auth_testing.mock_is_admin(self, False)
   self.assertFalse(
       acl.has_role('package', 'OWNER', auth_testing.DEFAULT_MOCKED_IDENTITY))
   auth_testing.mock_is_admin(self, True)
   self.assertTrue(
       acl.has_role('package', 'OWNER', auth_testing.DEFAULT_MOCKED_IDENTITY))
コード例 #3
0
ファイル: admin_test.py プロジェクト: mcgreevy/chromium-infra
 def test_gs_config_bad(self):
     auth_testing.mock_is_admin(self, True)
     with self.call_should_fail(400):
         self.call_api('gs_config', {
             'cas_gs_path': 'bucket/gs_path',
             'cas_gs_temp': '/bucket/gs_temp/'
         })
コード例 #4
0
 def setUp(self):
   super(FrontendHandlersTest, self).setUp()
   self.mock(replication, 'trigger_replication', lambda *_args, **_kws: None)
   self.app = webtest.TestApp(
       handlers_frontend.create_application(debug=True),
       extra_environ={'REMOTE_ADDR': '127.0.0.1'})
   auth_testing.mock_is_admin(self, True)
   auth_testing.mock_get_current_identity(self)
コード例 #5
0
ファイル: api_test.py プロジェクト: eunchong/infra
 def setUp(self):
   super(CASServiceApiTest, self).setUp()
   auth_testing.mock_get_current_identity(self)
   auth_testing.mock_is_admin(self)
   self.cas_service = common.MockedCASService()
   def mocked_get_cas_service():
     return self.cas_service
   self.mock(impl, 'get_cas_service', mocked_get_cas_service)
コード例 #6
0
 def test_has_role_admin(self):
     auth_testing.mock_is_admin(self, False)
     self.assertFalse(
         acl.has_role('package', 'OWNER',
                      auth_testing.DEFAULT_MOCKED_IDENTITY))
     auth_testing.mock_is_admin(self, True)
     self.assertTrue(
         acl.has_role('package', 'OWNER',
                      auth_testing.DEFAULT_MOCKED_IDENTITY))
コード例 #7
0
 def setUp(self):
     super(FrontendHandlersTest, self).setUp()
     self.mock(replication, 'trigger_replication',
               lambda *_args, **_kws: None)
     self.app = webtest.TestApp(
         handlers_frontend.create_application(debug=True),
         extra_environ={'REMOTE_ADDR': '127.0.0.1'})
     auth_testing.mock_is_admin(self, True)
     auth_testing.mock_get_current_identity(self)
コード例 #8
0
    def setUp(self):
        super(CASServiceApiTest, self).setUp()
        auth_testing.mock_get_current_identity(self)
        auth_testing.mock_is_admin(self)
        self.cas_service = common.MockedCASService()

        def mocked_get_cas_service():
            return self.cas_service

        self.mock(impl, 'get_cas_service', mocked_get_cas_service)
コード例 #9
0
ファイル: admin_test.py プロジェクト: eunchong/infra
 def test_gs_config_ok(self):
   auth_testing.mock_is_admin(self, True)
   self.call_api('gs_config', GS_CONFIG)
   conf = config.GlobalConfig.fetch()
   # Strips '/'.
   self.assertEqual(conf.cas_gs_path, '/bucket/gs_path')
   self.assertEqual(conf.cas_gs_temp, '/bucket/gs_temp')
   # Second call with same data doesn't change version.
   version = conf.key.id()
   self.call_api('gs_config', GS_CONFIG)
   self.assertEqual(config.GlobalConfig.fetch().key.id(), version)
コード例 #10
0
ファイル: admin_test.py プロジェクト: eunchong/infra
 def test_service_account(self):
   auth_testing.mock_is_admin(self, True)
   self.call_api('service_account', SERVICE_ACCOUNT_INFO)
   conf = config.GlobalConfig.fetch()
   self.assertEqual(conf.service_account_email, '*****@*****.**')
   self.assertEqual(conf.service_account_pkey, 'private_key')
   self.assertEqual(conf.service_account_pkey_id, 'private_key_id')
   # Second call with same data doesn't change version.
   version = conf.key.id()
   self.call_api('service_account', SERVICE_ACCOUNT_INFO)
   self.assertEqual(config.GlobalConfig.fetch().key.id(), version)
コード例 #11
0
ファイル: admin_test.py プロジェクト: mcgreevy/chromium-infra
 def test_service_account(self):
     auth_testing.mock_is_admin(self, True)
     self.call_api('service_account', SERVICE_ACCOUNT_INFO)
     conf = config.GlobalConfig.fetch()
     self.assertEqual(conf.service_account_email, '*****@*****.**')
     self.assertEqual(conf.service_account_pkey, 'private_key')
     self.assertEqual(conf.service_account_pkey_id, 'private_key_id')
     # Second call with same data doesn't change version.
     version = conf.key.id()
     self.call_api('service_account', SERVICE_ACCOUNT_INFO)
     self.assertEqual(config.GlobalConfig.fetch().key.id(), version)
コード例 #12
0
ファイル: admin_test.py プロジェクト: mcgreevy/chromium-infra
 def test_gs_config_ok(self):
     auth_testing.mock_is_admin(self, True)
     self.call_api('gs_config', GS_CONFIG)
     conf = config.GlobalConfig.fetch()
     # Strips '/'.
     self.assertEqual(conf.cas_gs_path, '/bucket/gs_path')
     self.assertEqual(conf.cas_gs_temp, '/bucket/gs_temp')
     # Second call with same data doesn't change version.
     version = conf.key.id()
     self.call_api('gs_config', GS_CONFIG)
     self.assertEqual(config.GlobalConfig.fetch().key.id(), version)
コード例 #13
0
 def test_instance_admin(self):
     auth_testing.mock_is_admin(self, True)
     self.assertFalse(acl.is_ip_whitelisted_machine())
     self.assertTrue(acl.can_access())
     self.assertTrue(acl.can_view_config())
     self.assertTrue(acl.can_edit_config())
     self.assertTrue(acl.can_create_bot())
     self.assertTrue(acl.can_edit_bot())
     self.assertTrue(acl.can_delete_bot())
     self.assertTrue(acl.can_view_bot())
     self.assertTrue(acl.can_create_task())
     self.assertTrue(acl.can_schedule_high_priority_tasks())
     self.assertTrue(acl.can_edit_task(self._task_owned))
     self.assertTrue(acl.can_edit_task(self._task_other))
     self.assertTrue(acl.can_edit_all_tasks())
     self.assertTrue(acl.can_view_task(self._task_owned))
     self.assertTrue(acl.can_view_task(self._task_other))
     self.assertTrue(acl.can_view_all_tasks())
コード例 #14
0
 def setUp(self):
     super(ImporterTest, self).setUp()
     auth_testing.mock_is_admin(self, True)
     auth_testing.mock_get_current_identity(self)
コード例 #15
0
ファイル: admin_test.py プロジェクト: eunchong/infra
 def test_require_auth(self):
   auth_testing.mock_is_admin(self, False)
   with self.call_should_fail(403):
     self.call_api('service_account', SERVICE_ACCOUNT_INFO)
   with self.call_should_fail(403):
     self.call_api('gs_config', GS_CONFIG)
コード例 #16
0
 def setUp(self):
     super(PackageRepositoryApiTest, self).setUp()
     auth_testing.mock_get_current_identity(self)
     auth_testing.mock_is_admin(self)
     self.repo_service = MockedRepoService()
     self.mock(impl, 'get_repo_service', lambda: self.repo_service)
コード例 #17
0
 def mock_admin(self):
     auth_testing.mock_is_admin(self, True)
     auth_testing.mock_get_current_identity(self)
コード例 #18
0
ファイル: api_test.py プロジェクト: nicko96/Chrome-Infra
 def setUp(self):
     super(PackageRepositoryApiTest, self).setUp()
     auth_testing.mock_get_current_identity(self)
     auth_testing.mock_is_admin(self)
     self.repo_service = MockedRepoService()
     self.mock(impl, "get_repo_service", lambda: self.repo_service)
コード例 #19
0
 def setUp(self):
   super(ImporterTest, self).setUp()
   auth_testing.mock_is_admin(self, True)
   auth_testing.mock_get_current_identity(self)
コード例 #20
0
ファイル: admin_test.py プロジェクト: mcgreevy/chromium-infra
 def test_require_auth(self):
     auth_testing.mock_is_admin(self, False)
     with self.call_should_fail(403):
         self.call_api('service_account', SERVICE_ACCOUNT_INFO)
     with self.call_should_fail(403):
         self.call_api('gs_config', GS_CONFIG)