Exemplo n.º 1
0
 def test_check_simplestate(self):
     """one configuration in directory is checked"""
     self.location.child('child').setContent(helper.dumps2utf8(self.params))
     ret = httpcheck.check(self.settings, self.states, self.location)
     self.assertEquals(ret, [])
     (name, state), = six.iteritems(self.states)
     self.assertEquals(name, 'child')
     httpcheck.check(self.settings, self.states, self.location)
     self.assertEquals(ret, [])
     self.reactor.advance(3)
     httpcheck.check(self.settings, self.states, self.location)
     self.reactor.advance(3)
     ret = httpcheck.check(self.settings, self.states, self.location)
     bad, = ret
     err, = self.flushLoggedErrors()
     err.trap(defer.CancelledError)
     self.assertEquals(bad, 'child')
     self.location.child('child').remove()
     ret = httpcheck.check(self.settings, self.states, self.location)
     self.assertEquals(ret, [])
     self.assertTrue(state.closed)
     self.assertEquals(self.states, {})
Exemplo n.º 2
0
 def test_check_simplestate(self):
     """one configuration in directory is checked"""
     self.location.child('child').setContent(json.dumps(self.params))
     ret = httpcheck.check(self.settings, self.states, self.location)
     self.assertEquals(ret, [])
     (name, state), = self.states.iteritems()
     self.assertEquals(name, 'child')
     httpcheck.check(self.settings, self.states, self.location)
     self.assertEquals(ret, [])
     self.reactor.advance(3)
     httpcheck.check(self.settings, self.states, self.location)
     self.reactor.advance(3)
     ret = httpcheck.check(self.settings, self.states, self.location)
     bad, = ret
     err, = self.flushLoggedErrors()
     err.trap(defer.CancelledError)
     self.assertEquals(bad, 'child')
     self.location.child('child').remove()
     ret = httpcheck.check(self.settings, self.states, self.location)
     self.assertEquals(ret, [])
     self.assertTrue(state.closed)
     self.assertEquals(self.states, {})
Exemplo n.º 3
0
 def test_check_empty(self):
     """empty directory causes empty states"""
     ret = httpcheck.check(self.settings, self.states, self.location)
     self.assertEquals(ret, [])
     self.assertEquals(self.states, {})
Exemplo n.º 4
0
 def test_check_empty(self):
     """empty directory causes empty states"""
     ret = httpcheck.check(self.settings, self.states, self.location)
     self.assertEquals(ret, [])
     self.assertEquals(self.states, {})