~smoser/ubuntu/quantal/cloud-init/sru

« back to all changes in this revision

Viewing changes to tests/unittests/test_datasource/test_configdrive.py

  • Committer: Scott Moser
  • Date: 2013-01-18 15:28:08 UTC
  • Revision ID: smoser@ubuntu.com-20130118152808-jy5uq9pc79t82r85
Tags: 0.7.0-0ubuntu2.3~ppa0
debian/patches/lp-1100545-allow-config-drive-from-cdrom.patch:
in config-drive data to be provided from a CD-ROM (LP: #1100545)

Show diffs side-by-side

added added

removed removed

Lines of Context:
136
136
                          ds.read_config_drive_dir, my_d)
137
137
 
138
138
    def test_find_candidates(self):
139
 
        devs_with_answers = {
140
 
            "TYPE=vfat": [],
141
 
            "TYPE=iso9660": ["/dev/vdb"],
142
 
            "LABEL=config-2": ["/dev/vdb"],
143
 
        }
 
139
        devs_with_answers = {}
144
140
 
145
141
        def my_devs_with(criteria):
146
142
            return devs_with_answers[criteria]
147
143
 
 
144
        def my_is_partition(dev):
 
145
            return dev[-1] in "0123456789" and not dev.startswith("sr")
 
146
 
148
147
        try:
149
148
            orig_find_devs_with = util.find_devs_with
150
149
            util.find_devs_with = my_devs_with
151
150
 
 
151
            orig_is_partition = util.is_partition
 
152
            util.is_partition = my_is_partition
 
153
 
 
154
            devs_with_answers = {"TYPE=vfat": [],
 
155
                "TYPE=iso9660": ["/dev/vdb"],
 
156
                "LABEL=config-2": ["/dev/vdb"],
 
157
            }
152
158
            self.assertEqual(["/dev/vdb"], ds.find_candidate_devs())
153
159
 
154
160
            # add a vfat item
164
170
 
165
171
        finally:
166
172
            util.find_devs_with = orig_find_devs_with
 
173
            util.is_partition = orig_is_partition
167
174
 
168
175
    def test_pubkeys_v2(self):
169
176
        """Verify that public-keys work in config-drive-v2."""