Add new test for migrations.

This commit is contained in:
Ignacio Fiorentino 2016-08-11 16:43:30 -03:00
parent a93598e1e3
commit 988cad073e
5 changed files with 19 additions and 15 deletions

View file

@ -18,8 +18,8 @@ Use `tox <https://pypi.python.org/pypi/tox>`_ for running tests in each of the e
# Run all tests.
$ tox
# Run a particular test file with Python 2.7 and Django 1.9.
$ tox -e py27-django19 oidc_provider.tests.test_authorize_endpoint
# Run with Python 2.7 and Django 1.9.
$ tox -e py27-django19
If you have a Django project properly configured with the package. Then just run tests as normal::

View file

@ -0,0 +1,16 @@
from django.core.management import call_command
from django.test import TestCase
from django.utils.six import StringIO
class CommandsTest(TestCase):
def test_creatersakey_output(self):
out = StringIO()
call_command('creatersakey', stdout=out)
self.assertIn('RSA key successfully created', out.getvalue())
def test_makemigrations_output(self):
out = StringIO()
call_command('makemigrations', 'oidc_provider', stdout=out)
self.assertIn('No changes detected in app', out.getvalue())

View file

@ -1,12 +0,0 @@
from django.core.management import call_command
from django.test import TestCase, override_settings
from django.utils.six import StringIO
class CreateRSAKeyTest(TestCase):
@override_settings(BASE_DIR='/tmp')
def test_command_output(self):
out = StringIO()
call_command('creatersakey', stdout=out)
self.assertIn('RSA key successfully created', out.getvalue())

View file

@ -34,7 +34,7 @@ setup(
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
],
test_suite="runtests.runtests",
test_suite='runtests.runtests',
tests_require=[
'pyjwkest==1.1.0',
'mock==2.0.0',