示例#1
0
 def test_runs_makemigrations(self, call_command, subpr):
     scaffold.start_project(self.args, self.path)
     subpr.assert_any_call([
         'python',
         os.path.join('testapp', 'manage.py'), 'makemigrations', 'testapp',
         '--traceback'
     ])
示例#2
0
 def test_sets_random_secret_key(self, os, subpr):
     with patch.object(scaffold, 'get_random_secret_key') as rnd:
         rnd.return_value = 'MyRandomKey'
         scaffold.start_project(self.args, self.path)
         settings = self.path/'testapp/testapp/settings.py'
         self.assertTrue("SECRET_KEY = 'MyRandomKey'" in settings.contents)
         rnd.assert_called_with()
示例#3
0
 def test_creates_requirements(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     requirements = self.path / 'testapp/requirements.txt'
     self.assertTrue(bool(requirements))
     with open(requirements) as r:
         contents = r.read()
         self.assertIn('opal=={}'.format(opal.__version__), contents)
示例#4
0
 def test_runs_createopalsuperuser(self, call_command, subpr):
     scaffold.start_project(self.args, self.path)
     subpr.assert_any_call([
         'python',
         os.path.join('testapp', 'manage.py'), 'createopalsuperuser',
         '--traceback'
     ])
示例#5
0
 def test_calls_interpolate_dir(self, os, subpr):
     with patch.object(scaffold, 'interpolate_dir') as interpolate:
         with patch.object(scaffold, 'get_random_secret_key') as rnd:
             rnd.return_value = 'foobarbaz'
             scaffold.start_project(self.args, self.path)
             interpolate.assert_any_call(self.path/'testapp', name='testapp',
                                         secret_key='foobarbaz')
示例#6
0
 def test_sets_random_secret_key(self, os, subpr):
     with patch.object(scaffold, 'get_random_secret_key') as rnd:
         rnd.return_value = 'MyRandomKey'
         scaffold.start_project(self.args, self.path)
         settings = self.path / 'testapp/testapp/settings.py'
         self.assertTrue("SECRET_KEY = 'MyRandomKey'" in settings.contents)
         rnd.assert_called_with()
示例#7
0
 def test_creates_requirements(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     requirements = self.path/'testapp/requirements.txt'
     self.assertTrue(bool(requirements))
     with open(requirements) as r:
         contents = r.read()
         self.assertIn('opal=={}'.format(opal.__version__), contents)
示例#8
0
 def test_if_subprocess_errors(self, exiter, os, subpr):
     subpr.side_effect = subprocess.CalledProcessError(None, None)
     scaffold.start_project(self.args, self.path)
     subpr.assert_any_call([
         'python', 'testapp/manage.py', 'makemigrations', 'testapp',
         '--traceback'
     ])
     exiter.assert_any_call(1)
示例#9
0
 def test_calls_interpolate_dir(self, os, subpr):
     with patch.object(scaffold, 'interpolate_dir') as interpolate:
         with patch.object(scaffold, 'get_random_secret_key') as rnd:
             rnd.return_value = 'foobarbaz'
             scaffold.start_project(self.args, self.path)
             interpolate.assert_any_call(self.path/'testapp', name='testapp',
                                         secret_key='foobarbaz',
                                         version=opal.__version__)
示例#10
0
 def test_creates_manifest(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     manifest = self.path / 'testapp/MANIFEST.in'
     self.assertTrue(bool(manifest))
     with open(manifest) as m:
         contents = m.read()
         self.assertIn("recursive-include testapp/static *", contents)
         self.assertIn("recursive-include testapp/templates *", contents)
         self.assertIn("recursive-include testapp/assets *", contents)
示例#11
0
 def test_creates_manifest(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     manifest = self.path/'testapp/MANIFEST.in'
     self.assertTrue(bool(manifest))
     with open(manifest) as m:
         contents = m.read()
         self.assertIn("recursive-include testapp/static *", contents)
         self.assertIn("recursive-include testapp/templates *", contents)
         self.assertIn("recursive-include testapp/assets *", contents)
示例#12
0
 def test_has_named_templates_dir(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     templates = self.path / 'testapp/testapp/templates/testapp'
     self.assertTrue(templates.is_dir)
示例#13
0
 def test_has_js_routes(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     routes = self.path / 'testapp/testapp/static/js/testapp/routes.js'
     self.assertTrue(routes.is_file)
示例#14
0
 def test_runs_makemigrations(self, call_command, subpr):
     scaffold.start_project(self.args, self.path)
     subpr.assert_any_call(['python', os.path.join('testapp', 'manage.py'),
                               'makemigrations', 'testapp', '--traceback'])
示例#15
0
 def test_has_gitignore(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     gitignore = self.path / 'testapp/.gitignore'
     self.assertTrue(gitignore.is_file)
示例#16
0
 def test_run_django_start_project(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     os.assert_any_call('django-admin.py startproject testapp')
示例#17
0
 def test_runs_createopalsuperuser(self, call_command, subpr):
     scaffold.start_project(self.args, self.path)
     subpr.assert_any_call(['python', os.path.join('testapp', 'manage.py'),
                            'createopalsuperuser', '--traceback'])
示例#18
0
 def test_initialize_git(self, call_command, subpr):
     scaffold.start_project(self.args, self.path)
     subpr.assert_any_call(('git', 'init'),
                           cwd=self.path/'testapp',
                           stdout=subprocess.PIPE)
示例#19
0
 def test_has_assets_readme(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     readme = self.path/'testapp/testapp/assets/README.md'
     self.assertTrue(readme.is_file)
示例#20
0
 def test_has_named_templates_dir(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     templates = self.path/'testapp/testapp/templates/testapp'
     self.assertTrue(templates.is_dir)
示例#21
0
 def test_has_assets_dir(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     assets = self.path/'testapp/testapp/assets'
     self.assertTrue(assets.is_dir)
示例#22
0
 def test_js_has_flow(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     flow = self.path/'testapp/testapp/static/js/testapp/flow.js'
     self.assertTrue(flow.is_file)
示例#23
0
 def test_has_js_routes(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     routes = self.path/'testapp/testapp/static/js/testapp/routes.js'
     self.assertTrue(routes.is_file)
示例#24
0
 def test_has_css_dir(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     css_dir = self.path/'testapp/testapp/static/css'
     self.assertTrue(css_dir.is_dir)
示例#25
0
 def test_has_assets_readme(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     readme = self.path / 'testapp/testapp/assets/README.md'
     self.assertTrue(readme.is_file)
示例#26
0
 def test_if_subprocess_errors(self, exiter, os, subpr):
     subpr.side_effect = subprocess.CalledProcessError(None, None)
     scaffold.start_project(self.args, self.path)
     subpr.assert_any_call(['python', 'testapp/manage.py',
                               'makemigrations', 'testapp', '--traceback'])
     exiter.assert_any_call(1)
示例#27
0
 def test_has_gitignore(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     gitignore = self.path/'testapp/.gitignore'
     self.assertTrue(gitignore.is_file)
示例#28
0
 def test_runs_migrate(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     subpr.assert_any_call(['python', 'testapp/manage.py',
                            'migrate', '--traceback'])
示例#29
0
 def test_initialize_git(self, call_command, subpr):
     scaffold.start_project(self.args, self.path)
     subpr.assert_any_call(('git', 'init'),
                           cwd=self.path / 'testapp',
                           stdout=subprocess.PIPE)
示例#30
0
 def test_sets_settings(self, os, subpr):
     with patch.object(scaffold, '_set_settings_module') as settings:
         scaffold.start_project(self.args, self.path)
         settings.assert_called_with('testapp')
示例#31
0
 def test_bail_if_exists(self, os, sub):
     preexisting = self.path / 'testapp'
     preexisting.mkdir()
     with patch.object(scaffold.sys, 'exit') as exiter:
         scaffold.start_project(self.args, self.path)
         exiter.assert_called_with(1)
示例#32
0
 def test_has_lookuplists_dir(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     lookuplists = self.path/'testapp/testapp/data/lookuplists/'
     self.assertTrue(bool(lookuplists))
示例#33
0
 def test_has_lookuplists_dir(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     lookuplists = self.path / 'testapp/testapp/data/lookuplists/'
     self.assertTrue(bool(lookuplists))
示例#34
0
 def test_sets_settings(self, os, subpr):
     with patch.object(scaffold, '_set_settings_module') as settings:
         scaffold.start_project(self.args, self.path)
         settings.assert_called_with('testapp')
示例#35
0
 def test_settings_is_our_settings(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     settings = self.path / 'testapp/testapp/settings.py'
     self.assertTrue('opal' in settings.contents)
示例#36
0
 def test_run_django_start_project(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     os.assert_any_call('django-admin.py startproject testapp')
示例#37
0
 def test_has_css_dir(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     css_dir = self.path / 'testapp/testapp/static/css'
     self.assertTrue(css_dir.is_dir)
示例#38
0
 def test_has_js_dir(self, call_command, subpr):
     scaffold.start_project(self.args, self.path)
     js_dir = self.path/'testapp/testapp/static/js'
     self.assertTrue(js_dir.is_dir)
示例#39
0
 def test_js_has_flow(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     flow = self.path / 'testapp/testapp/static/js/testapp/flow.js'
     self.assertTrue(flow.is_file)
示例#40
0
 def test_has_js_dir(self, call_command, subpr):
     scaffold.start_project(self.args, self.path)
     js_dir = self.path / 'testapp/testapp/static/js'
     self.assertTrue(js_dir.is_dir)
示例#41
0
 def test_has_assets_dir(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     assets = self.path / 'testapp/testapp/assets'
     self.assertTrue(assets.is_dir)
示例#42
0
 def test_bail_if_exists(self, os, sub):
     preexisting = self.path/'testapp'
     preexisting.mkdir()
     with patch.object(scaffold.sys, 'exit') as exiter:
         scaffold.start_project(self.args, self.path)
         exiter.assert_called_with(1)
示例#43
0
 def test_initialize_git(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     os.assert_any_call('cd testapp; git init')
示例#44
0
 def test_settings_is_our_settings(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     settings = self.path/'testapp/testapp/settings.py'
     self.assertTrue('opal' in settings.contents)
示例#45
0
 def test_runs_migrate(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     subpr.assert_any_call(
         ['python', 'testapp/manage.py', 'migrate', '--traceback'])
示例#46
0
def startproject(args):
    scaffold_utils.start_project(args.name, USERLAND_HERE)
    return
示例#47
0
 def test_initialize_git(self, os, subpr):
     scaffold.start_project(self.args, self.path)
     os.assert_any_call('cd testapp; git init')
示例#48
0
 def test_run_django_start_project(self, call_command, subpr):
     scaffold.start_project(self.args, self.path)
     call_command.assert_any_call('startproject', 'testapp',
                                  self.path / 'testapp')
示例#49
0
def startproject(args):
    scaffold_utils.start_project(args.name, USERLAND_HERE)
    return
示例#50
0
 def test_run_django_start_project(self, call_command, subpr):
     scaffold.start_project(self.args, self.path)
     call_command.assert_any_call('startproject', 'testapp',
                                  self.path/'testapp')