blob: eca6f6ed5ed18d6a4d4ba5e9b5be03200b4543ea [file] [log] [blame]
Michael Mortensen3e86c1e2019-11-21 15:51:54 -07001# Copyright 2019 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5"""Unittests for build_api.py"""
6
Chris McDonalde0a44a22020-04-15 06:55:20 -06007from __future__ import division
Michael Mortensen3e86c1e2019-11-21 15:51:54 -07008
Michael Mortensen3e86c1e2019-11-21 15:51:54 -07009from chromite.api import router as router_lib
Michael Mortensen3e86c1e2019-11-21 15:51:54 -070010from chromite.lib import osutils
11from chromite.scripts import build_api
12
Mike Frysinger898265b2020-02-10 23:49:12 -050013
Chris McDonalde0a44a22020-04-15 06:55:20 -060014def testSmoke(tmp_path, monkeypatch):
Sloan Johnsona1c89eb2022-06-07 22:49:05 +000015 """Basic confidence check"""
Michael Mortensen3e86c1e2019-11-21 15:51:54 -070016
Mike Frysingera5c6e792022-03-15 23:42:12 -040017 def stub(*_args, **_kwargs):
Chris McDonalde0a44a22020-04-15 06:55:20 -060018 return True
Alex Kleind815ca62020-01-10 12:21:30 -070019
Mike Frysingera5c6e792022-03-15 23:42:12 -040020 monkeypatch.setattr(router_lib.Router, 'Route', stub)
Alex Kleind815ca62020-01-10 12:21:30 -070021
Chris McDonalde0a44a22020-04-15 06:55:20 -060022 input_json = tmp_path / 'input.json'
23 output_json = tmp_path / 'output.json'
Alex Kleind815ca62020-01-10 12:21:30 -070024
Chris McDonalde0a44a22020-04-15 06:55:20 -060025 osutils.WriteFile(input_json, '{}')
Michael Mortensen3e86c1e2019-11-21 15:51:54 -070026
Chris McDonalde0a44a22020-04-15 06:55:20 -060027 build_api.main([
28 '--input-json',
29 str(input_json),
30 '--output-json',
31 str(output_json),
32 'chromite.api.VersionService/Get',
33 ])