-
-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f56c7d4
commit 9db8052
Showing
26 changed files
with
279 additions
and
343 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ Date: 2019-08-08 | |
|
||
## Status | ||
|
||
Accepted | ||
Superseded by #6 | ||
|
||
## Context | ||
|
||
|
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ Date: 2019-08-08 | |
|
||
## Status | ||
|
||
Accepted | ||
Superseded by #6 | ||
|
||
## Context | ||
|
||
|
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,21 @@ | ||
# 6. Resolve references & load schemas eagerly | ||
|
||
Date: 2019-09-15 | ||
|
||
## Status | ||
|
||
Accepted | ||
|
||
## Context | ||
|
||
Having lazily loaded schema complicates implementation and doesn't bring much value, since loading still happen during the collection phase. | ||
References are not implemented lazily at the moment, it was missed during development. | ||
|
||
## Decision | ||
|
||
Evaluate schemas & references eagerly. | ||
|
||
## Consequences | ||
|
||
Implementation will be simpler. However, references still could be implemented lazily, | ||
since they could be evaluated after collection phase and the tests using them could be excluded from the run. |
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 |
---|---|---|
@@ -1,5 +1,2 @@ | ||
from .generator import Case | ||
from .parametrizer import Parametrizer | ||
from .schemas import SwaggerV20 | ||
|
||
# TODO. optional schema validation? | ||
from .models import Case | ||
from .readers import Parametrizer, from_dict, from_file, from_path, from_uri |
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,23 @@ | ||
import re | ||
from typing import Optional | ||
|
||
from .types import Filter | ||
from .utils import force_tuple | ||
|
||
|
||
def should_skip_method(method: str, pattern: Optional[Filter]) -> bool: | ||
if pattern is None: | ||
return False | ||
patterns = force_tuple(pattern) | ||
return method.upper() not in map(str.upper, patterns) | ||
|
||
|
||
def should_skip_endpoint(endpoint: str, pattern: Optional[Filter]) -> bool: | ||
if pattern is None: | ||
return False | ||
patterns = force_tuple(pattern) | ||
return not any(is_match(endpoint, item) for item in patterns) | ||
|
||
|
||
def is_match(endpoint: str, pattern: str) -> bool: | ||
return pattern in endpoint or bool(re.search(pattern, endpoint)) |
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,38 @@ | ||
from typing import Any, Dict | ||
|
||
import attr | ||
|
||
from .types import Body, Headers, PathParameters, Query | ||
|
||
|
||
@attr.s(slots=True) | ||
class Case: | ||
"""A single test case parameters.""" | ||
|
||
path: str = attr.ib() | ||
method: str = attr.ib() | ||
path_parameters: PathParameters = attr.ib() | ||
headers: Headers = attr.ib() | ||
query: Query = attr.ib() | ||
body: Body = attr.ib() | ||
|
||
@property | ||
def formatted_path(self) -> str: | ||
# pylint: disable=not-a-mapping | ||
return self.path.format(**self.path_parameters) | ||
|
||
|
||
def empty_object() -> Dict[str, Any]: | ||
return {"properties": {}, "additionalProperties": False, "type": "object", "required": []} | ||
|
||
|
||
@attr.s(slots=True) | ||
class Endpoint: | ||
"""A container that could be used for test cases generation.""" | ||
|
||
path: str = attr.ib() | ||
method: str = attr.ib() | ||
path_parameters: PathParameters = attr.ib(factory=empty_object) | ||
headers: Headers = attr.ib(factory=empty_object) | ||
query: Query = attr.ib(factory=empty_object) | ||
body: Body = attr.ib(factory=empty_object) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.