~ubuntu-branches/ubuntu/saucy/nova/saucy-proposed

« back to all changes in this revision

Viewing changes to nova/tests/test_flags.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-05-24 13:12:53 UTC
  • mfrom: (1.1.55)
  • Revision ID: package-import@ubuntu.com-20120524131253-ommql08fg1en06ut
Tags: 2012.2~f1-0ubuntu1
* New upstream release.
* Prepare for quantal:
  - Dropped debian/patches/upstream/0006-Use-project_id-in-ec2.cloud._format_image.patch
  - Dropped debian/patches/upstream/0005-Populate-image-properties-with-project_id-again.patch
  - Dropped debian/patches/upstream/0004-Fixed-bug-962840-added-a-test-case.patch
  - Dropped debian/patches/upstream/0003-Allow-unprivileged-RADOS-users-to-access-rbd-volumes.patch
  - Dropped debian/patches/upstream/0002-Stop-libvirt-test-from-deleting-instances-dir.patch
  - Dropped debian/patches/upstream/0001-fix-bug-where-nova-ignores-glance-host-in-imageref.patch 
  - Dropped debian/patches/0001-fix-useexisting-deprecation-warnings.patch
* debian/control: Add python-keystone as a dependency. (LP: #907197)
* debian/patches/kombu_tests_timeout.patch: Refreshed.
* debian/nova.conf, debian/nova-common.postinst: Convert to new ini
  file configuration
* debian/patches/nova-manage_flagfile_location.patch: Refreshed

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
        self.reset_flags()
100
100
        self.assertEqual(FLAGS.flags_unittest, 'foo')
101
101
 
102
 
    def test_flagfile(self):
103
 
        opts = [
104
 
            cfg.StrOpt('string', default='default', help='desc'),
105
 
            cfg.IntOpt('int', default=1, help='desc'),
106
 
            cfg.BoolOpt('false', default=False, help='desc'),
107
 
            cfg.BoolOpt('true', default=True, help='desc'),
108
 
            cfg.MultiStrOpt('multi', default=['blaa'], help='desc'),
109
 
            ]
110
 
 
111
 
        self.FLAGS.register_opts(opts)
112
 
 
113
 
        (fd, path) = tempfile.mkstemp(prefix='nova', suffix='.flags')
114
 
 
115
 
        try:
116
 
            os.write(fd, '--string=foo\n--int=2\n--false\n--notrue\n')
117
 
            os.write(fd, '--multi=bar\n')
118
 
            os.close(fd)
119
 
 
120
 
            self.FLAGS(['flags_test', '--flagfile=' + path])
121
 
 
122
 
            self.assertEqual(self.FLAGS.string, 'foo')
123
 
            self.assertEqual(self.FLAGS.int, 2)
124
 
            self.assertEqual(self.FLAGS.false, True)
125
 
            self.assertEqual(self.FLAGS.true, False)
126
 
            self.assertEqual(self.FLAGS.multi, ['bar'])
127
 
 
128
 
            # Re-parse to test multistring isn't append multiple times
129
 
            self.FLAGS(['flags_test', '--flagfile=' + path])
130
 
            self.assertEqual(self.FLAGS.multi, ['bar'])
131
 
        finally:
132
 
            os.remove(path)
133
 
 
134
102
    def test_defaults(self):
135
103
        self.FLAGS.register_opt(cfg.StrOpt('foo', default='bar', help='desc'))
136
104
        self.assertEqual(self.FLAGS.foo, 'bar')