nodejitsu/pkgcloud — pull request #117 by kenperkins (2013-05-01 23:24:17+00:00)
Title: Switching to HTTP tests and Mocha Framework

## Overview

With this change, I've significantly refactored `pkgcloud` test code. There are two major changes:

1. **Switching from `nock` (overriding http.clientRequest) to `hock` (a proper http mock service).**
The primary motivation for this change was to create an environment where our tests were entirely deterministic. Before this change, we had regularly seen tests fail with transposed results.

2. **Switching from `vows` to `mocha`.**
Switching to mocha has enabled a much tighter control over order of execution of tests, while reducing a significant amount of boiler plate. Additionally, as part of this refactor, all mock calls are checked at the end of each tests to ensure an exact match to calls made to calls expected.

*Ken: I expect there are quite a few changes, but I felt like this was mature enough to start the dialog and make progress officially.*

### Other Changes

There are a significant number of lesser changes that need to be evaluated:

1. Adding the ability for every `client` to be provided an endpoint url via `options`.
2. Moving azure TLS signing into a before function defined in the Azure storage client proper.
3. Reworking model.setWait to fix a case where if the API returns an error it can spin indefinitely.
4. Allowing cloudIris _checkCouch function to call a function for deriving the url for the check. This allows us for overriding this in test to a local URL.
5. The diffs between tests is going to be very complex :(

*Caveat: I've tried to follow the style guide 100%, if I've missed something, it wasn't intentional, just an oversight. Please point them out and I'll squash them.*