blob: 661fba088d4a65291445361795d5661110fce1d9 [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):
Alex Klein1699fab2022-09-08 08:46:06 -060015 """Basic confidence check"""
Michael Mortensen3e86c1e2019-11-21 15:51:54 -070016
Alex Klein1699fab2022-09-08 08:46:06 -060017 def stub(*_args, **_kwargs):
18 return True
Alex Kleind815ca62020-01-10 12:21:30 -070019
Alex Klein1699fab2022-09-08 08:46:06 -060020 monkeypatch.setattr(router_lib.Router, "Route", stub)
Alex Kleind815ca62020-01-10 12:21:30 -070021
Alex Klein1699fab2022-09-08 08:46:06 -060022 input_json = tmp_path / "input.json"
23 output_json = tmp_path / "output.json"
Alex Kleind815ca62020-01-10 12:21:30 -070024
Alex Klein1699fab2022-09-08 08:46:06 -060025 osutils.WriteFile(input_json, "{}")
Michael Mortensen3e86c1e2019-11-21 15:51:54 -070026
Alex Klein1699fab2022-09-08 08:46:06 -060027 build_api.main(
28 [
29 "--input-json",
30 str(input_json),
31 "--output-json",
32 str(output_json),
33 "chromite.api.VersionService/Get",
34 ]
35 )