Organize tests into directory, and fix import error with app_label

This commit is contained in:
Tyrel Souza 2017-04-01 13:34:26 -04:00
parent 349c0c7c7b
commit 89a676aeec
No known key found for this signature in database
GPG Key ID: 2EECB5087209E6A5
4 changed files with 30 additions and 28 deletions

0
stagestatus/__init__.py Normal file
View File

View 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)

View 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)