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)
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')
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)
def test_name(self): from flickrapi.call_builder import CallBuilder cb = CallBuilder(self.f) self.assertEqual('three', cb.one.two.three.__name__)