Exemplo n.º 1
0
 def test_route_matched_name_ok(self, monkeypatch):
     authenticate_obj = pretend.call_recorder(lambda *a, **kw: True)
     monkeypatch.setattr(accounts, "_authenticate", authenticate_obj)
     request = pretend.stub(matched_route=pretend.stub(
         name="includes.current-user-indicator"))
     assert accounts._session_authenticate(1, request) is True
     assert authenticate_obj.calls == [pretend.call(1, request)]
Exemplo n.º 2
0
 def test_route_matched_name_bad(self, monkeypatch):
     authenticate_obj = pretend.call_recorder(lambda *a, **kw: True)
     monkeypatch.setattr(accounts, "_authenticate", authenticate_obj)
     request = pretend.stub(matched_route=pretend.stub(
         name="forklift.legacy.file_upload"))
     assert accounts._session_authenticate(1, request) is None
     assert authenticate_obj.calls == []