Skip to content

Commit

Permalink
Merge pull request #4 from tenable/fix/marketplace
Browse files Browse the repository at this point in the history
Updated marketplace command to generate fake test data
  • Loading branch information
SteveMcGrath authored Jan 7, 2025
2 parents dee0bd1 + 8b0072f commit 3e8a319
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tenint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
from .models.configuration import Configuration, Settings # noqa F401
from .connector import Connector # noqa F401

__version__ = '0.1.7'
__version__ = "0.9.0"
21 changes: 15 additions & 6 deletions tenint/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,20 @@ def build_connector(

@app.command('marketplace')
def gen_marketplace(
image: Annotated[str, Option(..., help='Docker Image Name')],
icon: Annotated[str, Option(..., help='Icon Image URL')],
image: Annotated[
str, Option(..., help='Docker Image Name')
] = 'local/connector-example',
icon: Annotated[
str, Option(..., help='Icon Image URL')
] = 'https://nourl.example/logo.svg',
path: Annotated[Path, Option(help='connector code path')] = Path('.'),
output: Annotated[Path, Option(help='output marketplace json file')] = None,
):
mpfile = path.joinpath('marketplace.json')
with mpfile.open('w', encoding='utf-8') as fobj:
mp = MarketplaceConnector.load_from_pyproject('pyproject.toml')
fobj.write(mp.model_dump_json())
mpfile = path.joinpath('marketplace-object.json')
mp = MarketplaceConnector.load_from_pyproject(
filename='pyproject.toml', image_url=image, icon_url=icon
).model_dump(mode='json')
console.print(mp)
if output:
with mpfile.open('w', encoding='utf-8') as fobj:
fobj.write(mp.model_dump_json())
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_init_skip_single_file(tmp_path):
result = runner.invoke(app, ['init', '--path', str(tmp_path)])
assert result.exit_code == 0
assert 'Now that you have' in result.stdout
assert 'pyproject.toml as it already exists' in result.stdout
assert 'pyproject.toml as it' in result.stdout


def test_init_skip_tests(tmp_path):
Expand Down

0 comments on commit 3e8a319

Please sign in to comment.