Server landing page add test for empty projects

This commit is contained in:
Alessandro Pasotti 2020-08-17 09:52:54 +02:00
parent d0ffd56839
commit 0c34fc56ae
2 changed files with 30 additions and 0 deletions

View File

@ -154,6 +154,15 @@ class QgsServerLandingPageTest(QgsServerAPITestBase):
self.compareApi(
request, None, 'test_project_{}.json'.format(name.replace('.', '_')), subdir='landingpage')
def test_landing_page_json_empty(self):
"""Test landing page in JSON format with no projects"""
os.environ['QGIS_SERVER_PROJECTS_DIRECTORIES'] = ''
os.environ['QGIS_SERVER_PROJECTS_PG_CONNECTIONS'] = ''
request = QgsBufferServerRequest('http://server.qgis.org/index.json')
self.compareApi(
request, None, 'test_landing_page_empty_index.json', subdir='landingpage')
if __name__ == '__main__':
unittest.main()

View File

@ -0,0 +1,21 @@
Content-Type: application/json
{
"links": [
{
"href": "http://server.qgis.org/index.json",
"rel": "self",
"title": "Landing page as JSON",
"type": "application/json"
},
{
"href": "http://server.qgis.org/index.html",
"rel": "alternate",
"title": "Landing page as HTML",
"type": "text/html"
}
],
"projects": [],
"projects_count": 0,
"timeStamp": "2019-07-05T12:27:07Z"
}