
Story: 2008529 Task: 41923 Signed-off-by: Bin Yang <bin.yang@windriver.com> Change-Id: Icd665ffff700f1d915233ee3630ffd8ec5c5d923
29 lines
790 B
Python
29 lines
790 B
Python
#
|
|
# Copyright (c) 2021 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
from unittest import TestCase
|
|
from webtest import TestApp
|
|
from notificationclient.tests import FunctionalTest
|
|
|
|
|
|
class TestRootController(FunctionalTest):
|
|
|
|
def test_get(self):
|
|
response = self.app.get('/')
|
|
assert response.status_int == 200
|
|
|
|
def test_search(self):
|
|
response = self.app.post('/', params={'q': 'RestController'})
|
|
assert response.status_int == 302
|
|
assert response.headers['Location'] == (
|
|
'https://pecan.readthedocs.io/en/latest/search.html'
|
|
'?q=RestController'
|
|
)
|
|
|
|
def test_get_not_found(self):
|
|
response = self.app.get('/a/bogus/url', expect_errors=True)
|
|
assert response.status_int == 404
|