def test_setup_regular_build(self): """Test setup_regular_build.""" request = untrusted_runner_pb2.SetupRegularBuildRequest( base_build_dir='/base', revision=1337, build_url='https://build/url.zip', target_weights={ 'bad_target': 0.1, 'normal_target': 1.0 }) self.mock.regular_build_setup.side_effect = _mock_regular_build_setup response = build_setup.setup_regular_build(request) self.assertTrue(response.result) self.assertEqual(response.app_path, '/release/bin/app') self.assertEqual(response.app_path_debug, '') self.assertEqual(response.app_dir, '/release/bin') self.assertEqual(response.build_dir, '/release') self.assertEqual(response.build_url, 'https://build/url.zip') self.mock.regular_build_setup.side_effect = _failed_setup response = build_setup.setup_regular_build(request) self.assertFalse(response.result) self.assertFalse(response.HasField('app_path')) self.assertFalse(response.HasField('app_path_debug')) self.assertFalse(response.HasField('app_dir')) self.assertFalse(response.HasField('build_dir')) self.assertFalse(response.HasField('build_url'))
def setup(self): request = untrusted_runner_pb2.SetupRegularBuildRequest( base_build_dir=self.base_build_dir, revision=self.revision, build_url=self.build_url, build_prefix=self.build_prefix) if self.target_weights: request.target_weights.update(self.target_weights) return _handle_response(self, host.stub().SetupRegularBuild(request))