def test_allow_requests_by_default(self): checker = FakeChecker() st = StatusTable(checker) req = Request(Request.JSON, 'GET', 'http://www.bajoo.fr') assert not st.reject_request(req) req2 = Request(Request.DOWNLOAD, 'GET', 'http://api.bajoo.fr') assert not st.reject_request(req2)
def test_allow_requests_when_network_is_up(self): checker = FakeChecker() st = StatusTable(checker) req = Request(Request.JSON, 'GET', 'http://www.bajoo.fr/') assert not st.reject_request(req) error = NetworkError() st.update(req, error) assert st.reject_request(req) == error st.update(req) assert not st.reject_request(req)
def test_always_allow_ping_requests(self): checker = FakeChecker() st = StatusTable(checker) req = Request(Request.JSON, 'GET', 'http://www.bajoo.fr/path') assert not st.reject_request(req) error = NetworkError() st.update(req, error) req = Request(Request.PING, 'GET', 'http://www.bajoo.fr/') assert not st.reject_request(req)