Add unit-tests for some of the functions

Also, stub the Zulip API server so our tests aren't actually making
requests to a live server.