csc/Hanlon — pull request #262 by mtnbikenc (2014-11-13 16:22:44+00:00)
Title: Fixes Issue 261 active model spec tests

This PR enables api_active_model_spec.rb tests

Tests in api_active_model_spec.rb were previously disabled due to not functioning properly on an empty database. A sudo hanlon workflow has been implemented to create a temporary active_model for testing.

At the beginning of the test:
- Register a node with random hw_id
- Create a discover_only model
- Create a tag
- Create a tag matcher (which will match our node above)
- Create a discover_only policy with the above tag and model
- Perform a node checkin to bind the node and create the active_model
- whew!

In order to play nice in development environments, we clean up the temporary resources.

At the end of the test:
- Remove the policy
- Remove the tag
- Remove the model

The last test in the spec removes the active_model created during the test. The temporary node will automatically be removed from the database after the standard time-out period.

Fixes Issue #261

Additionally, some corrections have been made to the comments and errors for the policy_spec. Finally, the 'end' comments for sections in api_broker_v1.rb have been corrected. These errors were found while writing the above specs.