mirror of
https://github.com/TrentSPalmer/trentpalmerdotorg.git
synced 2024-11-22 01:21:30 -08:00
add audio/tests/test_episode_model.py, audio/tests/test_feed_model.py
This commit is contained in:
parent
88790e4080
commit
9fe3b45a00
24
audio/tests/test_episode_model.py
Normal file
24
audio/tests/test_episode_model.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
from audio.models import Feed, Episode
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
from uuid import UUID
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
|
|
||||||
|
class EpisodeModelTestCase(TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
user_a = User.objects.create(username='user_a')
|
||||||
|
feed_a = Feed.objects.create(user=user_a, title='Civil War')
|
||||||
|
p_date = datetime.today() - timedelta(days=8)
|
||||||
|
Episode.objects.create(
|
||||||
|
title='Chapter I', feed=feed_a, user=user_a,
|
||||||
|
pub_date=p_date
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_episode(self):
|
||||||
|
qs = Episode.objects.all()
|
||||||
|
self.assertEquals(len(qs), 1)
|
||||||
|
episode_a = Episode.objects.get(title='Chapter I')
|
||||||
|
self.assertTrue(isinstance(episode_a.pk, UUID))
|
||||||
|
self.assertEquals(str(episode_a), episode_a.title)
|
18
audio/tests/test_feed_model.py
Normal file
18
audio/tests/test_feed_model.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
from audio.models import Feed
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
from uuid import UUID
|
||||||
|
|
||||||
|
|
||||||
|
class FeedModelTestCase(TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
user_a = User.objects.create(username='user_a')
|
||||||
|
Feed.objects.create(user=user_a, title='Civil War')
|
||||||
|
|
||||||
|
def test_feed(self):
|
||||||
|
qs = Feed.objects.all()
|
||||||
|
self.assertEquals(len(qs), 1)
|
||||||
|
feed_a = Feed.objects.get(title='Civil War')
|
||||||
|
self.assertTrue(isinstance(feed_a.pk, UUID))
|
||||||
|
self.assertEquals(str(feed_a), feed_a.title)
|
Loading…
Reference in New Issue
Block a user