-
Notifications
You must be signed in to change notification settings - Fork 3
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 #11 from naodeng/main
add demo for filter test
- Loading branch information
Showing
3 changed files
with
37 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import pytest | ||
import requests | ||
import json | ||
|
||
|
||
class TestPytestMultiEnvDemo: | ||
|
||
@pytest.mark.Regression # mark the test case as regression | ||
def test_get_demo_filter(self, env_config, env_request_data, env_response_data): | ||
host = env_config["host"] | ||
get_api = env_config["getAPI"] | ||
get_api_response_data = env_response_data["getAPI"] | ||
# send request | ||
response = requests.get(host+get_api) | ||
# assert | ||
assert response.status_code == 200 | ||
assert response.json() == get_api_response_data | ||
|
||
@pytest.mark.Smoke # mark the test case as smoke | ||
def test_post_demo_filter(self, env_config, env_request_data, env_response_data): | ||
host = env_config["host"] | ||
post_api = env_config["postAPI"] | ||
post_api_request_data = env_request_data["postAPI"] | ||
print("make the request") | ||
post_api_response_data = env_response_data["postAPI"] | ||
# Your test code here | ||
response = requests.post(host + post_api, json=post_api_request_data) | ||
print("verify the response status code") | ||
assert response.status_code == 201 | ||
print("verify the response data") | ||
assert response.json() == post_api_response_data |