예제 #1
0
    def test_building(self):
        from flickrapi.call_builder import CallBuilder

        cb = CallBuilder(self.f)
        three = cb.one.two.three

        self.assertEqual('flickr.one.two.three', three.method_name)
예제 #2
0
    def test_calling(self):
        from flickrapi.call_builder import CallBuilder

        cb = CallBuilder(self.f)
        cb.one.two.three(a='b')

        self.f.do_flickr_call.assert_called_with('flickr.one.two.three', a='b')
예제 #3
0
    def __getattr__(self, method_name):
        """Returns a CallBuilder for the given method name."""

        # Refuse to do anything with special methods
        if method_name.startswith('_'):
            raise AttributeError(method_name)

        # Compatibility with old way of calling, i.e. flickrobj.photos_getInfo(...)
        if '_' in method_name:
            method_name = method_name.replace('_', '.')

        return CallBuilder(self, method_name='flickr.' + method_name)
예제 #4
0
    def test_name(self):
        from flickrapi.call_builder import CallBuilder

        cb = CallBuilder(self.f)
        self.assertEqual('three', cb.one.two.three.__name__)