forked from yandex-praktikum/taski-docker
-
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
DimWSL
committed
Jul 31, 2023
1 parent
062f799
commit 0e0d0bd
Showing
2 changed files
with
26 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from http import HTTPStatus | ||
|
||
from api import models | ||
from django.test import Client, TestCase | ||
|
||
class TaskiAPITestCase(TestCase): | ||
def setUp(self): | ||
self.guest_client = Client() | ||
|
||
def test_list_exists(self): | ||
"""Проверка доступности списка задач.""" | ||
response = self.guest_client.get('/api/tasks/') | ||
self.assertEqual(response.status_code, HTTPStatus.OK) | ||
|
||
def test_task_creation(self): | ||
"""Проверка создания задачи.""" | ||
data = {'title': 'Test', 'description': 'Test'} | ||
response = self.guest_client.post('/api/tasks/', data=data) | ||
self.assertEqual(response.status_code, HTTPStatus.CREATED) | ||
self.assertTrue(models.Task.objects.filter(title='Test').exists()) |