-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_api.py
30 lines (24 loc) · 1.01 KB
/
test_api.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from requests import get, post, delete
print(get('http://localhost:8080/api/news').json())
#
# print(get('http://localhost:8080/api/news/1').json())
#
# print(get('http://localhost:8080/api/news/999').json())
# # новости с id = 999 нет в базе
#
# print(get('http://localhost:8080/api/news/q').json())
# print(post('http://localhost:8080/api/news').json())
#
# print(post('http://localhost:8080/api/news',
# json={'title': 'Заголовок'}).json())
# print(post('http://localhost:8080/api/news',
# json={'title': 'Добавлено через API повтор ',
# 'content': 'Новость добавлена через API blueprint повтор',
# 'user_id': 1,
# 'is_private': False
# }).json())
#
# print(get('http://localhost:8080/api/news').json())
print(delete('http://localhost:8080/api/news/999').json())
# новости с id = 999 нет в базе
print(delete('http://localhost:8080/api/news/8').json())