More api unit tests

I am going to write a lot more than this but I like merging small branches so here you go.