Fix urlencode for python2.x
Added tests for param ordering during cache key generation