You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
4.8 KiB
Markdown

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

Напиши unittest-ы
в случае фошибки вернуть JsonResponse({"error": format(error)}, status=500)
1 -http://localhost:8090/shop/
Запрос GET возвращает ответ JsonResponse c формата JsonResponse({"OK": products}, status=200)
пример products:
[{'id': 2, 'name': 'Серебрянный паровоз', 'count': 23, 'reserved': 0, 'picture_url': 'https://git.softwarrior.ru/stepik104/game_shop/raw/branch/main/images/silver_train.png ', 'description': 'Серебро - благородный метал, такой паровоз не стыдно выкатить на рельсы', 'type': 'skin', 'cost': Decimal('50.00')}, {'id': 4, 'name': 'Золотая башня', 'count': 10, 'reserved': 0, 'picture_url': 'https://git.softwarrior.ru/stepik104/game_shop/raw/branch/main/images/golden_tower.png ', 'description': 'Целая башня из чистого золота, кто-то скажет - непрактично, но мы ответим - да', 'type': 'skin', 'cost': Decimal('100.00')}, {'id': 6, 'name': 'Бронзовая башня', 'count': 100, 'reserved': 0, 'picture_url': 'https://git.softwarrior.ru/stepik104/game_shop/raw/branch/main/images/bronze_tower.png ', 'description': 'Бронзовая башня - великая классика, как оловянный солдатик', 'type': 'skin', 'cost': Decimal('10.00')}, {'id': 7, 'name': 'Капибара', 'count': 30, 'reserved': 0, 'picture_url': 'https://git.softwarrior.ru/stepik104/game_shop/raw/branch/main/images/capi_avatar.png ', 'description': 'Почему нет', 'type': 'avatar', 'cost': Decimal('25.00')}, {'id': 9, 'name': 'Штурмовик', 'count': 30, 'reserved': 0, 'picture_url': 'https://git.softwarrior.ru/stepik104/game_shop/raw/branch/main/images/starwars_avatar.png ', 'description': 'Не всегда попадает в цель, зато всегда лоялен императору', 'type': 'avatar', 'cost': Decimal('25.00')}, {'id': 3, 'name': 'Бронзовый паровоз', 'count': 98, 'reserved': 2, 'picture_url': 'https://git.softwarrior.ru/stepik104/game_shop/raw/branch/main/images/bronze_train.png ', 'description': 'Развитие цивилизации начиналось с бронзы, этот паровоз символизирует начало прогресса', 'type': 'skin', 'cost': Decimal('10.00')}, {'id': 8, 'name': 'Капитан-черепаха', 'count': 30, 'reserved': 1, 'picture_url': 'https://git.softwarrior.ru/stepik104/game_shop/raw/branch/main/images/tortule_avatar.png ', 'description': 'Настоящий пират никуда не торопиться', 'type': 'avatar', 'cost': Decimal('25.00')}, {'id': 5, 'name': 'Серебрянная башня', 'count': 18, 'reserved': 2, 'picture_url': 'https://git.softwarrior.ru/stepik104/game_shop/raw/branch/main/images/silver_tower.png ', 'description': 'Серебряная башня, такая серая и холодная, так бы и заточил туда принцессу', 'type': 'skin', 'cost': Decimal('50.00')}, {'id': 1, 'name': 'Золотой паровоз', 'count': 9, 'reserved': 0, 'picture_url': 'https://git.softwarrior.ru/stepik104/game_shop/raw/branch/main/images/golden_train.png ', 'description': 'Золотой, блестящий, ну разве не чудо', 'type': 'skin', 'cost': Decimal('100.00')}, {'id': 28, 'name': 'Тестовый товар 1', 'count': 8, 'reserved': 0, 'picture_url': '', 'description': 'Описание 1', 'type': 'test', 'cost': Decimal('50.00')}, {'id': 29, 'name': 'Тестовый товар 2', 'count': 4, 'reserved': 0, 'picture_url': '', 'description': 'Описание 2', 'type': 'test', 'cost': Decimal('30.00')}]
Проверить что не пустой
2 - http://localhost:8090/login/
Запрос POST с body
login: str
password: str
email: str
возвращает JsonResponse({"OK": token}, status=200)
пример token
token формата: uuid.uuid4(), пример: 44decdbc-7120-4838-abf8-7528a11467a9
3 - http://localhost:8090/logout/
Запрос POST с header:
Token: str пример: 44decdbc-7120-4838-abf8-7528a11467a9
возвращает JsonResponse({"OK": token}, status=200)
4 - http://localhost:8090/basket/
Запрос POST с header:
Token: str пример: 44decdbc-7120-4838-abf8-7528a11467a9
возвращает JsonResponse({"OK": basket}, status=200)
ошибка если токен невалидный, напиши тест на невалидный токен
5 - http://localhost:8090/history/
Запрос POST с header:
Token: str пример: 44decdbc-7120-4838-abf8-7528a11467a9
возвращает JsonResponse({"OK": histories}, status=200)
ошибка если токен невалидный, напиши тест на невалидный токен