-
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.
* Request format * rename --path-requests in --requests-dir * info about running tests after generation
- Loading branch information
Showing
31 changed files
with
776 additions
and
132 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 |
---|---|---|
|
@@ -8,3 +8,5 @@ dist/ | |
.pypirc | ||
|
||
*.sh | ||
|
||
tests/e2e/.vedro |
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,7 +1,8 @@ | ||
jj==2.7.2 | ||
vedro-jj==0.1.1 | ||
jj==2.8.1 | ||
vedro-jj==0.2.0 | ||
jj_district42==1.0.0 | ||
flake8==6.0.0 | ||
flake8==6.1.0 | ||
isort==5.12.0 | ||
mypy==1.3.0 | ||
mypy==1.5.1 | ||
mypy-extensions==1.0.0 | ||
pytest==7.4.2 |
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,7 +1,8 @@ | ||
jinja2==3.1.2 | ||
httpx==0.24.0 | ||
cabina==0.7.1 | ||
d42==1.5.1 | ||
vedro==1.8.3 | ||
vedro-valera-validator==1.1.0 | ||
d42==1.7.0 | ||
vedro==1.10.0 | ||
vedro-valera-validator==1.1.1 | ||
requests-toolbelt==1.0.0 | ||
pyparsing==3.1.1 | ||
vedro-httpx==0.3.0 |
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 was deleted.
Oops, something went wrong.
82 changes: 82 additions & 0 deletions
82
tests/e2e/scenarios/launch_vedro_replay_tests_by_get_requests.py
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,82 @@ | ||
from typing import List | ||
|
||
import vedro | ||
from contexts import execution_directory, mocked_api | ||
from interfaces import VedroReplayCLI, VedroTestCLI | ||
from jj_district42 import HistorySchema | ||
from vedro import params | ||
|
||
from vedro_replay.request import Request | ||
|
||
|
||
class Scenario(vedro.Scenario): | ||
subject = 'launch vedro-replay by GET requests: {subject}' | ||
|
||
@params('.txt file', | ||
'requests', | ||
'get_requests.txt', | ||
[ | ||
Request( | ||
method="GET", | ||
url="/1.0/secure-resource?q=123", | ||
), | ||
Request( | ||
method="GET", | ||
url="/1.0/secure-resource?q=example", | ||
), | ||
] | ||
) | ||
@params('.http file. Generate with --requests-dir', | ||
'special_requests', | ||
'get_requests.http', | ||
[ | ||
Request( | ||
comment='GET Request', | ||
method="GET", | ||
url="/1.0/secure-resource", | ||
), | ||
Request( | ||
method="GET", | ||
url="/1.0/secure-resource?data=all&search=value", | ||
), | ||
] | ||
) | ||
def __init__(self, subject: str, dir_request: str, file_requests: str, requests: List[Request]): | ||
self.subject = subject | ||
self.dir_launch = 'launch' | ||
self.dir_requests = dir_request | ||
self.file_requests = file_requests | ||
self.requests = requests | ||
|
||
def given_prepared_execution_directory(self): | ||
execution_directory( | ||
dir_launch=self.dir_launch, | ||
dir_requests=self.dir_requests, | ||
file_requests=self.file_requests, | ||
) | ||
|
||
async def given_vedro_replay_tests(self): | ||
self.stdout_vedro_replay, self.stderr_vedro_replay = await VedroReplayCLI( | ||
dir_launch=self.dir_launch, | ||
dir_requests=self.dir_requests | ||
).run() | ||
|
||
async def when_replay_tests_running(self): | ||
async with mocked_api() as self.api_mock: | ||
self.stdout_vedro_test, self.stderr_vedro_test = await VedroTestCLI( | ||
dir_launch=self.dir_launch | ||
).run() | ||
|
||
def then_test_was_started_with_correct_subject(self): | ||
for request in self.requests: | ||
assert f"do request: {request.path} (comment='{request.comment}')" in self.stdout_vedro_test | ||
|
||
def and_then_number_requests_sent_should_be_correct(self): | ||
assert self.api_mock.history == HistorySchema % [ | ||
{ | ||
'request': { | ||
'method': request.method, | ||
'path': request.path, | ||
} | ||
} for request in [r for r in self.requests for _ in range(2)] | ||
] |
Oops, something went wrong.