Organize tests into directory, and fix import error with app_label
This commit is contained in:
parent
349c0c7c7b
commit
89a676aeec
0
stagestatus/__init__.py
Normal file
0
stagestatus/__init__.py
Normal file
@ -1,28 +0,0 @@
|
||||
from __future__ import print_function
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
from model_mommy import mommy
|
||||
|
||||
# Models
|
||||
from django.contrib.auth.models import User
|
||||
import models
|
||||
|
||||
|
||||
class MachineTest(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.user = mommy.make(User)
|
||||
self.machine_status = mommy.make(
|
||||
models.MachineStatus,
|
||||
make_m2m=True)
|
||||
self.machine = self.machine_status.machine
|
||||
self.machine_note = mommy.make(
|
||||
models.MachineNote,
|
||||
user=self.user,
|
||||
machine=self.machine
|
||||
)
|
||||
|
||||
def test_mommy(self):
|
||||
self.assertEqual(self.machine_status.machine, self.machine)
|
||||
self.assertEqual(self.machine_note.machine, self.machine)
|
0
stagestatus/apps/machines/tests/__init__.py
Normal file
0
stagestatus/apps/machines/tests/__init__.py
Normal file
30
stagestatus/apps/machines/tests/test_models.py
Normal file
30
stagestatus/apps/machines/tests/test_models.py
Normal file
@ -0,0 +1,30 @@
|
||||
from __future__ import print_function
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
from model_mommy import mommy
|
||||
|
||||
# Models
|
||||
from django.contrib.auth.models import User
|
||||
from machines.models import Machine, MachineStatus, MachineNote
|
||||
|
||||
|
||||
class ModelsTest(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.user = mommy.make(User)
|
||||
self.machine = mommy.make(Machine)
|
||||
self.machine_status = mommy.make(MachineStatus,
|
||||
machine=self.machine
|
||||
)
|
||||
self.machine_note = mommy.make(MachineNote,
|
||||
user=self.user,
|
||||
machine=self.machine
|
||||
)
|
||||
|
||||
def test_mommy(self):
|
||||
""" General assertions to test models """
|
||||
self.assertEqual(self.machine_status.machine, self.machine)
|
||||
self.assertEqual(self.machine_note.machine, self.machine)
|
||||
self.assertEqual(self.machine_status.machine,
|
||||
self.machine_note.machine)
|
Loading…
Reference in New Issue
Block a user