edx/edx-platform — pull request #1965 by wedaly (2013-12-16 18:17:31+00:00)
Title: Stub Server Port Conflicts and Refactor

In the acceptance tests, we create stub HTTP servers for XQueue, YouTube, and LTI. Currently, we assign port numbers randomly, which sometimes leads to test failures when ports are being used by another process (see the JIRA ticket below for an example).

This PR fixes the issue by hard-coding port numbers. In Jenkins, this should be fine, since we run one test at a time on each worker. Locally, developers can override ports using private settings.

I've also substantially refactored XQueue and YouTube stubs:

1) Moved the stubs to common/djangoapps/terrain/stubs
2) Renamed them from "mocks" to "stubs" (see [Mocks Aren't Stubs](http://martinfowler.com/articles/mocksArentStubs.html))
3) Created a common base class to handle logging and configuration of stubs. In anticipation of changes related to bok-choy, I've added a "PUT" http end-point for configuring stubs remotely.

I made a few other changes to the acceptance tests to get them passing consistently on devstack as well as in Jenkins.

After a conversation with @auraz this morning, I skipped refactoring the LTI stub, since the Blades team will be changing it soon. As the Blades team makes those changes, I'd like them to follow the conventions defined in this PR.

Suggested reviewers: @jzoldak and @auraz

JIRA: https://edx-wiki.atlassian.net/browse/TE-276