Debian Codegraph @

testenv/Test--https-crl.py

raw
1 #!/usr/bin/env python3
2 from sys import exit
3 from test.http_test import HTTPTest
4 from test.base_test import HTTPS, SKIP_TEST
5 from misc.wget_file import WgetFile
6 import os
7
8 """
9 This test ensures that Wget can download files from HTTPS Servers
10 """
11 if os.getenv('SSL_TESTS') is None:
12 exit (SKIP_TEST)
13
14 ############# File Definitions ###############################################
15 File1 = "Would you like some Tea?"
16 File2 = "With lemon or cream?"
17
18 A_File = WgetFile ("File1", File1)
19 B_File = WgetFile ("File2", File2)
20
21 CAFILE = os.path.abspath(os.path.join(os.getenv('srcdir', '.'), 'certs', 'ca-cert.pem'))
22 CRLFILE = os.path.abspath(os.path.join(os.getenv('srcdir', '.'), 'certs', 'server-crl.pem'))
23 WGET_OPTIONS = "--crl-file " + CRLFILE + " --ca-certificate=" + CAFILE
24 WGET_URLS = [["File1", "File2"]]
25
26 Files = [[A_File, B_File]]
27
28 Servers = [HTTPS]
29
30 ExpectedReturnCode = 5
31
32 ################ Pre and Post Test Hooks #####################################
33 pre_test = {
34 "ServerFiles" : Files
35 }
36 test_options = {
37 "WgetCommands" : WGET_OPTIONS,
38 "Urls" : WGET_URLS
39 }
40 post_test = {
41 "ExpectedRetcode" : ExpectedReturnCode
42 }
43
44 err = HTTPTest (
45 pre_hook=pre_test,
46 test_params=test_options,
47 post_hook=post_test,
48 protocols=Servers
49 ).begin ()
50
51 exit (err)