Beispiel #1
0
 def test_two_on_successes(self):
     deferred = Deferred()
     deferred.chain.on_success(self._succeeded)
     deferred.chain.on_success(self._second_succeeded)
     deferred.succeed("hello")
     result = (("hello",), {})
     self.assertResultedIn(success=result, second=result)
Beispiel #2
0
 def test_two_on_successes(self):
     deferred = Deferred()
     deferred.chain.on_success(self._succeeded)
     deferred.chain.on_success(self._second_succeeded)
     deferred.succeed("hello")
     result = (("hello", ), {})
     self.assertResultedIn(success=result, second=result)
Beispiel #3
0
    def after(self):
        """
        Return a deferred that will fire after the request is finished.

        :returns: a new :class:`Deferred` for each call to this function.

        """

        d = Deferred()
        self._after_deferreds.append(d)
        return d.chain
Beispiel #4
0
    def after(self):
        """
        Return a deferred that will fire after the request is finished.

        Returns:

            Deferred: a new deferred that will fire appropriately

        """

        d = Deferred()
        self._after_deferreds.append(d)
        return d.chain
Beispiel #5
0
 def test_error(self):
     deferred = Deferred()
     deferred.chain.on_error(self._errored)
     error = ABadThing("Whoops!")
     deferred.error(error)
     self.assertResultedIn(error=((error,), {}))
Beispiel #6
0
 def test_immediate_on_success(self):
     deferred = Deferred()
     deferred.succeed("hello")
     deferred.chain.on_success(self._succeeded)
     self.assertResultedIn(success=(("hello",), {}))
Beispiel #7
0
 def test_succeed_without_args(self):
     deferred = Deferred()
     deferred.chain.on_success(self._succeeded)
     deferred.succeed("hello")
     self.assertResultedIn(success=(("hello",), {}))
Beispiel #8
0
 def test_succeed(self):
     deferred = Deferred()
     deferred.chain.on_success(self._succeeded, "world", end="!")
     deferred.succeed("hello")
     self.assertResultedIn(success=(("hello", "world"), {"end": "!"}))
Beispiel #9
0
 def test_error(self):
     deferred = Deferred()
     deferred.chain.on_error(self._errored)
     error = ABadThing("Whoops!")
     deferred.error(error)
     self.assertResultedIn(error=((error, ), {}))
Beispiel #10
0
 def test_immediate_on_success(self):
     deferred = Deferred()
     deferred.succeed("hello")
     deferred.chain.on_success(self._succeeded)
     self.assertResultedIn(success=(("hello", ), {}))
Beispiel #11
0
 def test_succeed_without_args(self):
     deferred = Deferred()
     deferred.chain.on_success(self._succeeded)
     deferred.succeed("hello")
     self.assertResultedIn(success=(("hello", ), {}))
Beispiel #12
0
 def test_succeed(self):
     deferred = Deferred()
     deferred.chain.on_success(self._succeeded, "world", end="!")
     deferred.succeed("hello")
     self.assertResultedIn(success=(("hello", "world"), {"end": "!"}))