REV: more improvement

Refactor to support lazy initialization of credential cache.
Rewrite whole unittest.
Improve SPEC and setup.py
Update documentation