Skip to content

Commit

Permalink
Merge pull request #9 from kadel/master
Browse files Browse the repository at this point in the history
default hideAttributes to true
  • Loading branch information
nyoxi committed Apr 22, 2015
2 parents 9042edf + 5a379e4 commit 639b7c6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
6 changes: 6 additions & 0 deletions python/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
python-fastrpc (5.0.7) testing; urgency=low

* change default value of hideAttributes to true

-- Tomas Kral <[email protected]> Mon, 23 Mar 2015 10:01:20 +0100

python-fastrpc (5.0.6) testing; urgency=low

* ServerProxy(hideAttributes=true/false) possibility: calling fastrpc
Expand Down
2 changes: 1 addition & 1 deletion python/fastrpcmodule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@ PyObject* ServerProxy_ServerProxy(ServerProxyObject *, PyObject *args,
PyObject *datetimeBuilder = 0;
PyObject *preCall = 0;
PyObject *postCall = 0;
int hideAttributes = false;
int hideAttributes = true;

static const char *kwtypes = "siiiiisissiiOO";
const void *kwvars[] = { serverUrl, &readTimeout,
Expand Down
13 changes: 6 additions & 7 deletions python/test/serverproxytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def setUp(self):
def test_getattr(self):
client = fastrpc.ServerProxy(
self.url, readTimeout=1000, writeTimeout=1000, connectTimeout=1000,
useBinary=fastrpc.ON_SUPPORT_ON_KEEP_ALIVE)
useBinary=fastrpc.ON_SUPPORT_ON_KEEP_ALIVE, hideAttributes=False)

for attr in self.attributes_names:
self.assertEqual(getattr(client, attr), getattr(self, attr))
Expand All @@ -28,7 +28,7 @@ def test_hideAttibutes(self):
If hideAttributes parametr is set to True in constructor of ServerProxy
all serverproxy attrs should be taken as frpc call attempt (proxy.url(), proxy.path()...)
"""
without_hide = fastrpc.ServerProxy(
default_hide = fastrpc.ServerProxy(
self.url, readTimeout=1, writeTimeout=1, connectTimeout=1,
useBinary=fastrpc.ON_SUPPORT_ON_KEEP_ALIVE)

Expand All @@ -48,10 +48,9 @@ def try_typeerror(client, exception):
for attr in self.attributes_names:
self.assertRaises(exception, lambda: getattr(client, attr)())

try_attr(without_hide)
try_attr(without_hide_false)

try_typeerror(without_hide, TypeError)
try_typeerror(default_hide, ProtocolError)
try_typeerror(without_hide_false, TypeError)
try_typeerror(with_hide, ProtocolError)

Expand Down Expand Up @@ -121,9 +120,9 @@ def test_configparser(self):

client = fastrpc.ServerProxy(config_parser, section)

self.assertEqual(getattr(client, "host"), self.host)
self.assertEqual(getattr(client, "port"), self.port)
self.assertEqual(getattr(client, "url"), self.url)
self.assertEqual(client("get_host"), self.host)
self.assertEqual(client("get_port"), self.port)
self.assertEqual(client("get_url"), self.url)


if __name__ == '__main__':
Expand Down

0 comments on commit 639b7c6

Please sign in to comment.