git.fiddlerwoaroof.com
Browse code

removed trailing slashes

Ed L authored on 07/07/2011 02:33:33
Showing 3 changed files
... ...
@@ -39,7 +39,7 @@ from jsonrpc.server import ServerEvents, JSON_RPC
39 39
 
40 40
 class ExampleServer(ServerEvents):
41 41
 	# inherited hooks
42
-	def log(self, responses, txrequest):
42
+	def log(self, responses, txrequest, error):
43 43
 		print txrequest.code,
44 44
 		if isinstance(responses, list):
45 45
 			for response in responses:
... ...
@@ -162,7 +162,7 @@ class JSONRPCProxy(object):
162 162
 		result = [self.serviceURL]
163 163
 		if self._path:
164 164
 			result.append(self._path)
165
-		result.append('')
165
+		#result.append('')
166 166
 		return '/'.join(result)
167 167
 
168 168
 	def _post(self, url, data):
... ...
@@ -13,21 +13,25 @@ class TestJSONRPCProxy(unittest.TestCase):
13 13
 		self.proxy = jsonrpc.proxy.JSONRPCProxy('http://localhost:8007', path='aaa')
14 14
 
15 15
 
16
-	def test_url(self):
16
+	def test_url0(self):
17 17
 		self.proxy = jsonrpc.proxy.JSONRPCProxy.from_url('http://localhost:8007')
18
-		self.assertEqual(self.proxy._get_url(), 'http://localhost:8007/')
18
+		self.assertEqual(self.proxy._get_url(), 'http://localhost:8007')
19 19
 
20
+	def test_url1(self):
20 21
 		self.proxy = jsonrpc.proxy.JSONRPCProxy.from_url('http://localhost:8007/aaa/')
21
-		self.assertEqual(self.proxy._get_url(), 'http://localhost:8007/aaa/')
22
+		self.assertEqual(self.proxy._get_url(), 'http://localhost:8007/aaa')
22 23
 
24
+	def test_url2(self):
23 25
 		self.proxy = jsonrpc.proxy.JSONRPCProxy.from_url('http://localhost:8007/aaa')
24
-		self.assertEqual(self.proxy._get_url(), 'http://localhost:8007/aaa/')
26
+		self.assertEqual(self.proxy._get_url(), 'http://localhost:8007/aaa')
25 27
 
28
+	def test_url3(self):
26 29
 		self.proxy = jsonrpc.proxy.JSONRPCProxy('http://localhost:8007')
27
-		self.assertEqual(self.proxy._get_url(), 'http://localhost:8007/jsonrpc/')
30
+		self.assertEqual(self.proxy._get_url(), 'http://localhost:8007/jsonrpc')
28 31
 
32
+	def test_url4(self):
29 33
 		self.proxy = jsonrpc.proxy.JSONRPCProxy('http://localhost:8007', path='aaa')
30
-		self.assertEqual(self.proxy._get_url(), 'http://localhost:8007/aaa/')
34
+		self.assertEqual(self.proxy._get_url(), 'http://localhost:8007/aaa')
31 35
 
32 36
 	def test_call(self):
33 37
 		self.assertEqual(self.proxy.add(1,2), 3)