コード例 #1
0
ファイル: test_status.py プロジェクト: pombredanne/crcache
 def test_query_field(self):
     ui, cmd = self.get_test_ui_and_cmd(
         args=['local'], options=[('query', 'available')])
     self.useFixture(SourceConfigFixture('model', 'model', reserve=1))
     source = Config().get_source('model')
     source.fill_reserve()
     cmd.execute()
     self.assertEqual([('rest', '1')], ui.outputs)
コード例 #2
0
ファイル: test_release.py プロジェクト: pombredanne/crcache
 def test_release_known(self):
     self.useFixture(SourceConfigFixture('model', 'model'))
     conf = Config()
     source = conf.get_source('model')
     resources = list(source.provision(2))
     ui, cmd = self.get_test_ui_and_cmd(args=resources)
     result = cmd.execute()
     self.assertEqual([], ui.outputs)
     self.assertEqual(0, result)
コード例 #3
0
ファイル: test_status.py プロジェクト: pombredanne/crcache
 def test_filter_source(self):
     ui, cmd = self.get_test_ui_and_cmd(args=['local'])
     self.useFixture(SourceConfigFixture('model', 'model', reserve=1))
     source = Config().get_source('model')
     source.fill_reserve()
     cmd.execute()
     self.assertEqual(
         [('table', [
             ('source', 'cached', 'in-use', 'max'),
             ('local', '0', '0', '1'),
             ]),
         ], ui.outputs)
コード例 #4
0
ファイル: test_status.py プロジェクト: pombredanne/crcache
 def test_shows_in_use(self):
     ui, cmd = self.get_test_ui_and_cmd()
     self.useFixture(SourceConfigFixture('model', 'model'))
     source = Config().get_source('model')
     self.addCleanup(source.discard, source.provision(1))
     cmd.execute()
     self.assertEqual(
         [('table', [
             ('source', 'cached', 'in-use', 'max'),
             ('local', '0', '0', '1'),
             ('model', '0', '1', '0'),
             ]),
         ], ui.outputs)
コード例 #5
0
ファイル: test_run.py プロジェクト: pombredanne/crcache
 def test_run_known(self):
     self.useFixture(SourceConfigFixture('model', 'model'))
     self.useFixture(SourceConfigFixture('pool', 'pool', sources="model"))
     conf = Config()
     source = conf.get_source('pool')
     resources = list(source.provision(1))
     args = [resources[0], "echo", "foo"]
     ui, cmd = self.get_test_ui_and_cmd(args=args)
     result = cmd.execute()
     # XXX: Perhaps sources should get the ui object passed down? let them
     # do progress bars and chatter sanely?
     self.assertEqual([], ui.outputs)
     self.assertEqual(0, result)
コード例 #6
0
ファイル: test_run.py プロジェクト: pombredanne/crcache
 def test_run_no_command(self):
     self.skip('stdin stubbing not implemented, test suite would hang.')
     # Running nothing should just get a shell.
     self.useFixture(SourceConfigFixture('model', 'model'))
     self.useFixture(SourceConfigFixture('pool', 'pool', sources="model"))
     conf = Config()
     source = conf.get_source('pool')
     resources = list(source.provision(1))
     args = [resources[0]]
     ui, cmd = self.get_test_ui_and_cmd(args=args)
     result = cmd.execute()
     # XXX: Perhaps sources should get the ui object passed down? let them
     # do progress bars and chatter sanely?
     self.assertEqual([], ui.outputs)
     self.assertEqual(0, result)