Beispiel #1
0
 def test_send(self):
     # Test makes equivalent call of HttpResourceProcessor.fetch.delay("test")
     scc, err = send(query="test",
                     method=self.method,
                     config=self.config,
                     session=self.session)
     self.check_results(scc, 1)
     self.check_results(err, 0)
     # Similar but with a cached result
     scc, err = send(query="success",
                     method=self.method,
                     config=self.config,
                     session=self.session)
     self.check_results(scc, 1)
     self.check_results(err, 0)
     # And with an error response
     scc, err = send(query="404",
                     method=self.method,
                     config=self.config,
                     session=self.session)
     self.check_results(scc, 0)
     self.check_results(err, 1)
     scc, err = send(query="500",
                     method=self.method,
                     config=self.config,
                     session=self.session)
     self.check_results(scc, 0)
     self.check_results(err, 1)
Beispiel #2
0
 def test_send_continuation_prohibited(self):
     scc, err = send(query="next",
                     method=self.method,
                     config=self.config,
                     session=self.session)
     self.check_results(scc, 1)
     self.check_results(err, 0)
Beispiel #3
0
 def test_send(self):
     # Test makes equivalent call of HttpResourceProcessor.fetch.delay("test")
     scc, err = send(query="test", method=self.method, config=self.config, session=self.session)
     self.check_results(scc, 1)
     self.check_results(err, 0)
     # Similar but with a cached result
     scc, err = send(query="success", method=self.method, config=self.config, session=self.session)
     self.check_results(scc, 1)
     self.check_results(err, 0)
     # And with an error response
     scc, err = send(query="404", method=self.method, config=self.config, session=self.session)
     self.check_results(scc, 0)
     self.check_results(err, 1)
     scc, err = send(query="500", method=self.method, config=self.config, session=self.session)
     self.check_results(scc, 0)
     self.check_results(err, 1)
Beispiel #4
0
 def test_send_continuation(self):
     self.config.continuation_limit = 10
     scc, err = send(query="next",
                     method=self.method,
                     config=self.config,
                     session=self.session)
     self.check_results(scc, 2)
     self.check_results(err, 0)
Beispiel #5
0
 def test_send_inserted_session(self):
     scc, err = send(query="test",
                     method=self.method,
                     config=self.config,
                     session=MockRequestsWithAgent)
     self.check_results(scc, 1)
     self.check_results(err, 0)
     link = HttpResourceMock.objects.get(id=scc[0])
     self.assertIn("user-agent", link.head)
Beispiel #6
0
 def test_send_inserted_session(self):
     scc, err = send(query="test", method=self.method, config=self.config, session=MockRequestsWithAgent)
     self.check_results(scc, 1)
     self.check_results(err, 0)
     link = HttpResourceMock.objects.get(id=scc[0])
     self.assertIn("user-agent", link.head)
Beispiel #7
0
 def test_send_continuation(self):
     self.config.continuation_limit = 10
     scc, err = send(query="next", method=self.method, config=self.config, session=self.session)
     self.check_results(scc, 2)
     self.check_results(err, 0)
Beispiel #8
0
 def test_send_continuation_prohibited(self):
     scc, err = send(query="next", method=self.method, config=self.config, session=self.session)
     self.check_results(scc, 1)
     self.check_results(err, 0)