コード例 #1
0
ファイル: test_control.py プロジェクト: iffy/grace
 def test_ls(self):
     """
     ls should call through to the plumber and return a dictionary ready
     for AMP
     """
     c = Server(FakePlumber({
         'ls': [
             ('foo', 'thing1', 0, True),
             ('bar', 'thing2', 1, False),
             ('bar', 'thing3', 12, True),
         ]
     }))
     r = c.ls()
     self.assertEqual(r['pipes'], [
         {
             'src': 'foo',
             'dst': 'thing1',
             'conns': 0,
             'active': True,
         },
         {
             'src': 'bar',
             'dst': 'thing2',
             'conns': 1,
             'active': False,
         },
         {
             'src': 'bar',
             'dst': 'thing3',
             'conns': 12,
             'active': True,
         },
     ])
コード例 #2
0
ファイル: test_control.py プロジェクト: iffy/grace
 def test_stop(self):
     """
     Stop should mirror plumber.stop
     """
     c = Server(FakePlumber())
     c.stop()
     self.assertEqual(c.plumber.called, ['stop'])
コード例 #3
0
ファイル: test_control.py プロジェクト: iffy/grace
 def test_rmPipe(self):
     """
     rmPipe should mirror plumber.rmPipe
     """
     c = Server(FakePlumber())
     c.rmPipe('foo')
     self.assertEqual(c.plumber.called, [
         ('rmPipe', 'foo'),
     ])
コード例 #4
0
ファイル: test_control.py プロジェクト: iffy/grace
 def test_addPipe(self):
     """
     addPipe should mirror plumber.addPipe
     """
     c = Server(FakePlumber())
     c.addPipe('foo', 'bar')
     self.assertEqual(c.plumber.called, [
         ('addPipe', 'foo', 'bar'),
     ])
コード例 #5
0
ファイル: test_control.py プロジェクト: iffy/grace
 def test_switch(self):
     """
     Switching should switch a Pipe's destination.
     """
     c = Server(FakePlumber())
     c.switch('foo', 'dst2')
     self.assertEqual(c.plumber.called, [
         ('pipeCommand', 'foo', 'switch', ('dst2',), {}),
     ])
コード例 #6
0
ファイル: test_control.py プロジェクト: iffy/grace
 def test_wait(self):
     """
     Wait should wait
     """
     ret = defer.Deferred()
     c = Server(FakePlumber({
         'pipeCommand': ret,
     }))
     r = c.wait('foo')
     self.assertEqual(c.plumber.called, [
         ('pipeCommand', 'foo', 'wait', (), {}),
     ])
     self.assertFalse(r.called)
     ret.callback(None)        
     def check(response):
         self.assertEqual(response, {})
     return r.addCallback(check)