-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from tenable/feature/additional-testing-and-imp…
…rovements Additional Testing & other improments
- Loading branch information
Showing
13 changed files
with
108 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from tenint.models.marketplace import MarketplaceConnector | ||
|
||
|
||
def test_load_from_pyproject(tmpdir): | ||
pf = tmpdir.join('pyproject-pass.toml') | ||
pf.write(""" | ||
[project] | ||
name = "example-connector" | ||
version = "0.0.1" | ||
description = "Example Description" | ||
dependencies = [] | ||
[project.optional-dependencies] | ||
testing = [] | ||
[project.urls] | ||
support = "https://example.com/support" | ||
[[project.authors]] | ||
name = "Company" | ||
email = "[email protected]" | ||
[tool.tenint.connector] | ||
title = "Example Connector" | ||
tags = ["tvm", "example"] | ||
""") | ||
mp = MarketplaceConnector.load_from_pyproject( | ||
pf, | ||
icon_url='https://somewhere.com/img.png', | ||
image_url='tenable/connector-example', | ||
) | ||
assert mp.name == 'Example Connector' | ||
assert mp.slug == 'example-connector' | ||
assert mp.description == 'Example Description' | ||
assert str(mp.icon_url) == 'https://somewhere.com/img.png' | ||
assert mp.image_url == 'tenable/connector-example' | ||
assert mp.timeout == 3600 | ||
assert mp.marketplace_tag == '0.0.1' | ||
assert mp.connector_owner == 'Company' | ||
assert mp.support_contact == '[email protected]' | ||
assert mp.tags == ['tvm', 'example'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from typer.testing import CliRunner | ||
|
||
from tenint.cli import app | ||
|
||
runner = CliRunner() | ||
|
||
|
||
def test_init_command(tmp_path): | ||
result = runner.invoke(app, ['init', '--path', str(tmp_path)]) | ||
if result.exception: | ||
raise result.exception | ||
assert result.exit_code == 0 | ||
assert 'Now that you have' in result.stdout | ||
assert 'skipped' not in result.stdout | ||
|
||
|
||
def test_init_skip_single_file(tmp_path): | ||
pyfile = tmp_path.joinpath('pyproject.toml') | ||
with pyfile.open('w') as fobj: | ||
fobj.write('something') | ||
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 | ||
|
||
|
||
def test_init_skip_tests(tmp_path): | ||
tmp_path.joinpath('tests').mkdir() | ||
result = runner.invoke(app, ['init', '--path', str(tmp_path)]) | ||
assert result.exit_code == 0 | ||
assert 'Now that you have' in result.stdout | ||
assert 'skipped adding tests' in result.stdout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.