Skip to content

Commit

Permalink
test added and model added for bucketList
Browse files Browse the repository at this point in the history
  • Loading branch information
ameek committed Aug 1, 2018
1 parent d0cdfa8 commit 0ab9bc4
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 0 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
9 changes: 9 additions & 0 deletions medicine_reminder/api/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
from django.db import models

# Create your models here.
class Bucketlist(models.Model):
"""This class represnts the bucketlist model"""
name = models.CharField(max_length=225, blank=False, unique=True)
date_created = models.DateTimeField(auto_now_add=True)
date_modified = models.DateTimeField(auto_now=True)

def __str__(self):
"""return a human readable represntation o"f the model in instance"""
return "{}".format(self.name)
16 changes: 16 additions & 0 deletions medicine_reminder/api/tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
from django.test import TestCase

# Create your tests here.
from .models import Bucketlist

class ModelTestCase(TestCase):
"""This class defines the test suite for the bucketlist model."""

def setUp(self):
"""Define the test client and other test variables."""
self.bucketlist_name = "Write world class code"
self.bucketlist = Bucketlist(name=self.bucketlist_name)

def test_model_can_create_a_bucketlist(self):
"""Test the bucketlist model can create a bucketlist."""
old_count = Bucketlist.objects.count()
self.bucketlist.save()
new_count = Bucketlist.objects.count()
self.assertNotEqual(old_count, new_count)
Binary file not shown.

0 comments on commit 0ab9bc4

Please sign in to comment.