def test_boolean_field_default_value(self): with self.settings(TEST_RUNNER='myapp.test.CustomRunnner'): # We patch the field's default value to trigger the warning boolean_field = Book._meta.get_field('is_published') old_default = boolean_field.default try: boolean_field.default = NOT_PROVIDED result = django_1_6_0.run_checks() self.assertEqual(len(result), 1) self.assertTrue("You have not set a default value for one or more BooleanFields" in result[0]) self.assertTrue('check.Book: "is_published"' in result[0]) # We did not patch the BlogPost.is_published field so # there should not be a warning about it self.assertFalse('check.BlogPost' in result[0]) finally: # Restore the ``default`` boolean_field.default = old_default
def test_boolean_field_default_value(self): with self.settings(TEST_RUNNER='myapp.test.CustomRunnner'): # We patch the field's default value to trigger the warning boolean_field = Book._meta.get_field('is_published') old_default = boolean_field.default try: boolean_field.default = NOT_PROVIDED result = django_1_6_0.run_checks() self.assertEqual(len(result), 1) self.assertTrue( "You have not set a default value for one or more BooleanFields" in result[0]) self.assertTrue('check.Book: "is_published"' in result[0]) # We did not patch the BlogPost.is_published field so # there should not be a warning about it self.assertFalse('check.BlogPost' in result[0]) finally: # Restore the ``default`` boolean_field.default = old_default
def test_run_checks_overridden(self): with self.settings(TEST_RUNNER='myapp.test.CustomRunnner'): self.assertEqual(len(django_1_6_0.run_checks()), 0)
def test_run_checks_new_default(self): with self.settings(TEST_RUNNER='django.test.runner.DiscoverRunner'): result = django_1_6_0.run_checks() self.assertEqual(len(result), 1) self.assertTrue("Django 1.6 introduced a new default test runner" in result[0])
def test_run_checks_new_default(self): with self.settings(TEST_RUNNER='django.test.runner.DiscoverRunner'): result = django_1_6_0.run_checks() self.assertEqual(len(result), 1) self.assertTrue( "You have not explicitly set 'TEST_RUNNER'" in result[0])
def test_run_checks_new_default(self): with self.settings(TEST_RUNNER='django.test.runner.DiscoverRunner'): result = django_1_6_0.run_checks() self.assertEqual(len(result), 1) self.assertTrue("You have not explicitly set 'TEST_RUNNER'" in result[0])
def test_run_checks_new_default(self): with self.settings(TEST_RUNNER='django.test.runner.DiscoverRunner'): result = django_1_6_0.run_checks() self.assertEqual(len(result), 1) self.assertTrue( "Django 1.6 introduced a new default test runner" in result[0])