Skip to content

Instantly share code, notes, and snippets.

@moacirmoda
Created August 10, 2018 01:01
Show Gist options
  • Save moacirmoda/49f195a5c2de7e98a209e33fdea2cd96 to your computer and use it in GitHub Desktop.
Save moacirmoda/49f195a5c2de7e98a209e33fdea2cd96 to your computer and use it in GitHub Desktop.
from django.test import TestCase
from myapp.models import Person
class PersonTestCase(TestCase):
def test_should_return_attributes(self):
self.assertTrue(hasattr(Person, 'first_name'))
self.assertTrue(hasattr(Person, 'last_name'))
self.assertTrue(hasattr(Person, 'age'))
def test_should_create_item(self):
person = Person.objects.create(first_name='Moacir', last_name='Moda', age=27)
self.assertIsNotNone(person)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment