integration: add keys API integration tests

haha. ok. @jonboulle This part was ported from 0.4.x. The test cases were written for 0.5 though.