コード例 #1
0
 def test_destroy_bucket_calls_api_method(self, list_buckets):
     data = {'some': ['json', 'data']}
     list_buckets.return_value = data
     with patch('sys.stdout', StringIO()) as stdout:
         config = json.dumps({'hello': "world"})
         imp('airship.core').main([str(self.tmp), 'list'])
     self.assertEqual(list_buckets.mock_calls, [call()])
     self.assertEqual(json.loads(stdout.getvalue()), data)
コード例 #2
0
ファイル: shell_test.py プロジェクト: mgax/airship
 def test_destroy_bucket_calls_api_method(self, list_buckets):
     data = {'some': ['json', 'data']}
     list_buckets.return_value = data
     with patch('sys.stdout', StringIO()) as stdout:
         config = json.dumps({'hello': "world"})
         imp('airship.core').main([str(self.tmp), 'list'])
     self.assertEqual(list_buckets.mock_calls, [call()])
     self.assertEqual(json.loads(stdout.getvalue()), data)
コード例 #3
0
    def test_init_creates_configuration_and_bin_scripts(self):
        other_tmp = path(tempfile.mkdtemp())
        self.addCleanup(other_tmp.rmtree)

        core = imp('airship.core')
        core.main([str(other_tmp), 'init'])
        expected = ['bin', 'etc', 'var']
        self.assertItemsEqual([f.name for f in other_tmp.listdir()], expected)
        self.assertItemsEqual([f.name for f in (other_tmp / 'bin').listdir()],
                              ['airship', 'supervisord', 'supervisorctl'])
        airship_yaml_path = other_tmp / 'etc' / 'airship.yaml'
        self.assertTrue(airship_yaml_path.isfile())
コード例 #4
0
ファイル: shell_test.py プロジェクト: mgax/airship
    def test_init_creates_configuration_and_bin_scripts(self):
        other_tmp = path(tempfile.mkdtemp())
        self.addCleanup(other_tmp.rmtree)

        core = imp('airship.core')
        core.main([str(other_tmp), 'init'])
        expected = ['bin', 'etc', 'var']
        self.assertItemsEqual([f.name for f in other_tmp.listdir()], expected)
        self.assertItemsEqual([f.name for f in (other_tmp / 'bin').listdir()],
                              ['airship', 'supervisord', 'supervisorctl'])
        airship_yaml_path = other_tmp / 'etc' / 'airship.yaml'
        self.assertTrue(airship_yaml_path.isfile())
コード例 #5
0
ファイル: route.py プロジェクト: sunzhqiiang888/KingSun
    def dispatch(self):
        if self.isStaticRequest():
            return StaticResponse(self.config.ROOT + self.request.path)

        call = imp(self.request.mod, self.request.controller, self.package)
        return call(self.request, *self.request.args)
コード例 #6
0
 def test_run_bucket_quotes_its_arguments(self, run):
     bucket = self.create_airship().new_bucket()
     imp('airship.core').main([str(self.tmp), 'run', 'some', 'other thing'])
     self.assertEqual(run.mock_calls, [call("some 'other thing'")])
コード例 #7
0
 def test_run_bucket_does_not_require_bucket_id(self, run):
     bucket = self.create_airship().new_bucket()
     imp('airship.core').main([str(self.tmp), 'run', 'a'])
     self.assertEqual(run.mock_calls, [call('a')])
コード例 #8
0
 def test_run_bucket_calls_api_method_with_args(self, run):
     bucket = self.create_airship().new_bucket()
     imp('airship.core').main([str(self.tmp), 'run', '-d', bucket.id_, 'a'])
     self.assertEqual(run.mock_calls, [call('a')])
コード例 #9
0
 def test_destroy_bucket_calls_api_method(self, destroy):
     bucket = self.create_airship().new_bucket()
     imp('airship.core').main([str(self.tmp), 'destroy', '-d', bucket.id_])
     self.assertEqual(destroy.mock_calls, [call()])
コード例 #10
0
ファイル: shell_test.py プロジェクト: mgax/airship
 def test_run_bucket_quotes_its_arguments(self, run):
     bucket = self.create_airship().new_bucket()
     imp('airship.core').main([str(self.tmp), 'run', 'some', 'other thing'])
     self.assertEqual(run.mock_calls, [call("some 'other thing'")])
コード例 #11
0
ファイル: shell_test.py プロジェクト: mgax/airship
 def test_run_bucket_does_not_require_bucket_id(self, run):
     bucket = self.create_airship().new_bucket()
     imp('airship.core').main([str(self.tmp), 'run', 'a'])
     self.assertEqual(run.mock_calls, [call('a')])
コード例 #12
0
ファイル: shell_test.py プロジェクト: mgax/airship
 def test_run_bucket_calls_api_method_with_args(self, run):
     bucket = self.create_airship().new_bucket()
     imp('airship.core').main([str(self.tmp), 'run', '-d', bucket.id_, 'a'])
     self.assertEqual(run.mock_calls, [call('a')])
コード例 #13
0
ファイル: shell_test.py プロジェクト: mgax/airship
 def test_destroy_bucket_calls_api_method(self, destroy):
     bucket = self.create_airship().new_bucket()
     imp('airship.core').main([str(self.tmp), 'destroy', '-d', bucket.id_])
     self.assertEqual(destroy.mock_calls, [call()])
コード例 #14
0
 def loadApp(appname):
     Config.load(**imp(Config.NAME['CONF'], 'CONFIG', appname))