-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ReBenchDB API version detection
ReBenchDB will send a header on an OPTIONS request advertising that version 2.0.0 of the API is supported. Signed-off-by: Stefan Marr <[email protected]>
- Loading branch information
Showing
4 changed files
with
73 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from .mock_http_server import MockHTTPServer | ||
from .rebench_test_case import ReBenchTestCase | ||
from ..rebenchdb import ReBenchDB | ||
|
||
|
||
class ReBenchDBTest(ReBenchTestCase): | ||
def test_is_api_v2(self): | ||
server = MockHTTPServer() | ||
try: | ||
port = server.get_free_port() | ||
server.start() | ||
|
||
db = ReBenchDB('http://localhost:' + str(port), 'project', 'experiment', self.ui) | ||
self.assertTrue(db.is_api_v2()) | ||
finally: | ||
server.process_and_shutdown() | ||
|
||
def test_is_api_v2_on_server_without_v2_support(self): | ||
server = MockHTTPServer(False) | ||
try: | ||
port = server.get_free_port() | ||
server.start() | ||
|
||
db = ReBenchDB('http://localhost:' + str(port), 'project', 'experiment', self.ui) | ||
self.assertFalse(db.is_api_v2()) | ||
finally: | ||
server.process_and_shutdown() |