diff --git a/os_api_ref/tests/test_basic_example.py b/os_api_ref/tests/test_basic_example.py index dc89bae..20a4fad 100644 --- a/os_api_ref/tests/test_basic_example.py +++ b/os_api_ref/tests/test_basic_example.py @@ -91,7 +91,33 @@ class TestBasicExample(base.TestCase): def test_parameters(self): """Do we get some parameters table""" - table = """ + # TODO(stephenfin): Drop support for this once we drop support for both + # Python 2.7 and Sphinx < 2.0, likely in "U" + if sphinx.version_info >= (2, 0, 0): + table = """
++++++ + + + + + + + + + + + + + + +

Name

In

Type

Description

name

body

string

The name of things

""" + else: + table = """@@ -118,7 +144,65 @@ class TestBasicExample(base.TestCase): def test_rest_response(self): - success_table = """table border="1" class="docutils"> + # TODO(stephenfin): Drop support for this once we drop support for both + # Python 2.7 and Sphinx < 2.0, likely in "U" + if sphinx.version_info >= (2, 0, 0): + success_table = """
++++ + + + + + + + + + + + + + + + + +

Code

Reason

200 - OK

Request was successful.

100 - Continue

An unusual code for an API

201 - Created

Resource was created and is ready to use.

""" + + error_table = """ ++++ + + + + + + + + + + + + + + + + + + + + + + + + + +

Code

Reason

405 - Method Not Allowed

Method is not valid for this endpoint.

403 - Forbidden

Policy does not allow current user to do this operation.

401 - Unauthorized

User must authenticate before making a request

400 - Bad Request

Some content in the request was invalid

500 - Internal Server Error

Something went wrong inside the service.

409 - Conflict

There is already a zone with this name.

""" + else: + success_table = """table border="1" class="docutils"> @@ -142,7 +226,7 @@ class TestBasicExample(base.TestCase): """ - error_table = """ + error_table = """
@@ -174,5 +258,6 @@ class TestBasicExample(base.TestCase):
""" + self.assertIn(success_table, self.content) self.assertIn(error_table, self.content) diff --git a/os_api_ref/tests/test_microversions.py b/os_api_ref/tests/test_microversions.py index d58f673..11f3636 100644 --- a/os_api_ref/tests/test_microversions.py +++ b/os_api_ref/tests/test_microversions.py @@ -18,6 +18,7 @@ Tests for `os_api_ref` module. """ from bs4 import BeautifulSoup +import sphinx from sphinx_testing import with_app from os_api_ref.tests import base @@ -55,7 +56,48 @@ class TestMicroversions(base.TestCase): def test_parameters_table(self): """Test that min / max mv css class attributes are set in params""" - table = """
+ if sphinx.version_info >= (2, 0, 0): + table = """
+ ++++++ + + + + + + + + + + + + + + + + + + + + + + + + +

Name

In

Type

Description

name

body

string

The name of things

name2

body

string

The name of things

+

New in version 2.11

+

name3

body

string

The name of things

+

Available until version 2.20

+
+
+""" # noqa + else: + table = """
@@ -94,6 +136,7 @@ class TestMicroversions(base.TestCase):
""" # noqa + self.assertIn(table, self.content) def test_mv_selector(self):