Skip to content

Commit ae8fb18

Browse files
Added unit tests
1 parent a50c6d0 commit ae8fb18

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

portfolio/tests.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
import tempfile
12
from django.test import TestCase
3+
from .models import Hero
24

3-
# Create your tests here.
5+
6+
class HeroModelUnitTestCase(TestCase):
7+
def setUp(self):
8+
self.hero = Hero.objects.create(
9+
title='Lorem ipsum dolor sit amet',
10+
subtitle='Sed tincidunt quis odio id molestie',
11+
description='Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tincidunt quis odio id molestie.',
12+
image=tempfile.NamedTemporaryFile(suffix='.jpg').name
13+
)
14+
15+
def test_hero_model(self):
16+
data = self.hero
17+
self.assertIsInstance(data, Hero)

0 commit comments

Comments
 (0)