コード例 #1
0
 def testPrepareBinhostUploadsNonGsUri(self):
     """PrepareBinhostUploads dies when URI does not point to GS."""
     input_proto = binhost_pb2.PrepareBinhostUploadsRequest()
     input_proto.build_target.name = 'target'
     input_proto.uri = 'https://foo.bar'
     with self.assertRaises(ValueError):
         binhost.PrepareBinhostUploads(input_proto, self.response,
                                       self.api_config)
コード例 #2
0
 def testPrepareBinhostUploads(self):
     """PrepareBinhostUploads returns Packages and tar files."""
     input_proto = binhost_pb2.PrepareBinhostUploadsRequest()
     input_proto.build_target.name = 'target'
     input_proto.uri = 'gs://chromeos-prebuilt/target'
     binhost.PrepareBinhostUploads(input_proto, self.response,
                                   self.api_config)
     self.assertEqual(self.response.uploads_dir, '/build/target/packages')
     self.assertCountEqual([ut.path for ut in self.response.upload_targets],
                           ['Packages', 'foo.tbz2', 'bar.tbz2'])
コード例 #3
0
    def testValidateOnly(self):
        """Sanity check that a validate only call does not execute any logic."""
        patch = self.PatchObject(binhost_service, 'GetPrebuiltsRoot')

        request = binhost_pb2.PrepareBinhostUploadsRequest()
        request.build_target.name = 'target'
        request.uri = 'gs://chromeos-prebuilt/target'
        rc = binhost.PrepareBinhostUploads(request, self.response,
                                           self.validate_only_config)
        patch.assert_not_called()
        self.assertEqual(rc, 0)
コード例 #4
0
    def testMockCall(self):
        """Test that a mock call does not execute logic, returns mocked value."""
        patch = self.PatchObject(binhost_service, 'GetPrebuiltsRoot')

        request = binhost_pb2.PrepareBinhostUploadsRequest()
        request.build_target.name = 'target'
        request.uri = 'gs://chromeos-prebuilt/target'
        rc = binhost.PrepareBinhostUploads(request, self.response,
                                           self.mock_call_config)
        self.assertEqual(self.response.uploads_dir, '/upload/directory')
        self.assertEqual(self.response.upload_targets[0].path, 'upload_target')
        patch.assert_not_called()
        self.assertEqual(rc, 0)