xref: /OK3568_Linux_fs/yocto/poky/meta/lib/oeqa/sdk/buildtools-cases/https.py (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun#
2*4882a593Smuzhiyun# SPDX-License-Identifier: MIT
3*4882a593Smuzhiyun#
4*4882a593Smuzhiyun
5*4882a593Smuzhiyunfrom oeqa.sdk.case import OESDKTestCase
6*4882a593Smuzhiyunfrom oeqa.utils.subprocesstweak import errors_have_output
7*4882a593Smuzhiyunerrors_have_output()
8*4882a593Smuzhiyun
9*4882a593Smuzhiyunclass HTTPTests(OESDKTestCase):
10*4882a593Smuzhiyun    """
11*4882a593Smuzhiyun    Verify that HTTPS certificates are working correctly, as this depends on
12*4882a593Smuzhiyun    environment variables being set correctly.
13*4882a593Smuzhiyun    """
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun    def test_wget(self):
16*4882a593Smuzhiyun        self._run('env -i wget --debug --output-document /dev/null https://yoctoproject.org/connectivity.html')
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun    def test_python(self):
19*4882a593Smuzhiyun        # urlopen() returns a file-like object on success and throws an exception otherwise
20*4882a593Smuzhiyun        self._run('python3 -c \'import urllib.request; urllib.request.urlopen("https://yoctoproject.org/connectivity.html")\'')
21