Added assertion for versioned OpenStack extension APIs. Required for the Neutron v2 API.

This commit is contained in:
Jeremy Daggett 2014-08-22 20:19:27 -07:00 committed by Jeremy Daggett
parent 60e3763999
commit ddd00a20de
1 changed files with 16 additions and 7 deletions

View File

@ -159,12 +159,21 @@ public class BaseOpenStackMockTest<A extends Closeable> {
}
/**
* Ensures server received authentication request.
* Ensures server received an extensions request. Most OpenStack APIs that expose an {@link ExtensionApi}
* should use this method.
*/
public void assertExtensions(MockWebServer server) {
assertExtensions(server, "");
}
/**
* Ensures server received a <i>versioned</i> extensions request. This is necessary for testing APIs whose version
* is not included in the Endpoint's {@link Endpoint#getPublicURL() publicURL}.
*/
public void assertExtensions(MockWebServer server, String path) {
assertTrue(server.getRequestCount() >= 1);
try {
assertEquals(server.takeRequest().getRequestLine(), "GET /extensions HTTP/1.1");
assertEquals(server.takeRequest().getRequestLine(), "GET " + path + "/extensions HTTP/1.1");
} catch (InterruptedException e) {
Throwables.propagate(e);
}