main
py 30 lines 1.02 KB
Raw
1 # Copyright 2026 Google LLC
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 import pytest
16 import sys
17 from unittest.mock import patch
18 from colab_cli.cli import main
19
20
21 def test_cli_pay(mock_common_state):
22 with patch.object(sys, "argv", ["colab", "pay"]):
23 with patch("webbrowser.open") as mock_open:
24 with pytest.raises(SystemExit) as error:
25 main()
26
27 assert error.value.code == 0
28 mock_open.assert_called_once_with(
29 "https://colab.research.google.com/signup"
30 )