示例#1
0
 def setUp(self):
     self.tempdir = tempfile.mkdtemp()
     self.dbfile = os.path.join(self.tempdir, "sqlite.db")
     tftp_root = os.path.join(self.tempdir, "tftp")
     os.mkdir(tftp_root)
     image_store = os.path.join(self.tempdir, "images")
     os.mkdir(image_store)
     # set up the config with defaults
     config.reset()
     config.set('database', 'engine', 'sqlite:///' + self.dbfile)
     config.set('server', 'fqdn', 'server1')
     config.set('paths', 'tftp_root', tftp_root)
     config.set('paths', 'image_store', image_store)
     # set up the db
     setup_db(self.dbfile)
     self.app = TestApp(server.get_app().wsgifunc())
示例#2
0
 def test_sync(self, merge_devices, get_devices, delete_device,
                     update_device, insert_device, dump_devices):
     config.reset()
     config.set('inventory', 'url', 'http://foo/')
     config.set('inventory', 'filter', 'hostname__startswith=panda-')
     config.set('inventory', 'username', 'u')
     config.set('inventory', 'password', 'p')
     dump_devices.return_value = 'dumped devices'
     get_devices.return_value = 'gotten devices'
     merge_devices.return_value = [
         ('insert', dict(insert=1)),
         ('delete', 10, dict(delete=2)),
         ('update', 11, dict(update=3)),
     ]
     inventorysync.sync()
     dump_devices.assert_called_with()
     get_devices.assert_called_with('http://foo/', 'hostname__startswith=panda-', 'u', 'p', None,
             verbose=False)
     merge_devices.assert_called_with('dumped devices', 'gotten devices')
     insert_device.assert_called_with(dict(insert=1))
     delete_device.assert_called_with(10)
     update_device.assert_called_with(11, dict(update=3))
示例#3
0
 def test_get_set(self):
     config.reset()
     config.set('abc', 'def', 'ghi')
     self.assertEqual(config.get('abc', 'def'), 'ghi')
     self.assertEqual(config.get('abc', 'XXX'), None)
     self.assertEqual(config.get('XXX', 'XXX'), None)
示例#4
0
 def setUpMixin(self):
     config.reset()
     config.set('server', 'fqdn', 'my_fqdn')
示例#5
0
文件: util.py 项目: awrede/mozpool
 def setUpMixin(self):
     config.reset()
     config.set('server', 'fqdn', 'my_fqdn')
示例#6
0
 def call_main():
     from mozpool.web import server
     # configure an invalid DB - startup should succeed anyway
     config.reset()
     config.set('database', 'engine', 'sqlite://////')
     server.main(run=False)
示例#7
0
 def call_main():
     from mozpool.web import server
     # configure an invalid DB - startup should succeed anyway
     config.reset()
     config.set('database', 'engine', 'sqlite://////')
     server.main(run=False)