Source

CherryPy / cherrypy / test / webtest.py

The branch 'wspb' does not exist.
Diff from to

File cherrypy/test/webtest.py

 from cherrypy._cpcompat import basestring, ntob, py3k, HTTPConnection, HTTPSConnection, unicodestr
 
 
-
 def interface(host):
     """Return an IP address for a client connection given the server host.
 
                 msg = '%r:%r not in headers' % (key, value)
         self._handlewebError(msg)
 
+    def assertHeaderIn(self, key, values, msg=None):
+        """Fail if header indicated by key doesn't have one of the values."""
+        lowkey = key.lower()
+        for k, v in self.headers:
+            if k.lower() == lowkey:
+                matches = [value for value in values if str(value) == v]
+                if matches:
+                    return matches
+
+        if msg is None:
+            msg = '%(key)r not in %(values)r' % vars()
+        self._handlewebError(msg)
+
     def assertHeaderItemValue(self, key, value, msg=None):
         """Fail if the header does not contain the specified value"""
         actual_value = self.assertHeader(key, msg=msg)