Exemple #1
0
 def test_invalidate_unnecessary(self):
     """
     The result is returned immediately and the provided effect is not
     invoked when the HTTP response code is not in ``codes``.
     """
     good = stub_pure_response("okay!", code=200)
     result = effect_on_response((401,), self.invalidate_effect, good)
     self.assertEqual(result, good)
     self.assertEqual(self.invalidations, [])
Exemple #2
0
 def test_invalidate_unnecessary(self):
     """
     The result is returned immediately and the provided effect is not
     invoked when the HTTP response code is not in ``codes``.
     """
     good = stub_pure_response("okay!", code=200)
     result = effect_on_response((401, ), self.invalidate_effect, good)
     self.assertEqual(result, good)
     self.assertEqual(self.invalidations, [])
Exemple #3
0
 def test_invalidate(self):
     """
     :func:`effect_on_response` invokes the provided effect and
     returns an Effect of the original response.
     """
     badauth = stub_pure_response("badauth!", code=401)
     eff = effect_on_response((401,), self.invalidate_effect, badauth)
     self.assertEqual(eff.intent, self.invalidate_effect.intent)
     self.assertEqual(resolve_stubs(eff), badauth)
     self.assertEqual(self.invalidations, [True])
Exemple #4
0
 def test_invalidate(self):
     """
     :func:`effect_on_response` invokes the provided effect and
     returns an Effect of the original response.
     """
     badauth = stub_pure_response("badauth!", code=401)
     eff = effect_on_response((401, ), self.invalidate_effect, badauth)
     self.assertEqual(eff.intent, self.invalidate_effect.intent)
     self.assertEqual(resolve_stubs(eff), badauth)
     self.assertEqual(self.invalidations, [True])