-
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.
- Loading branch information
vadim
committed
Dec 17, 2024
1 parent
1073ba5
commit 6102ad4
Showing
2 changed files
with
37 additions
and
2 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 |
---|---|---|
@@ -1 +1,26 @@ | ||
import pytest | ||
import requests | ||
import json | ||
|
||
# тест на создание пользователя и проверку успешного создания | ||
def test_create_user(): | ||
user = {"name": "Fred", "address": "Moscow25", "coffee_id":"1", "has_sale": "1"} | ||
url = "http://localhost/add_user" | ||
r = requests.post(url, data=user) | ||
try: | ||
r.raise_for_status() | ||
except requests.exceptions.HTTPError as e: | ||
print('ERROR: %s' % e) | ||
assert r.status_code == 201 | ||
|
||
def test_find_user_by_country(): | ||
example_user = json.dumps({"name": "Fred", "address": "Moscow25", "coffee_id":"1", "has_sale": "1"}) | ||
url = "http://localhost/users_by_country" | ||
country = json.dumps({"country": "Moscow25"}) | ||
r = requests.get(url, country) | ||
try: | ||
r.raise_for_status() | ||
except requests.exceptions.HTTPError as e: | ||
print('ERROR: %s' % e) | ||
user = json.loads(r.data) | ||
assert example_user == user |