-
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.
- Loading branch information
1 parent
c9a6fba
commit e0b8303
Showing
2 changed files
with
33 additions
and
11 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,3 +1,17 @@ | ||
from django.test import TestCase | ||
from unittest.mock import MagicMock, patch | ||
from django.contrib.auth.models import User | ||
from django.test.client import RequestFactory | ||
from django.shortcuts import get_object_or_404 | ||
from todos.views import delete | ||
|
||
# Create your tests here. | ||
|
||
class DeleteTodo(TestCase): | ||
@patch('todos.views.get_object_or_404') | ||
def test_delete(self, get_object_or_404): | ||
user = User.objects.create_user( | ||
username="u", email="e", password="pwd" | ||
) | ||
request = RequestFactory().get("/delete/") | ||
request.user = user | ||
delete(request, 1) |