def testFetchTestRollupOutcome_HttpErrorOccurs(self):
        summary_fetcher = self._createResultsSummaryFetcher()
        self.tr_client.projects_histories_executions.Get.Expect(
            request=self._createHistoriesExecutionsRequest(),
            exception=test_utils.MakeHttpError(
                'kablooie',
                "Outcome? We don't need no stinkin' rollup outcome."))

        with self.assertRaises(calliope_exceptions.HttpException):
            summary_fetcher.FetchMatrixRollupOutcome()
  def testIosVersionsList_ApiThrowsHttpError(self):
    err = test_utils.MakeHttpError('Error9', 'Environment catalog failure.')
    self.ExpectIosCatalogGetError(err)

    with self.assertRaises(exceptions.HttpException):
      self.Run(commands.IOS_VERSIONS_LIST)

    self.AssertOutputEquals('')
    self.AssertErrMatches(r'(gcloud.*firebase.test.ios.versions.list)')
    self.AssertErrContains('Environment catalog failure.')
Exemple #3
0
  def testAndroidVersionsList_ApiThrowsHttpError(self):
    err = test_utils.MakeHttpError('Error9', 'Environment catalog failure.')
    self.ExpectCatalogGetError(err)

    with self.assertRaises(exceptions.HttpException):
      self.Run(commands.ANDROID_VERSIONS_LIST)

    self.AssertOutputEquals('')
    self.AssertErrContains('(gcloud.firebase.test.android.versions.list)')
    self.AssertErrContains('Environment catalog failure.')
  def testAndroidModelsDescribe_ApiThrowsHttpError(self):
    err = test_utils.MakeHttpError('ErrorXYZ', 'Environment catalog failure.')
    self.ExpectCatalogGetError(err)

    with self.assertRaises(calliope_exceptions.HttpException):
      self.Run(commands.ANDROID_MODELS_DESCRIBE + 'a-model')

    self.AssertOutputEquals('')
    self.AssertErrMatches(r'(gcloud.*.test.android.models.describe)')
    self.AssertErrContains('Environment catalog failure.')
Exemple #5
0
    def testAndroidLocalesList_ApiThrowsHttpError(self):
        err = test_utils.MakeHttpError('Failure 3',
                                       'Environment catalog missing.')
        self.ExpectCatalogGetError(err)

        with self.assertRaises(exceptions.HttpException):
            self.Run(commands.ANDROID_LOCALES_LIST)

        self.AssertOutputEquals('')
        self.AssertErrMatches(r'(gcloud.*.test.*locales\.list)')
        self.AssertErrContains('Environment catalog missing.')
    def testNetworkProfilesDescribe_ApiThrowsHttpError(self):
        err = test_utils.MakeHttpError('Error9',
                                       'Environment catalog failure.')
        self.ExpectNetworkCatalogGetError(err)

        with self.assertRaises(calliope_exceptions.HttpException):
            self.Run(commands.NETWORK_PROFILES_DESCRIBE + 'LTE_nonexistent')

        self.AssertOutputEquals('')
        self.AssertErrMatches(r'(gcloud.*.test.network-profiles.describe)')
        self.AssertErrContains('Environment catalog failure.')
    def testNetworkProfilesList_ApiThrowsHttpError(self):
        err = test_utils.MakeHttpError('Error9',
                                       'Environment catalog failure.')
        self.ExpectNetworkCatalogGetError(err)

        with self.assertRaises(exceptions.HttpException):
            self.Run(commands.NETWORK_PROFILES_LIST)

        self.AssertOutputEquals('')
        self.AssertErrMatches(r'(gcloud.*.test.network-profiles\.list)')
        self.AssertErrContains('Environment catalog failure.')
    def testMatrixCreator_CreateIosTestMatrix_GetsHttpError(self):
        creator = self.CreateMatrixCreator(self.args)
        self.testing_client.projects_testMatrices.Create.Expect(
            request=creator._BuildTestMatrixRequest('id-6'),
            exception=test_utils.MakeHttpError(
                'zergFailure', 'Simulated failure to create test execution.'))

        # An HttpError from the rpc should be converted to an HttpException
        with self.assertRaises(exceptions.HttpException):
            creator.CreateTestMatrix('id-6')
        self.AssertOutputEquals('')
        self.AssertErrEquals('')
    def testMatrixMonitor_GetTestExecutionStatus_GetsHttpError(self):
        matrix_id = 'kam'
        monitor = self.CreateMatrixMonitor(matrix_id, self.args)

        self.testing_client.projects_testMatrices.Get.Expect(
            request=TESTING_V1_MESSAGES.TestingProjectsTestMatricesGetRequest(
                projectId=self.PROJECT_ID, testMatrixId=matrix_id),
            exception=test_utils.MakeHttpError(
                'notFound', 'Simulated failure to get test execution status.'))

        # An HttpError from the rpc should be converted to an HttpException
        with self.assertRaises(calliope_exceptions.HttpException):
            monitor._GetTestExecutionStatus('legion-of-boom-test-id')
    def testMatrixMonitor_CancelTestMatrix_GetsHttpError(self):
        matrix_id = 'matrix-206'
        monitor = self.CreateMatrixMonitor(matrix_id, self.args)
        self.testing_client.projects_testMatrices.Cancel.Expect(
            request=self.testing_msgs.TestingProjectsTestMatricesCancelRequest(
                projectId=self.PROJECT_ID, testMatrixId=matrix_id),
            exception=test_utils.MakeHttpError('oops',
                                               'Simulated cancel failure'))

        # An HttpError from the rpc should be converted to an HttpException
        with self.assertRaises(calliope_exceptions.HttpException) as ex_ctx:
            monitor.CancelTestMatrix()
        self.assertIn('Simulated cancel failure', ex_ctx.exception.message)
Exemple #11
0
    def testResultsBucketOps_GetDefaultBucket_GetsHttp403Error(self):
        request = (
            self.toolresults_msgs.ToolresultsProjectsInitializeSettingsRequest(
                projectId=self.PROJECT_ID))
        self.tr_client.projects.InitializeSettings.Expect(
            request=request,
            exception=test_utils.MakeHttpError('choked',
                                               'Bucket access denied', 403))

        with self.assertRaises(exceptions.HttpException) as e:
            self._CreateBucketOps(None)

        msg = str(e.exception)
        self.assertIn('403: Bucket access denied', msg)
        self.assertIn('billing enabled', msg)
Exemple #12
0
    def testResultsBucketOps_GetDefaultBucket_GetsHttp404Error(self):
        request = (
            self.toolresults_msgs.ToolresultsProjectsInitializeSettingsRequest(
                projectId=self.PROJECT_ID))
        self.tr_client.projects.InitializeSettings.Expect(
            request=request,
            exception=test_utils.MakeHttpError(
                'borked', 'Simulated failure to get default bucket.'))

        with self.assertRaises(exceptions.HttpException) as e:
            self._CreateBucketOps(None)

        msg = str(e.exception)
        self.assertIn('Http error while trying to fetch the default', msg)
        self.assertIn('Simulated failure to get default bucket', msg)