Mercurial > hg > AuthRPC
comparison wibble/client/ServerProxy.py @ 7:3a6f3193cc7d
Created new tests
author | Ben Croston <ben@croston.org> |
---|---|
date | Thu, 01 Sep 2011 19:19:03 +0100 |
parents | f5e3ba8cfcd0 |
children | 685479d1f0a7 |
comparison
equal
deleted
inserted
replaced
6:bb6b8df4dae8 | 7:3a6f3193cc7d |
---|---|
173 # magic method dispatcher | 173 # magic method dispatcher |
174 return _Method(self.__request, name, self._username, self._password) | 174 return _Method(self.__request, name, self._username, self._password) |
175 | 175 |
176 if __name__ == '__main__': | 176 if __name__ == '__main__': |
177 ##### btc fixme | 177 ##### btc fixme |
178 jsonrpc_client = ServerProxy2('http://localhost:1337/', username='testuser', password='', user_agent='Py2NotInternetExploiter') | 178 jsonrpc_client = ServerProxy('http://localhost:1337/', username='testuser', password='', user_agent='Py2NotInternetExploiter') |
179 #jsonrpc_client = ServerProxy2('https://www.croston.org/test/index.py', | 179 #jsonrpc_client = ServerProxy('https://www.croston.org/test/index.py', |
180 # username='testuser', | 180 # username='testuser', |
181 # password='', | 181 # password='', |
182 # user_agent='Py2NotInternetExploiter') | 182 # user_agent='Py2NotInternetExploiter') |
183 assert jsonrpc_client.api.mymethod() == jsonrpc_client.mymethod() | 183 assert jsonrpc_client.api.mymethod() == jsonrpc_client.mymethod() |
184 try: | 184 try: |
185 print(jsonrpc_client.wibble('this should fail')) | 185 print jsonrpc_client.wibble('this should fail') |
186 except BadRequestException: | 186 except BadRequestException: |
187 pass # test passed | 187 pass # test passed |
188 else: | 188 else: |
189 raise Exception('Test failed (calling unknown method)') | 189 raise Exception('Test failed (calling unknown method)') |
190 | 190 |