|
| 1 | +# encoding: utf-8 |
| 2 | + |
| 3 | +# This file is part of CycloneDX Python Lib |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | +# |
| 17 | +# SPDX-License-Identifier: Apache-2.0 |
| 18 | +# Copyright (c) OWASP Foundation. All Rights Reserved. |
| 19 | + |
| 20 | +import subprocess |
| 21 | +import sys |
| 22 | +from unittest import TestCase |
| 23 | + |
| 24 | +import cyclonedx_py |
| 25 | + |
| 26 | + |
| 27 | +class TestCli(TestCase): |
| 28 | + |
| 29 | + def test_callable_as_module(self) -> None: |
| 30 | + args = [sys.executable, '-m', cyclonedx_py.__name__, '--help'] |
| 31 | + |
| 32 | + # Test whether the call passed, is fair enough for now. |
| 33 | + # Additional tests may come later, to check output etc. |
| 34 | + returncode = subprocess.call( |
| 35 | + args, |
| 36 | + stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, |
| 37 | + shell=False, |
| 38 | + ) |
| 39 | + |
| 40 | + self.assertEqual(0, returncode, msg='subprocess returned unexpected non-zero') |
0 commit comments