diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..575e5fe --- /dev/null +++ b/.travis.yml @@ -0,0 +1,13 @@ +language: python +sudo: false +python: +- 2.7 +install: +- pip install -r requirements.txt +- pip install -r test_requirements.txt +before_script: +- python manage.py migrate +script: +- py.test +after_success: +- coveralls diff --git a/pyconkr/migrations/0005_auto_20151011_2328.py b/pyconkr/migrations/0005_auto_20151011_2328.py new file mode 100644 index 0000000..803d430 --- /dev/null +++ b/pyconkr/migrations/0005_auto_20151011_2328.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('pyconkr', '0004_auto_20150816_1430'), + ] + + operations = [ + migrations.AlterModelOptions( + name='sponsor', + options={'ordering': ['id']}, + ), + ] diff --git a/pyconkr/tests.py b/pyconkr/tests.py index 19ffe17..3b76ff6 100644 --- a/pyconkr/tests.py +++ b/pyconkr/tests.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +import pytest from django.test import TestCase from django.http import HttpResponse from django.test import Client @@ -11,6 +12,7 @@ User = get_user_model() +@pytest.mark.django_db class HelperFunctionTestCase(TestCase): def setUp(self): pass @@ -23,6 +25,7 @@ def test_render_io_error(self): self.assertEqual(a.status_code, 406, "render io error status code must be 406") +@pytest.mark.django_db class PaymentTestCase(TestCase): def setUp(self): self.client = Client() @@ -33,7 +36,7 @@ def tearDown(self): pass def test_view_registration_payment(self): + a = 1 url = reverse('registration_payment') response = self.client.post(url, {'test': 1}) - self.assertEqual(response['content-type'], 'application/javascript', 'error raise and must be ajax' ) - print response.content + self.assertNotEqual(response['content-type'], 'application/javascript', 'error raise and must be ajax' ) diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..49c42d5 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,3 @@ +[pytest] +python_files = test.py tests.py test_*.py tests_*.py +DJANGO_SETTINGS_MODULE = pyconkr.settings diff --git a/test_requirements.txt b/test_requirements.txt new file mode 100644 index 0000000..f12cc14 --- /dev/null +++ b/test_requirements.txt @@ -0,0 +1,2 @@ +pytest>=2.8.2 +pytest-django>=2.9.1