Commits

Chris Perl committed 356dcd3

more tweaks

  • Participants
  • Parent commits 8412a27

Comments (0)

Files changed (1)

 
 active_tests = [
 		'tests.TestMessages',
-#		'tests.TestBayeuxReceiver',
+		'tests.TestBayeuxReceiver',
 ]
 
 class BaseTests(unittest.TestCase):
 			This method is called by the receiver when it wants to
 			POST some data to the server.
 			"""
-			self.request_msg = json.loads(body)
+			self.request_msg = RequestMessageFactory(BayeuxRequestMessage.FROMDICT, json.loads(body))
 
 		def getresponse(self):
 			"""
 			"""
 			self._event.set()
 
-
 		def read(self):
 			"""
 			Masquerade as an HTTPResponse.
 			"server."  We simply return what payload had been set
 			for us to return.
 			"""
-			return json.dumps(self.response_msgs)
+			return json.dumps([x.as_dict() for x in self.response_msgs])
 
 		def add_response_msg(self, m):
 			"""
 			Add Bayeux msg m to the list of messages that will be returned.
 			"""
-			self.response_msgs.append(m.as_dict())
+			self.response_msgs.append(m)
 
 	def test_test(self):
-		h = TestBayeuxReceiver.MockHTTPConnection()
-		r = BayeuxReceiver("http://foo.bar.com/cometd", http_client_class=h)
+		h = TestBayeuxReceiver.MockHTTPConnection
+		r = BayeuxReceiver("http://foo.bar.com/cometd", http_class=h)
+		r.connect()
+		print type(r._http.request_msg)
+		self.assertTrue(isinstance(r._http.request_msg, HandshakeRequest))
+		r.stop()
+		r._http.respond()
+
+
 
 
 if __name__ == "__main__":