Running test against other endpoint?
We (@superfeedr) are trying to produce a compatible Google Reader API, so that it's easy for anyone to change their endpoint and still get their libraries to work. To achieve that I wanted to know what needed to be changed to run the test suite against our endpoint.
Thanks!
Hey,
- First, I would recommend cloning and installing the source locally, so you can tweak it, something like:
git clone git://github.com/askedrelic/libgreader.git python setup develop
- From here, you will have to do about 2 things:
- create a custom Auth class for your website (which just provides auth'ed wrappers for POST/GET) You can see the Google Client and OAuth2 classes here: https://github.com/askedrelic/libgreader/blob/master/libgreader/auth.py
- Change the READER_BASE_URL to use your API this file: https://github.com/askedrelic/libgreader/blob/master/libgreader/url.py
- With that in place, I would recommend playing around in an interactive terminal, to test basic functionality. The API looks something like this when playing around: https://gist.github.com/askedrelic/4343277
- For running the tests, I would recommend updating the test_special_feeds.py file. That tests the API, not the Auth: https://github.com/askedrelic/libgreader/blob/master/tests/test_special_feeds.py
You need to setup your username/password in the test file, along with changing the ClientAuth to be your new Auth class.
You can run the tests in that file, just by calling the file with python. "python test_special_auth.py" will run just the tests in the file.
Thanks @askedrelic this is exactly what we needed. I think we can go pretty far with that.
The gist you sent though has an error which I'm unable to understand:
$ python test_special_auth.py
Traceback (most recent call last):
File "test_special_auth.py", line 14, in <module>
echo_feed = [x for x in reader.feeds if "Echo" in x.title][0]
IndexError: list index out of range
Any idea what's going on? [it fails for both google reader and our own]
Well,n that's just because the feed was not subscribed and hence could not be extracted from the list. I madde a lot of progress, more soon!
I'm unable to run the test suite (probably due to my low python knowledge :p):
$ python tests/test_special_feeds.py
Traceback (most recent call last):
File "tests/test_special_feeds.py", line 18, in <module>
from libgreader import GoogleReader, OAuthMethod, ClientAuthMethod, Feed, ItemsContainer, Item, BaseFeed, SpecialFeed, ReaderUrl
ImportError: No module named libgreader
Also, FYI, our Google Reader Compatible API is running at http://readerapi.superfeedr.com/ so you can just set READER_BASE_URL to https://readerapi.superfeedr.com/reader/api and CLIENT_URL to http://readerapi.superfeedr.com/accounts/ClientLogin as we also mapped Google's auth pattern.
We'd love to hear your thoughts.
The ImportError: No module named libgreader is mostly liking due to not having libgreader installed in 'develop' mode, which installs libgreader to point to your current files
If you are in the top level git repo, run python setup.py develop and it should "install" locally like so
(py2-libgreader)mbehrens at mattb in ~/.virtualenvs/py2-libgreader/reader on feature/superfeedrauth*
$ py setup.py develop
running develop
running egg_info
creating libgreader.egg-info
writing requirements to libgreader.egg-info/requires.txt
writing libgreader.egg-info/PKG-INFO
writing top-level names to libgreader.egg-info/top_level.txt
writing dependency_links to libgreader.egg-info/dependency_links.txt
writing manifest file 'libgreader.egg-info/SOURCES.txt'
reading manifest file 'libgreader.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'libgreader.egg-info/SOURCES.txt'
running build_ext
Creating /Users/mbehrens/.virtualenvs/py2-libgreader/lib/python2.7/site-packages/libgreader.egg-link (link to .)
Adding libgreader 0.8.0 to easy-install.pth file
Installed /Users/mbehrens/.virtualenvs/py2-libgreader/reader
Processing dependencies for libgreader==0.8.0
Searching for requests==1.2.0
Best match: requests 1.2.0
Adding requests 1.2.0 to easy-install.pth file
Using /Users/mbehrens/.virtualenvs/py2-libgreader/lib/python2.7/site-packages
Finished processing dependencies for libgreader==0.8.0
Signed up and got things working! Checkout my branch feature/superfeedauth
I created a SuperAuthMethod and a seperate test_superfeed.py. Fill in your username and password at the top of the file and then python run it. The user-info stuff works, but I'm category/feed stuff fails due to some Not supported errors. But it's something to work from