Changeset 52636ee in mod_gnutls for test/mgstest/tests.py


Ignore:
Timestamp:
Dec 27, 2019, 3:21:04 PM (11 months ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
master, proxy-ticket
Children:
dd91d9c
Parents:
7089dbc
Message:

TestReq10: Use superclass constructor and _from_yaml function

This provides the same defaults as for other requests, except that the
"Host:" header isn't sent automatically. Also the code is less
complex.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/mgstest/tests.py

    r7089dbc r52636ee  
    242242    strictly requires HTTP/1.0.
    243243
    244     All request parameters (method, path, headers) MUST be specified
    245     in the config file. Checks on status and body work the same as for
    246     TestRequest.
     244    Objects use the same default parameters as TestRequest, but note
     245    that an empty "headers" parameter means that not even a "Host:"
     246    header will be sent. All headers must be specified in the test
     247    configuration file.
    247248
    248249    """
     
    250251    status_re = re.compile('^HTTP/([\d\.]+) (\d+) (.*)$')
    251252
    252     def __init__(self, method, path, headers, expect):
    253         self.method = method
    254         self.path = path
    255         self.headers = headers
    256         self.expect = expect
     253    def __init__(self, **kwargs):
     254        super().__init__(**kwargs)
    257255
    258256    def __repr__(self):
     
    311309# otherwise.
    312310yaml.add_constructor('!request', TestRequest._from_yaml, yaml.Loader)
     311yaml.add_constructor('!request10', TestReq10._from_yaml, yaml.Loader)
    313312yaml.add_constructor('!connection', TestConnection._from_yaml, yaml.Loader)
    314313
Note: See TracChangeset for help on using the changeset viewer.