Add unit and integration tests

Re-submission of a previous pull request: adds unit tests and an integration test for this backend.