Skip to content

Commit 3e8a319

Browse files
authored
Merge pull request #4 from tenable/fix/marketplace
Updated marketplace command to generate fake test data
2 parents dee0bd1 + 8b0072f commit 3e8a319

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

tenint/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
from .models.configuration import Configuration, Settings # noqa F401
33
from .connector import Connector # noqa F401
44

5-
__version__ = '0.1.7'
5+
__version__ = "0.9.0"

tenint/cli.py

+15-6
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,20 @@ def build_connector(
116116

117117
@app.command('marketplace')
118118
def gen_marketplace(
119-
image: Annotated[str, Option(..., help='Docker Image Name')],
120-
icon: Annotated[str, Option(..., help='Icon Image URL')],
119+
image: Annotated[
120+
str, Option(..., help='Docker Image Name')
121+
] = 'local/connector-example',
122+
icon: Annotated[
123+
str, Option(..., help='Icon Image URL')
124+
] = 'https://nourl.example/logo.svg',
121125
path: Annotated[Path, Option(help='connector code path')] = Path('.'),
126+
output: Annotated[Path, Option(help='output marketplace json file')] = None,
122127
):
123-
mpfile = path.joinpath('marketplace.json')
124-
with mpfile.open('w', encoding='utf-8') as fobj:
125-
mp = MarketplaceConnector.load_from_pyproject('pyproject.toml')
126-
fobj.write(mp.model_dump_json())
128+
mpfile = path.joinpath('marketplace-object.json')
129+
mp = MarketplaceConnector.load_from_pyproject(
130+
filename='pyproject.toml', image_url=image, icon_url=icon
131+
).model_dump(mode='json')
132+
console.print(mp)
133+
if output:
134+
with mpfile.open('w', encoding='utf-8') as fobj:
135+
fobj.write(mp.model_dump_json())

tests/test_cli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_init_skip_single_file(tmp_path):
2121
result = runner.invoke(app, ['init', '--path', str(tmp_path)])
2222
assert result.exit_code == 0
2323
assert 'Now that you have' in result.stdout
24-
assert 'pyproject.toml as it already exists' in result.stdout
24+
assert 'pyproject.toml as it' in result.stdout
2525

2626

2727
def test_init_skip_tests(tmp_path):

0 commit comments

Comments
 (0)