Skip to content

Commit

Permalink
Architecture change (#204)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/pre-commit/pre-commit-hooks: v3.4.0 → v4.0.1](pre-commit/pre-commit-hooks@v3.4.0...v4.0.1)
- https://gitlab.com/pycqa/flake8https://github.com/PyCQA/flake8
- [github.com/PyCQA/flake8: 3.8.4 → 3.9.2](PyCQA/flake8@3.8.4...3.9.2)
- [github.com/psf/black: 20.8b1 → 21.6b0](psf/black@20.8b1...21.6b0)
- [github.com/pre-commit/mirrors-autopep8: v1.5.4 → v1.5.7](pre-commit/mirrors-autopep8@v1.5.4...v1.5.7)
- [github.com/asottile/pyupgrade: v2.7.4 → v2.19.4](asottile/pyupgrade@v2.7.4...v2.19.4)
- [github.com/asottile/reorder_python_imports: v2.3.6 → v2.5.0](asottile/reorder-python-imports@v2.3.6...v2.5.0)
- [github.com/asottile/add-trailing-comma: v2.0.2 → v2.1.0](asottile/add-trailing-comma@v2.0.2...v2.1.0)
- [github.com/pre-commit/mirrors-mypy: v0.790 → v0.902](pre-commit/mirrors-mypy@v0.790...v0.902)

* Better output (#199)

* List option (#200)

* test new output

* fix(output)

* delete useless package

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* change lint stage

* adding color output

* add list option

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* fix(ci)

* fix(unit test)

* architecture change

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
tyki6 and pre-commit-ci[bot] authored Jul 5, 2021
1 parent b6ce677 commit 5dae184
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 17 deletions.
2 changes: 1 addition & 1 deletion rawsec_cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# autogenerated
__version__ = "1.1.1"
__commit__ = "af1490c7990bc7755495a266a7c41d1caf67ffe5"
__commit__ = "b016911fc24a3502b546f6001e59f94aa1bda62b"
6 changes: 1 addition & 5 deletions rawsec_cli/cli/command/list_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,6 @@ def resources(ctx, category, paid, free, output, output_file):
projects = filter_projects(projects, paid=paid, free=free)
resourcesList = list()
for resource in projects:
for link in resource["links"]:
resource[list(link.keys())[0]] = link[list(link.keys())[0]]
del resource["links"]

resourceList = list()
for keys in wanted_keys:
if keys not in resource:
Expand Down Expand Up @@ -400,7 +396,7 @@ def os(ctx, category, base, output, output_file):
None
Return in output format(Default: table) in output_file(Default: stdout) a list of rawsec ctf.
"""
wanted_keys = ["os", "base", "description", "link"]
wanted_keys = ["name", "base", "description", "website"]
if category and category not in get_operating_category(
json=ctx.obj["json"],
):
Expand Down
5 changes: 4 additions & 1 deletion rawsec_cli/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ def search_project_operating(json: Dict, project: str) -> List[Dict]:
"""
list_projects = list()
for operating in get_all_operating(json):
if "os" in operating and project.lower() in operating["os"].lower():
if (
"name" in operating
and project.lower() in operating["name"].lower()
):
list_projects.append(operating)
return list_projects

Expand Down
8 changes: 0 additions & 8 deletions tests/test_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,6 @@ def test_print_output(capsys):
captured = capsys.readouterr()
assert "Total projects found: 1" in captured.out

print_output(
projects=[{"name": "test", "source": "test"}],
output="list",
wanted_keys=[],
)
captured = capsys.readouterr()
assert "Total projects found: 1" in captured.out

print_output(
projects=[{"name": "test", "source": "test"}],
output="table",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"operating_systems": {
"binary_exploitation": {
"operating_systems": [{"os": "operating_systems"}],
"operating_systems": [{"name": "operating_systems"}],
},
},
"ctf_platforms": {
Expand Down Expand Up @@ -45,7 +45,7 @@ def test_search_project_ctf():
def test_search_project_operating():
"""test search_project_operating function"""
assert search_project_operating(rawsec_json, "operating_systems") == [
{"os": "operating_systems"},
{"name": "operating_systems"},
]


Expand Down

0 comments on commit 5dae184

Please sign in to comment.