1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
3
# Copyright 2010 United States Government as represented by the
4
# Administrator of the National Aeronautics and Space Administration.
7
# Licensed under the Apache License, Version 2.0 (the "License"); you may
8
# not use this file except in compliance with the License. You may obtain
9
# a copy of the License at
11
# http://www.apache.org/licenses/LICENSE-2.0
13
# Unless required by applicable law or agreed to in writing, software
14
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
# License for the specific language governing permissions and limitations
22
from nova import twistd
23
from nova import exception
24
from nova import flags
31
class TwistdTestCase(test.TrialTestCase):
33
super(TwistdTestCase, self).setUp()
34
self.Options = twistd.WrapTwistedOptions(twistd.TwistdServerOptions)
35
sys.stdout = StringIO.StringIO()
38
super(TwistdTestCase, self).tearDown()
39
sys.stdout = sys.__stdout__
42
options = self.Options()
43
argv = options.parseOptions()
45
def test_logfile(self):
46
options = self.Options()
47
argv = options.parseOptions(['--logfile=foo'])
48
self.assertEqual(FLAGS.logfile, 'foo')
51
options = self.Options()
52
self.assertRaises(SystemExit, options.parseOptions, ['--help'])
53
self.assert_('pidfile' in sys.stdout.getvalue())