def testAddingSuffixes(self): plugs = self._plugsTwiceAcceptingAndMulti( "AcceptingPlug and AcceptingPlug-1") componentProps = self._buildComponent(plugs) comp = component.BaseComponent(componentProps) bouncer = self._extractBouncerPlug(comp) d = self.check_auth(self.keycard, bouncer, True) return self.stop_bouncer(bouncer, d, comp)
def testExpringKeycard(self): plugs = self._plugsAcceptingRejectingAndMulti("AcceptingPlug") componentProps = self._buildComponent(plugs) comp = component.BaseComponent(componentProps) # mock method instead using HTTPStreamer comp.remove_client = callable http_auth = http.HTTPAuthentication(comp) bouncer = http_auth.plug self.keycard._fd = 100 d = self.check_auth(self.keycard, bouncer, True) # theese values would be set by the proper # request authentication by HTTPStreamer http_auth._idToKeycard[self.keycard.id] = self.keycard http_auth._fdToKeycard[self.keycard._fd] = self.keycard d.addCallback( lambda _: self.assertIn(self.keycard.id, http_auth._idToKeycard)) d.addCallback(lambda _: bouncer.expireKeycardId(self.keycard.id)) d.addCallback(lambda _: self.assertNotIn(self.keycard.id, http_auth. _idToKeycard)) return self.stop_bouncer(bouncer, d, comp)
def testEmptyPlugs(self): plugs = self._addMultibouncerPlug({}, "") componentProps = self._buildComponent(plugs) comp = component.BaseComponent(componentProps) self._testForFailure("", 'no-algorithm', custom_component=comp)
def _getComponentAndBouncer(self, combination): plugs = self._plugsAcceptingRejectingAndMulti(combination) comp = component.BaseComponent(self._buildComponent(plugs)) return comp, self._extractBouncerPlug(comp)