Example #1
0
 def setUp(self):
     self.client = JSONClient()
Example #2
0
            # Struct - Api class
            elif hasattr(result, "__name__") and result.__name__ in classes:
                for attr, atype in zip(result.__slots__,
                                       classes[result.__name__]):
                    self.assert_type(getattr(result, attr), atype)
            else:  # simple object
                assert isinstance(result, type)
        except AssertionError:
            print "Assertion for %s as %s failed" % (result, type)
            raise

    def call(self, func, *args, **kwargs):
        result = getattr(self.api, func)(*args, **kwargs)
        self.assert_type(result, methods[func])

        return result

    def __getattr__(self, item):
        def call(*args, **kwargs):
            return self.call(item, *args, **kwargs)

        return call


if __name__ == "__main__":

    from module.remote.JSONClient import JSONClient

    api = ApiProxy(JSONClient(), "User", "test")
    api.getServerVersion()
Example #3
0
 def enableJSON(self):
     self.api = ApiProxy(JSONClient())