Updated functional tests to use new configuration format when specifying API version
This commit is contained in:
parent
ec648ea753
commit
13331efe0d
2 changed files with 9 additions and 10 deletions
|
@ -42,8 +42,8 @@ class TestBase(unittest.TestCase):
|
||||||
else:
|
else:
|
||||||
print("\nTesting %s v%d" % (cls.testcase_name, cls.api_version))
|
print("\nTesting %s v%d" % (cls.testcase_name, cls.api_version))
|
||||||
|
|
||||||
cls.client = trovebox.Trovebox(config_file=cls.config_file,
|
cls.client = trovebox.Trovebox(config_file=cls.config_file)
|
||||||
api_version=cls.api_version)
|
cls.client.configure(api_version=cls.api_version)
|
||||||
|
|
||||||
if cls.client.photos.list() != []:
|
if cls.client.photos.list() != []:
|
||||||
raise ValueError("The test server (%s) contains photos. "
|
raise ValueError("The test server (%s) contains photos. "
|
||||||
|
|
|
@ -16,8 +16,8 @@ class TestFramework(test_base.TestBase):
|
||||||
"""
|
"""
|
||||||
API v0 has a special hello world message
|
API v0 has a special hello world message
|
||||||
"""
|
"""
|
||||||
client = trovebox.Trovebox(config_file=self.config_file,
|
client = trovebox.Trovebox(config_file=self.config_file)
|
||||||
api_version=0)
|
client.configure(api_version=0)
|
||||||
result = client.get("hello.json")
|
result = client.get("hello.json")
|
||||||
self.assertEqual(result['message'],
|
self.assertEqual(result['message'],
|
||||||
"Hello, world! This is version zero of the API!")
|
"Hello, world! This is version zero of the API!")
|
||||||
|
@ -28,8 +28,8 @@ class TestFramework(test_base.TestBase):
|
||||||
For all API versions >0, we get a generic hello world message
|
For all API versions >0, we get a generic hello world message
|
||||||
"""
|
"""
|
||||||
for api_version in range(1, test_base.get_test_server_api() + 1):
|
for api_version in range(1, test_base.get_test_server_api() + 1):
|
||||||
client = trovebox.Trovebox(config_file=self.config_file,
|
client = trovebox.Trovebox(config_file=self.config_file)
|
||||||
api_version=api_version)
|
client.configure(api_version=api_version)
|
||||||
result = client.get("hello.json")
|
result = client.get("hello.json")
|
||||||
self.assertEqual(result['message'], "Hello, world!")
|
self.assertEqual(result['message'], "Hello, world!")
|
||||||
self.assertEqual(result['result']['__route__'],
|
self.assertEqual(result['result']['__route__'],
|
||||||
|
@ -40,8 +40,7 @@ class TestFramework(test_base.TestBase):
|
||||||
If the API version is unspecified,
|
If the API version is unspecified,
|
||||||
we get a generic hello world message.
|
we get a generic hello world message.
|
||||||
"""
|
"""
|
||||||
client = trovebox.Trovebox(config_file=self.config_file,
|
client = trovebox.Trovebox(config_file=self.config_file)
|
||||||
api_version=None)
|
|
||||||
result = client.get("hello.json")
|
result = client.get("hello.json")
|
||||||
self.assertEqual(result['message'], "Hello, world!")
|
self.assertEqual(result['message'], "Hello, world!")
|
||||||
self.assertEqual(result['result']['__route__'], "/hello.json")
|
self.assertEqual(result['result']['__route__'], "/hello.json")
|
||||||
|
@ -52,7 +51,7 @@ class TestFramework(test_base.TestBase):
|
||||||
(ValueError, since the returned 404 HTML page is not valid JSON)
|
(ValueError, since the returned 404 HTML page is not valid JSON)
|
||||||
"""
|
"""
|
||||||
version = trovebox.LATEST_API_VERSION + 1
|
version = trovebox.LATEST_API_VERSION + 1
|
||||||
client = trovebox.Trovebox(config_file=self.config_file,
|
client = trovebox.Trovebox(config_file=self.config_file)
|
||||||
api_version=version)
|
client.configure(api_version=version)
|
||||||
with self.assertRaises(trovebox.Trovebox404Error):
|
with self.assertRaises(trovebox.Trovebox404Error):
|
||||||
client.get("hello.json")
|
client.get("hello.json")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue