Last active
March 12, 2019 06:50
-
-
Save LarryKarani/112427cf2fad192fc2835decb9eceeb5 to your computer and use it in GitHub Desktop.
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
from rest_framework.test import APIClient | |
from rest_framework import status | |
from django.urls import reverse | |
from ..models import Blog | |
client = APIClient() | |
class GetSingleBlogTest(TestCase): | |
""" Test module for GET single Blog API """ | |
def test_get_a_single_blog(self): | |
"""Test the api can get a given blog.""" | |
blog = Blog.objects.get() | |
response = self.client.get( | |
reverse('get_a_blog', | |
kwargs={'pk': blog.id}), format="json") | |
self.assertEqual(response.status_code, status.HTTP_200_OK) | |
self.assertContains(response, blog) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment