forked from jyejare/candore
-
Notifications
You must be signed in to change notification settings - Fork 1
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 #10 from SatelliteQE/configurable_settings
Configurable settings
- Loading branch information
Showing
21 changed files
with
347 additions
and
238 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[flake8] | ||
max-line-length = 100 |
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,6 @@ | ||
settings.yaml | ||
**/__pycache__/ | ||
*.json | ||
*.csv | ||
.idea | ||
trust |
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,20 @@ | ||
repos: | ||
- repo: https://github.com/asottile/reorder_python_imports | ||
rev: v3.12.0 | ||
hooks: | ||
- id: reorder-python-imports | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- id: check-yaml | ||
- id: debug-statements | ||
- repo: https://github.com/psf/black | ||
rev: 23.11.0 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 6.1.0 | ||
hooks: | ||
- id: flake8 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import asyncio # noqa: F401 | ||
import json | ||
from pathlib import Path | ||
|
||
import click | ||
|
||
from candore.errors import ModeError | ||
from candore.modules.api_lister import APILister | ||
from candore.modules.comparator import Comparator | ||
from candore.modules.extractor import Extractor | ||
from candore.modules.report import Reporting | ||
|
||
|
||
class Candore: | ||
def __init__(self, settings): | ||
self.settings = settings | ||
self.api_lister = APILister(settings=self.settings) | ||
|
||
def list_endpoints(self): | ||
return self.api_lister.lister_endpoints() | ||
|
||
async def save_all_entities(self, mode, output_file, full): | ||
"""Save all the entities to a json file | ||
:param mode: Pre or Post | ||
:param output_file: Output file name | ||
:param full: If True, save entities from all pages of the components, | ||
else just saves first page | ||
:return: None | ||
""" | ||
if mode not in ["pre", "post"]: | ||
raise ModeError("Extracting mode must be 'pre' or 'post'") | ||
|
||
async with Extractor(settings=self.settings, apilister=self.api_lister) as extractor: | ||
if full: | ||
extractor.full = True | ||
data = await extractor.extract_all_entities() | ||
|
||
if not data: | ||
click.echo("Entities data is not data found!") | ||
|
||
file_path = Path(output_file) if output_file else Path(f"{mode}_entities.json") | ||
with file_path.open(mode="w") as entfile: | ||
json.dump(data, entfile) | ||
click.echo(f"Entities data saved to {file_path}") | ||
|
||
def compare_entities( | ||
self, | ||
pre_file=None, | ||
post_file=None, | ||
output=None, | ||
report_type=None, | ||
record_evs=None, | ||
): | ||
comp = Comparator(settings=self.settings) | ||
if record_evs: | ||
comp.record_evs = True | ||
results = comp.compare_json(pre_file=pre_file, post_file=post_file) | ||
reporter = Reporting(results=results) | ||
reporter.generate_report(output_file=output, output_type=report_type) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.