~ubuntu-branches/ubuntu/wily/system-image/wily

« back to all changes in this revision

Viewing changes to systemimage/tests/test_config.py

  • Committer: Package Import Robot
  • Author(s): Barry Warsaw
  • Date: 2013-07-09 14:37:58 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20130709143758-spcft6c5yhuz1tw8
Tags: 0.3-0ubuntu1
* New upstream release.
  - LP: #1199177 (default client.ini file updates)
  - LP: #1199361 (fix timeout errors)
  - LP: #1199498 (update ubuntu_command format)
  - LP: #1199488 (include archive master key)
* debian/control: Strengthen the Depends between system-image-cli and
  system-image-common.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
import unittest
25
25
 
26
26
from datetime import timedelta
 
27
from pkg_resources import resource_filename
27
28
from systemimage.config import Configuration, config
28
29
from systemimage.reboot import Reboot
29
30
from systemimage.scores import WeightedScorer
30
 
from systemimage.tests.helpers import test_data_path, testable_configuration
 
31
from systemimage.testing.helpers import test_data_path, testable_configuration
31
32
from systemimage.tests.reboot import TestableReboot
32
33
 
33
34
 
34
35
class TestConfiguration(unittest.TestCase):
35
36
    def test_defaults(self):
 
37
        default_ini = resource_filename('systemimage.data', 'client.ini')
36
38
        config = Configuration()
 
39
        config.load(default_ini)
37
40
        # [service]
38
 
        self.assertEqual(config.service.base, 'phablet.stgraber.org')
 
41
        self.assertEqual(config.service.base, 'system-image.ubuntu.com')
39
42
        self.assertEqual(config.service.http_base,
40
 
                         'http://phablet.stgraber.org')
 
43
                         'http://system-image.ubuntu.com')
41
44
        self.assertEqual(config.service.https_base,
42
 
                         'https://phablet.stgraber.org')
 
45
                         'https://system-image.ubuntu.com')
43
46
        # [system]
44
 
        self.assertEqual(config.system.tempdir, '/tmp/phablet')
45
 
        self.assertEqual(config.system.channel, 'stable')
46
 
        self.assertEqual(config.system.device, 'nexus7')
 
47
        self.assertEqual(config.system.tempdir, '/tmp/system-image')
 
48
        self.assertEqual(config.system.channel, 'daily')
 
49
        self.assertEqual(config.system.device, 'mako')
47
50
        # [score]
48
51
        self.assertEqual(config.hooks.scorer, WeightedScorer)
49
52
        self.assertEqual(config.hooks.reboot, Reboot)
50
53
        # [gpg]
51
54
        self.assertEqual(config.gpg.archive_master,
52
 
                         '/etc/image-upgrades-resolver/archive-master.tar.xz')
 
55
                         '/etc/system-image/archive-master.tar.xz')
53
56
        self.assertEqual(
54
57
            config.gpg.image_master,
55
 
            '/var/lib/image-upgrades-resolver/keyrings/image-master.tar.xz')
 
58
            '/var/lib/system-image/keyrings/image-master.tar.xz')
56
59
        self.assertEqual(
57
60
            config.gpg.image_signing,
58
 
            '/var/lib/image-upgrades-resolver/keyrings/image-signing.tar.xz')
 
61
            '/var/lib/system-image/keyrings/image-signing.tar.xz')
59
62
        self.assertEqual(
60
63
            config.gpg.device_signing,
61
 
            '/var/lib/image-upgrades-resolver/keyrings/device-signing.tar.xz')
 
64
            '/var/lib/system-image/keyrings/device-signing.tar.xz')
62
65
        # [updater]
63
66
        self.assertEqual(config.updater.cache_partition,
64
67
                         '/android/cache/recovery')
65
68
        self.assertEqual(config.updater.data_partition,
66
 
                         '/var/lib/image-upgrades-resolver/')
 
69
                         '/var/lib/system-image')
67
70
 
68
71
    def test_basic_ini_file(self):
69
72
        # Read a basic .ini file and check that the various attributes and