~ubuntu-branches/ubuntu/raring/maas/raring-updates

« back to all changes in this revision

Viewing changes to src/provisioningserver/tests/test_plugin.py

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2012-07-03 17:42:37 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20120703174237-p8l0keuuznfg721k
Tags: 0.1+bzr709+dfsg-0ubuntu1
* New Upstream release
* debian/control:
  - Depends on python-celery, python-tempita, libjs-yui3-{full,min},
    libjs-raphael
* debian/maas.install:
  - Install apiclient, celeryconfig.py, maas-import-pxe-files, preseeds_v2.
  - Update to install various files from chroot, rather tha manually copy
    them from the source.
* debian/maas.links: symlink celeryconfig.py
* debian/maas.maas-celery.upstart: Add job.
* debian/rules:
  - Install celery upstart job.
  - Do not install jslibs as packages are now used.
  - Drop copying of maas_local_settings_sample.py as source now ships
    a maas_local_settings.py
* debian/patches:
  - 04-maas-http-fix.patch: Drop. Merged upstream.
  - 01-fix-database-settings.patch: Refreshed.
  - 99_enums_js.patch: Added until creation of enum.js / build process
    is fixed.
* debian/maas.postinst: Update bzr version to correctly handle upgrades.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
import httplib
19
19
import os
20
20
from StringIO import StringIO
 
21
from textwrap import dedent
21
22
import xmlrpclib
22
23
 
23
 
from fixtures import TempDir
24
24
import formencode
25
25
from maastesting.factory import factory
 
26
from maastesting.testcase import TestCase
26
27
from provisioningserver.plugin import (
27
28
    Config,
28
29
    Options,
31
32
    SingleUsernamePasswordChecker,
32
33
    )
33
34
from provisioningserver.testing.fakecobbler import make_fake_cobbler_session
34
 
from testtools import TestCase
35
35
from testtools.deferredruntest import (
36
36
    assert_fails_with,
37
37
    AsynchronousDeferredRunTest,
96
96
 
97
97
    def test_load(self):
98
98
        # Configuration can be loaded and parsed from a file.
99
 
        filename = os.path.join(
100
 
            self.useFixture(TempDir()).path, "config.yaml")
101
 
        with open(filename, "wb") as stream:
102
 
            stream.write(b'logfile: "/some/where.log"\n')
103
 
            stream.write(b'password: "megadeth"\n')
 
99
        config = dedent("""
 
100
            logfile: "/some/where.log"
 
101
            password: "megadeth"
 
102
            """)
 
103
        filename = self.make_file(name="config.yaml", contents=config)
104
104
        observed = Config.load(filename)
105
105
        self.assertEqual("/some/where.log", observed["logfile"])
106
106
 
152
152
 
153
153
    def setUp(self):
154
154
        super(TestProvisioningServiceMaker, self).setUp()
155
 
        self.tempdir = self.useFixture(TempDir()).path
 
155
        self.tempdir = self.make_dir()
156
156
 
157
157
    def write_config(self, config):
158
158
        config.setdefault("password", factory.getRandomString())
159
159
        config_filename = os.path.join(self.tempdir, "config.yaml")
160
160
        with open(config_filename, "wb") as stream:
161
 
            yaml.dump(config, stream)
 
161
            yaml.safe_dump(config, stream)
162
162
        return config_filename
163
163
 
164
164
    def test_init(self):