Merge branch 'organize_tests' into 'master'

Organize tests into directory, and fix import error with app_label

See merge request !2
This commit is contained in:
Tyrel Souza 2017-04-01 17:34:55 +00:00
commit 23b8cce692
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)