Acceptance tests

Fixes #315.
These nested functions and repeated use of the variable `d` makes this difficult to read. 
You can probably flatten it out a bit by chaining the returned deferreds
You could also assign more descriptive names for the deferreds at each stage.