Created
September 18, 2018 12:21
-
-
Save nakimera/9a2221bf6c4a6b4308373a40f76d9f8d to your computer and use it in GitHub Desktop.
This code tests creation of an article on Author's heaven
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 django.test import Client,TestCase | |
from .models import Article | |
class ArticleModelTest(TestCase): | |
self.client = Client() | |
self.article = Article( | |
title = "My first django test", | |
description = "Ever wonder how?", | |
body = "You have to believe", | |
tagline : ["dragons", "angularJs"] | |
) | |
def test_create_article(self): | |
"""This method tests creation of an article""" | |
response = self.client.post("/api/articles", self.article) | |
return self.assertEqual(response.status_code, 201) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@malep2007 Yes, I could check for the response message for successful creation of the article