From: Thomas Fillon Date: Fri, 21 Nov 2014 16:40:15 +0000 (+0100) Subject: Test: add first minimal test for instruments model X-Git-Tag: 1.5.0rc1~22^2 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=e9e6560cc23f0ebb90496c7041821d838cf71939;p=telemeta.git Test: add first minimal test for instruments model --- diff --git a/setup.py b/setup.py index 72846d13..e9e56a8e 100644 --- a/setup.py +++ b/setup.py @@ -67,7 +67,7 @@ setup( 'pyyaml', 'python-ebml', ], - tests_require=['pytest-django', 'pytest-cov'], + tests_require=['pytest-django', 'pytest-cov', 'factory-boy'], # Provide a test command through django-setuptest cmdclass={'test': PyTest}, dependency_links = ['https://github.com/yomguy/django-json-rpc/tarball/0.6.2#egg=django-json-rpc-0.6.2'], diff --git a/telemeta/tests/instrument_factories.py b/telemeta/tests/instrument_factories.py new file mode 100644 index 00000000..54214cd9 --- /dev/null +++ b/telemeta/tests/instrument_factories.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +""" +Factories for the telemeta.models.instrument + +""" +import factory + +from telemeta.models.instrument import Instrument + + +class InstrumentFactory(factory.django.DjangoModelFactory): + class Meta: + model = Instrument + + name = factory.Sequence(lambda n: 'name{0}'.format(n)) diff --git a/telemeta/tests/settings_sqlite.py b/telemeta/tests/settings_sqlite.py index eef9ebdb..ef5262b3 100644 --- a/telemeta/tests/settings_sqlite.py +++ b/telemeta/tests/settings_sqlite.py @@ -1,4 +1,4 @@ -from telemeta.settings_base import SECRET_KEY +from telemeta.settings_base import SECRET_KEY, INSTALLED_APPS DATABASES = { diff --git a/telemeta/tests/test_models_instrument.py b/telemeta/tests/test_models_instrument.py new file mode 100644 index 00000000..bc00512c --- /dev/null +++ b/telemeta/tests/test_models_instrument.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- + +from . instrument_factories import InstrumentFactory +import pytest + + +@pytest.mark.django_db +def test_Instrument(): + instrument = InstrumentFactory.build()