Ejemplo n.º 1
0
 def test_makemessages(self):
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['makemessages'] = True
             core(args, self.application)
             self.assertTrue(os.path.exists(self.pofile))
Ejemplo n.º 2
0
 def test_compilemessages(self):
     with work_in(self.basedir):
         shutil.copy(self.poexample, self.pofile)
         args = copy(DEFAULT_ARGS)
         args['compilemessages'] = True
         core(args, self.application)
         self.assertTrue(os.path.exists(self.mofile))
Ejemplo n.º 3
0
 def test_testrun_persistent_path(self):
     try:
         import cms
     except ImportError:
         raise unittest.SkipTest('django CMS not available, skipping test')
     path = mkdtemp()
     with work_in(self.basedir):
         with captured_output() as (out, err):
             with self.assertRaises(SystemExit) as exit:
                 try:
                     from django.test.utils import _TestState
                     del _TestState.saved_data
                 except (ImportError, AttributeError):
                     pass
                 args = copy(DEFAULT_ARGS)
                 args['test'] = True
                 args['--persistent'] = True
                 args['--persistent-path'] = path
                 args['--runner'] = 'runners.CapturedOutputRunner'
                 core(args, self.application)
     self.assertTrue('Ran 14 tests in' in err.getvalue())
     self.assertEqual(exit.exception.code, 0)
     self.assertTrue(args['STATIC_ROOT'].startswith(path))
     self.assertTrue(args['MEDIA_ROOT'].startswith(path))
     self.assertTrue(os.path.exists(args['STATIC_ROOT']))
     self.assertTrue(os.path.exists(args['MEDIA_ROOT']))
Ejemplo n.º 4
0
 def test_makemessages(self):
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['makemessages'] = True
             core(args, self.application)
             self.assertTrue(os.path.exists(self.pofile))
Ejemplo n.º 5
0
 def test_makemigrations_merge(self):
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['makemigrations'] = True
             args['--merge'] = True
             core(args, self.application)
             self.assertTrue('No conflicts detected to merge' in out.getvalue())
Ejemplo n.º 6
0
 def test_any_command_check(self):
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['<command>'] = 'check'
             args['options'] = ['helper', 'check', '--extra-settings=cms_helper_extra.py']
             core(args, self.application)
     self.assertTrue('no issues' in out.getvalue())
Ejemplo n.º 7
0
 def test_compilemessages(self):
     with work_in(self.basedir):
         with captured_output() as (out, err):
             shutil.copy(self.poexample, self.pofile)
             args = copy(DEFAULT_ARGS)
             args['compilemessages'] = True
             core(args, self.application)
             self.assertTrue(os.path.exists(self.mofile))
Ejemplo n.º 8
0
 def test_authors(self):
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['authors'] = True
             core(args, self.application)
     self.assertTrue('Generating AUTHORS' in out.getvalue())
     self.assertTrue('* Iacopo Spalletti' in out.getvalue())
     self.assertTrue('Authors (' in out.getvalue())
Ejemplo n.º 9
0
 def test_authors(self):
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['authors'] = True
             core(args, self.application)
     self.assertTrue('Generating AUTHORS' in out.getvalue())
     self.assertTrue('* Iacopo Spalletti' in out.getvalue())
     self.assertTrue('Authors (' in out.getvalue())
Ejemplo n.º 10
0
 def test_any_command_compilemessages(self):
     with work_in(os.path.join(self.basedir, self.application)):
         with captured_output() as (out, err):
             shutil.copy(self.poexample, self.pofile)
             args = copy(DEFAULT_ARGS)
             args['<command>'] = 'compilemessages'
             args['options'] = 'helper compilemessages --cms -len --verbosity=2'.split(' ')
             core(args, self.application)
             self.assertTrue(os.path.exists(self.mofile))
Ejemplo n.º 11
0
 def test_any_command_compilemessages(self):
     with work_in(os.path.join(self.basedir, self.application)):
         with captured_output() as (out, err):
             shutil.copy(self.poexample, self.pofile)
             args = copy(DEFAULT_ARGS)
             args['<command>'] = 'compilemessages'
             args['options'] = 'helper compilemessages --cms -len --verbosity=2'.split(' ')
             core(args, self.application)
             self.assertTrue(os.path.exists(self.mofile))
Ejemplo n.º 12
0
 def test_server(self, mocked_command):
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['server'] = True
             core(args, self.application)
         self.assertTrue(
             'A admin user (username: admin, password: admin) has been created.' in
             out.getvalue()
         )
Ejemplo n.º 13
0
 def test_testrun(self):
     with work_in(self.basedir):
         with captured_output() as (out, err):
             with self.assertRaises(SystemExit) as exit:
                 args = copy(DEFAULT_ARGS)
                 args['test'] = True
                 args['--runner'] = 'runners.CapturedOutputRunner'
                 core(args, self.application)
     self.assertTrue('Ran 6 tests in' in err.getvalue())
     self.assertEqual(exit.exception.code, 0)
Ejemplo n.º 14
0
 def test_pyflakes(self):
     try:
         import cms
     except ImportError:
         raise unittest.SkipTest('django CMS not available, skipping test')
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['pyflakes'] = True
             core(args, self.application)
Ejemplo n.º 15
0
 def test_server(self, mocked_command):
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['server'] = True
             core(args, self.application)
         self.assertTrue(
             'A admin user (username: admin, password: admin) has been created.' in
             out.getvalue()
         )
Ejemplo n.º 16
0
 def test_testrun(self):
     with work_in(self.basedir):
         with captured_output() as (out, err):
             with self.assertRaises(SystemExit) as exit:
                 args = copy(DEFAULT_ARGS)
                 args['test'] = True
                 args['--runner'] = 'runners.CapturedOutputRunner'
                 core(args, self.application)
     self.assertTrue('Ran 6 tests in' in err.getvalue())
     self.assertEqual(exit.exception.code, 0)
Ejemplo n.º 17
0
 def skip_test_makemigrations_update(self):
     os.makedirs(self.migration_dir)
     open(os.path.join(self.migration_dir, '__init__.py'), 'w')
     shutil.copy(self.migration_partial, self.migration_file)
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['makemigrations'] = True
             core(args, self.application)
     self.assertTrue('Migrations for \'example1\':' in out.getvalue())
Ejemplo n.º 18
0
 def test_pyflakes(self):
     try:
         import cms
     except ImportError:
         raise unittest.SkipTest('django CMS not available, skipping test')
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['pyflakes'] = True
             core(args, self.application)
Ejemplo n.º 19
0
 def test_urls_nocms(self):
     from django.core.urlresolvers import reverse, NoReverseMatch
     with work_in(self.basedir):
         with captured_output() as (out, err):
             shutil.copy(self.poexample, self.pofile)
             args = copy(DEFAULT_ARGS)
             args['makemessages'] = True
             args['--cms'] = False
             core(args, self.application)
             with self.assertRaises(NoReverseMatch):
                 reverse('pages-root')
Ejemplo n.º 20
0
 def test_any_command_migrations(self):
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['<command>'] = 'makemigrations'
             args['options'] = 'helper makemigrations example2 --verbosity=2'.split(' ')
             core(args, self.application)
         self.assertFalse('Create model ExampleModel1' in out.getvalue())
         self.assertFalse(os.path.exists(self.migration_file))
         self.assertTrue('Create model ExampleModel2' in out.getvalue())
         self.assertTrue(os.path.exists(self.migration_file_2))
Ejemplo n.º 21
0
 def test_makemigrations(self):
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['makemigrations'] = True
             args['<extra-applications>'] = ['example2']
             core(args, self.application)
         self.assertTrue(os.path.exists(self.migration_file))
         self.assertTrue(os.path.exists(self.migration_file_2))
     self.assertTrue('Create model ExampleModel1' in out.getvalue())
     self.assertTrue('Create model ExampleModel2' in out.getvalue())
Ejemplo n.º 22
0
 def test_urls_nocms(self):
     from django.core.urlresolvers import reverse, NoReverseMatch
     with work_in(self.basedir):
         with captured_output() as (out, err):
             shutil.copy(self.poexample, self.pofile)
             args = copy(DEFAULT_ARGS)
             args['makemessages'] = True
             args['--cms'] = False
             core(args, self.application)
             with self.assertRaises(NoReverseMatch):
                 reverse('pages-root')
Ejemplo n.º 23
0
 def test_any_command_migrations(self):
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['<command>'] = 'makemigrations'
             args['options'] = 'helper makemigrations example2 --verbosity=2'.split(' ')
             core(args, self.application)
         self.assertFalse('Create model ExampleModel1' in out.getvalue())
         self.assertFalse(os.path.exists(self.migration_file))
         self.assertTrue('Create model ExampleModel2' in out.getvalue())
         self.assertTrue(os.path.exists(self.migration_file_2))
Ejemplo n.º 24
0
 def test_any_command_check(self):
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['<command>'] = 'check'
             args['options'] = ['helper', 'check', '--extra-settings=cms_helper_extra.py']
             core(args, self.application)
     if DJANGO_1_7:
         # Django 1.7 complains about the test runner ... go figure ...
         self.assertTrue('1 issue' in err.getvalue())
     else:
         self.assertTrue('no issues' in out.getvalue())
Ejemplo n.º 25
0
 def test_urls(self):
     try:
         import cms
     except ImportError:
         raise unittest.SkipTest('django CMS not available, skipping test')
     from django.core.urlresolvers import reverse
     with work_in(self.basedir):
         with captured_output() as (out, err):
             shutil.copy(self.poexample, self.pofile)
             args = copy(DEFAULT_ARGS)
             args['makemessages'] = True
             core(args, self.application)
             self.assertTrue(reverse('pages-root'))
Ejemplo n.º 26
0
 def test_urls(self):
     try:
         import cms
     except ImportError:
         raise unittest.SkipTest('django CMS not available, skipping test')
     from django.core.urlresolvers import reverse
     with work_in(self.basedir):
         with captured_output() as (out, err):
             shutil.copy(self.poexample, self.pofile)
             args = copy(DEFAULT_ARGS)
             args['makemessages'] = True
             core(args, self.application)
             self.assertTrue(reverse('pages-root'))
Ejemplo n.º 27
0
 def test_testrun_native(self):
     try:
         import cms
     except ImportError:
         raise unittest.SkipTest('django CMS not available, skipping test')
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['<command>'] = 'test'
             args['--cms'] = False
             args['--native'] = True
             args['--extra-settings'] = 'cms_helper_extra_runner.py'
             core(args, self.application)
     self.assertTrue('Ran 12 tests in' in err.getvalue())
Ejemplo n.º 28
0
 def test_makemigrations_empty(self):
     with work_in(self.basedir):
         with captured_output() as (out, err):
             os.makedirs(self.migration_dir)
             open(os.path.join(self.migration_dir, '__init__.py'), 'w')
             shutil.copy(self.migration_example, self.migration_file)
             args = copy(DEFAULT_ARGS)
             args['makemigrations'] = True
             args['--empty'] = True
             core(args, self.application)
     if DJANGO_1_6:
         self.assertTrue('You must now edit this migration' in err.getvalue())
     else:
         self.assertTrue('Migrations for \'example1\':' in out.getvalue())
Ejemplo n.º 29
0
 def test_cms_check_nocms_19(self):
     try:
         import cms
         raise unittest.SkipTest('django CMS available, skipping test')
     except ImportError:
         pass
     with work_in(self.basedir):
         with self.assertRaises(ImportError):
             shutil.copy(self.poexample, self.pofile)
             args = copy(DEFAULT_ARGS)
             args['cms_check'] = True
             args['--extra-settings'] = 'cms_helper.py'
             args['--migrate'] = False
             core(args, self.application)
Ejemplo n.º 30
0
 def test_pyflakes_nocms(self):
     try:
         import cms
         raise unittest.SkipTest('django CMS available, skipping test')
     except ImportError:
         pass
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['pyflakes'] = True
             core(args, self.application)
         self.assertTrue('Static analysis available only if django CMS is installed' in out.getvalue())
     self.assertFalse(os.path.exists(args['STATIC_ROOT']))
     self.assertFalse(os.path.exists(args['MEDIA_ROOT']))
Ejemplo n.º 31
0
 def test_makemigrations_merge(self):
     from django.core.exceptions import DjangoRuntimeWarning
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['makemigrations'] = True
             args['--merge'] = True
             if DJANGO_1_6:
                 with self.assertRaises(DjangoRuntimeWarning) as exit:
                     core(args, self.application)
                 self.assertEqual(force_text(exit.exception), 'Option not implemented for Django 1.6 and below')
             else:
                 core(args, self.application)
                 self.assertTrue('No conflicts detected to merge' in out.getvalue())
Ejemplo n.º 32
0
 def test_cms_check_nocms_19(self):
     try:
         import cms
         raise unittest.SkipTest('django CMS available, skipping test')
     except ImportError:
         pass
     with work_in(self.basedir):
         with self.assertRaises(ImportError):
             shutil.copy(self.poexample, self.pofile)
             args = copy(DEFAULT_ARGS)
             args['cms_check'] = True
             args['--extra-settings'] = 'cms_helper.py'
             args['--migrate'] = False
             core(args, self.application)
Ejemplo n.º 33
0
 def test_testrun_native(self):
     try:
         import cms
     except ImportError:
         raise unittest.SkipTest('django CMS not available, skipping test')
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['<command>'] = 'test'
             args['--cms'] = False
             args['--native'] = True
             args['--extra-settings'] = 'cms_helper_extra_runner.py'
             core(args, self.application)
     self.assertTrue('Ran 12 tests in' in err.getvalue())
Ejemplo n.º 34
0
 def test_pyflakes_nocms(self):
     try:
         import cms
         raise unittest.SkipTest('django CMS available, skipping test')
     except ImportError:
         pass
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['pyflakes'] = True
             core(args, self.application)
         self.assertTrue('Static analisys available only if django CMS is installed' in out.getvalue())
     self.assertFalse(os.path.exists(args['STATIC_ROOT']))
     self.assertFalse(os.path.exists(args['MEDIA_ROOT']))
Ejemplo n.º 35
0
 def skip_test_makemigrations_update(self):
     os.makedirs(self.migration_dir)
     open(os.path.join(self.migration_dir, '__init__.py'), 'w')
     shutil.copy(self.migration_partial, self.migration_file)
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['makemigrations'] = True
             core(args, self.application)
     if DJANGO_1_6:
         #self.assertTrue('+ Added field test_field on example1.ExampleModel1' in err.getvalue())
         self.assertTrue('You can now apply this migration' in err.getvalue())
     else:
         self.assertTrue('Migrations for \'example1\':' in out.getvalue())
Ejemplo n.º 36
0
 def test_any_command_check(self):
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['<command>'] = 'check'
             args['options'] = [
                 'helper', 'check', '--extra-settings=cms_helper_extra.py'
             ]
             core(args, self.application)
     if DJANGO_1_7:
         # Django 1.7 complains about the test runner ... go figure ...
         self.assertTrue('1 issue' in err.getvalue())
     else:
         self.assertTrue('no issues' in out.getvalue())
Ejemplo n.º 37
0
 def test_cms_check_nocms(self):
     try:
         import cms
         raise unittest.SkipTest('django CMS available, skipping test')
     except ImportError:
         pass
     with work_in(self.basedir):
         with captured_output() as (out, err):
             shutil.copy(self.poexample, self.pofile)
             args = copy(DEFAULT_ARGS)
             args['cms_check'] = True
             args['--extra-settings'] = 'cms_helper.py'
             args['--migrate'] = False
             core(args, self.application)
         self.assertTrue('cms_check available only if django CMS is installed' in out.getvalue())
Ejemplo n.º 38
0
 def test_testrun_nocms(self):
     try:
         import cms
     except ImportError:
         raise unittest.SkipTest('django CMS not available, skipping test')
     with work_in(self.basedir):
         with captured_output() as (out, err):
             with self.assertRaises(SystemExit) as exit:
                 args = copy(DEFAULT_ARGS)
                 args['test'] = True
                 args['--cms'] = False
                 args['--runner'] = 'runners.CapturedOutputRunner'
                 core(args, self.application)
     self.assertTrue('Ran 6 tests in' in err.getvalue())
     self.assertEqual(exit.exception.code, 0)
Ejemplo n.º 39
0
 def skip_test_makemigrations_update(self):
     os.makedirs(self.migration_dir)
     open(os.path.join(self.migration_dir, '__init__.py'), 'w')
     shutil.copy(self.migration_partial, self.migration_file)
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['makemigrations'] = True
             core(args, self.application)
     if DJANGO_1_6:
         #self.assertTrue('+ Added field test_field on example1.ExampleModel1' in err.getvalue())
         self.assertTrue(
             'You can now apply this migration' in err.getvalue())
     else:
         self.assertTrue('Migrations for \'example1\':' in out.getvalue())
Ejemplo n.º 40
0
 def test_cms_check(self):
     try:
         import cms
     except ImportError:
         raise unittest.SkipTest('django CMS not available, skipping test')
     with work_in(self.basedir):
         with captured_output() as (out, err):
             shutil.copy(self.poexample, self.pofile)
             args = copy(DEFAULT_ARGS)
             args['cms_check'] = True
             args['--migrate'] = False
             core(args, self.application)
         self.assertTrue('Installation okay' in out.getvalue())
         self.assertFalse('[WARNING]' in out.getvalue())
         self.assertFalse('[ERROR]' in out.getvalue())
Ejemplo n.º 41
0
 def test_testrun_nocms(self):
     try:
         import cms
     except ImportError:
         raise unittest.SkipTest('django CMS not available, skipping test')
     with work_in(self.basedir):
         with captured_output() as (out, err):
             with self.assertRaises(SystemExit) as exit:
                 args = copy(DEFAULT_ARGS)
                 args['test'] = True
                 args['--cms'] = False
                 args['--runner'] = 'runners.CapturedOutputRunner'
                 core(args, self.application)
     self.assertTrue('Ran 6 tests in' in err.getvalue())
     self.assertEqual(exit.exception.code, 0)
Ejemplo n.º 42
0
 def test_makemigrations_empty(self):
     with work_in(self.basedir):
         with captured_output() as (out, err):
             os.makedirs(self.migration_dir)
             open(os.path.join(self.migration_dir, '__init__.py'), 'w')
             shutil.copy(self.migration_example, self.migration_file)
             args = copy(DEFAULT_ARGS)
             args['makemigrations'] = True
             args['--empty'] = True
             core(args, self.application)
     if DJANGO_1_6:
         self.assertTrue(
             'You must now edit this migration' in err.getvalue())
     else:
         self.assertTrue('Migrations for \'example1\':' in out.getvalue())
Ejemplo n.º 43
0
 def test_cms_check_nocms(self):
     try:
         import cms
         raise unittest.SkipTest('django CMS available, skipping test')
     except ImportError:
         pass
     with work_in(self.basedir):
         with captured_output() as (out, err):
             shutil.copy(self.poexample, self.pofile)
             args = copy(DEFAULT_ARGS)
             args['cms_check'] = True
             args['--extra-settings'] = 'cms_helper.py'
             args['--migrate'] = False
             core(args, self.application)
         self.assertTrue('cms_check available only if django CMS is installed' in out.getvalue())
Ejemplo n.º 44
0
 def test_cms_check(self):
     try:
         import cms
     except ImportError:
         raise unittest.SkipTest('django CMS not available, skipping test')
     with work_in(self.basedir):
         with captured_output() as (out, err):
             shutil.copy(self.poexample, self.pofile)
             args = copy(DEFAULT_ARGS)
             args['cms_check'] = True
             args['--migrate'] = False
             core(args, self.application)
         self.assertTrue('Installation okay' in out.getvalue())
         self.assertFalse('[WARNING]' in out.getvalue())
         self.assertFalse('[ERROR]' in out.getvalue())
Ejemplo n.º 45
0
 def test_testrun_nocms(self):
     with work_in(self.basedir):
         with captured_output() as (out, err):
             with self.assertRaises(SystemExit) as exit:
                 try:
                     from django.test.utils import _TestState
                     del _TestState.saved_data
                 except (ImportError, AttributeError):
                     pass
                 args = copy(DEFAULT_ARGS)
                 args['test'] = True
                 args['--cms'] = False
                 args['--runner'] = 'runners.CapturedOutputRunner'
                 core(args, self.application)
     self.assertTrue('Ran 14 tests in' in err.getvalue())
     self.assertEqual(exit.exception.code, 0)
Ejemplo n.º 46
0
 def test_makemigrations(self):
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['makemigrations'] = True
             args['<extra-applications>'] = ['example2']
             core(args, self.application)
         self.assertTrue(os.path.exists(self.migration_file))
         self.assertTrue(os.path.exists(self.migration_file_2))
     if DJANGO_1_6:
         self.assertTrue('Created 0001_initial.py' in err.getvalue())
         self.assertTrue('migrate example1' in err.getvalue())
         self.assertTrue('migrate example2' in err.getvalue())
     else:
         self.assertTrue('Create model ExampleModel1' in out.getvalue())
         self.assertTrue('Create model ExampleModel2' in out.getvalue())
Ejemplo n.º 47
0
 def test_makemigrations_existing_folder(self):
     os.makedirs(self.migration_dir)
     os.makedirs(self.migration_dir_2)
     open(os.path.join(self.migration_dir, '__init__.py'), 'w')
     open(os.path.join(self.migration_dir_2, '__init__.py'), 'w')
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['makemigrations'] = True
             args['<extra-applications>'] = ['example2']
             core(args, self.application)
         self.assertTrue(os.path.exists(self.migration_file))
         self.assertTrue(os.path.exists(self.migration_file_2))
     self.assertTrue('Created 0001_initial.py' in err.getvalue())
     self.assertTrue('migrate example1' in err.getvalue())
     self.assertTrue('migrate example2' in err.getvalue())
Ejemplo n.º 48
0
 def test_makemigrations_existing_folder(self):
     os.makedirs(self.migration_dir)
     os.makedirs(self.migration_dir_2)
     open(os.path.join(self.migration_dir, '__init__.py'), 'w')
     open(os.path.join(self.migration_dir_2, '__init__.py'), 'w')
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['makemigrations'] = True
             args['<extra-applications>'] = ['example2']
             core(args, self.application)
         self.assertTrue(os.path.exists(self.migration_file))
         self.assertTrue(os.path.exists(self.migration_file_2))
     self.assertTrue('Created 0001_initial.py' in err.getvalue())
     self.assertTrue('migrate example1' in err.getvalue())
     self.assertTrue('migrate example2' in err.getvalue())
Ejemplo n.º 49
0
 def test_makemigrations_merge(self):
     from django.core.exceptions import DjangoRuntimeWarning
     with work_in(self.basedir):
         with captured_output() as (out, err):
             args = copy(DEFAULT_ARGS)
             args['makemigrations'] = True
             args['--merge'] = True
             if DJANGO_1_6:
                 with self.assertRaises(DjangoRuntimeWarning) as exit:
                     core(args, self.application)
                 self.assertEqual(
                     force_text(exit.exception),
                     'Option not implemented for Django 1.6 and below')
             else:
                 core(args, self.application)
                 self.assertTrue(
                     'No conflicts detected to merge' in out.getvalue())
Ejemplo n.º 50
0
 def test_testrun(self):
     try:
         import cms
     except ImportError:
         raise unittest.SkipTest('django CMS not available, skipping test')
     with work_in(self.basedir):
         with captured_output() as (out, err):
             with self.assertRaises(SystemExit) as exit:
                 args = copy(DEFAULT_ARGS)
                 args['test'] = True
                 args['--persistent'] = mkdtemp()
                 args['--runner'] = 'runners.CapturedOutputRunner'
                 core(args, self.application)
     self.assertTrue('Ran 12 tests in' in err.getvalue())
     self.assertEqual(exit.exception.code, 0)
     self.assertTrue(os.path.exists(args['STATIC_ROOT']))
     self.assertTrue(os.path.exists(args['MEDIA_ROOT']))
Ejemplo n.º 51
0
 def test_testrun(self):
     try:
         import cms
     except ImportError:
         raise unittest.SkipTest('django CMS not available, skipping test')
     with work_in(self.basedir):
         with captured_output() as (out, err):
             with self.assertRaises(SystemExit) as exit:
                 args = copy(DEFAULT_ARGS)
                 args['test'] = True
                 args['--persistent'] = mkdtemp()
                 args['--runner'] = 'runners.CapturedOutputRunner'
                 core(args, self.application)
     self.assertTrue('Ran 12 tests in' in err.getvalue())
     self.assertEqual(exit.exception.code, 0)
     self.assertTrue(os.path.exists(args['STATIC_ROOT']))
     self.assertTrue(os.path.exists(args['MEDIA_ROOT']))