コード例 #1
0
 def testBuildInfoSaveError(self, build_info, sv):
   fs = fake_filesystem.FakeFilesystem()
   installer.open = fake_filesystem.FakeFileOpen(fs)
   installer.os = fake_filesystem.FakeOsModule(fs)
   fs.CreateFile('/tmp/build_info.yaml', contents='{BUILD: {opt 1: true}}\n')
   build_info.CachePath.return_value = '/tmp'
   s = installer.BuildInfoSave(None, build_info)
   sv.side_effect = installer.registry.Error
   self.assertRaises(installer.ActionError, s.Run)
コード例 #2
0
ファイル: installer_test.py プロジェクト: elwan/glazier
 def testBuildInfoSave(self, build_info, reg):
     fs = fake_filesystem.FakeFilesystem()
     installer.open = fake_filesystem.FakeFileOpen(fs)
     installer.os = fake_filesystem.FakeOsModule(fs)
     fs.CreateFile(
         '/tmp/build_info.yaml',
         contents='{BUILD: {opt 1: true, opt 2: some value, opt 3: 12345}}\n'
     )
     build_info.Cache.return_value.Path.return_value = '/tmp'
     s = installer.BuildInfoSave(None, build_info)
     s.Run()
     reg.return_value.SetKeyValue.assert_has_calls([
         mock.call(installer.constants.REG_ROOT, 'opt 1', True),
         mock.call(installer.constants.REG_ROOT, 'opt 2', 'some value'),
         mock.call(installer.constants.REG_ROOT, 'opt 3', 12345),
     ],
                                                   any_order=True)
     s.Run()
コード例 #3
0
 def testBuildInfoSave(self, build_info, sv):
   fs = fake_filesystem.FakeFilesystem()
   installer.open = fake_filesystem.FakeFileOpen(fs)
   installer.os = fake_filesystem.FakeOsModule(fs)
   timer_root = r'{0}\{1}'.format(installer.constants.REG_ROOT, 'Timers')
   fs.CreateFile(
       '/tmp/build_info.yaml',
       contents=
       '{BUILD: {opt 1: true, TIMER_opt 2: some value, opt 3: 12345}}\n')
   build_info.CachePath.return_value = '/tmp'
   s = installer.BuildInfoSave(None, build_info)
   s.Run()
   sv.assert_has_calls([
       mock.call('opt 1', True, 'HKLM', installer.constants.REG_ROOT),
       mock.call('TIMER_opt 2', 'some value', 'HKLM', timer_root),
       mock.call('opt 3', 12345, 'HKLM', installer.constants.REG_ROOT),
   ], any_order=True)
   s.Run()
コード例 #4
0
 def testBuildInfoSaveError(self, build_info, d):
     installer.BuildInfoSave(None, build_info).Run()
     d.assert_called_with(
         '%s does not exist - skipped processing.',
         '{}/build_info.yaml'.format(installer.constants.SYS_CACHE))