import os, signal os.kill(os.getpid(), signal.SIGSEGV) Reset Test Tables testtables_reset Just wait a while for a timeout Only notYou may see this. Dynamic Template Test arg 1.25 return [ {"title": "on title", "other": "ing"}, {"other": "world"}] if ctx.request.uri.endswith(b"bombout"): return open("/dev/null") # nevow can't render a file else: return "" from gavo import svcs excName = inputTable.getParam("what") if excName=="DataError": raise base.DataError("test error") raise svcs.__dict__[excName]("test error", hint="This is for testing") up1 = inputTable.getParam("up1") up2 = inputTable.getParam("up2") return "text/plain", "%s: %s\n%s: %s\n"%( up1[0], up1[1].read().decode("utf-8"), up2[0], up2[1].read().decode("utf-8")) limited/form self.assertHTTPStatus(401) timeout/form self.assertHasStrings("Just wait a while", "Query timed out (took too") /seffe/__system__/adql self.assertHTTPStatus(401) abc, die Katze lief im Schnee. hurgl uploads self.assertHasStrings( "test.txt: abc, die Katze lief im Schnee.", "a.out: hurgl",) abc, die Katze lief im Schnee. hurgl uploads self.assertHasStrings( "test.txt: abc, die Katze lief im Schnee.", "a.out: hurgl") /__system__/adql/query/form self.assertLacksStrings("Admin me") /__system__/adql/query/info TAP examples') ]]> /adql self.assertHTTPStatus(301) self.assertHasStrings('__system__/adql/query/form"', "Moved Permanently") /tableinfo/thistable.doesnotexist self.assertHasStrings("table 'thistable.doesnotexist' could not be" " located in DaCHS' table listing.") /oai.xml verb') ]]> /oai.xml self.assertValidatesXSD() self.assertHasStrings("'do_a_hiccup' is an unsupported operation.") /oai.xml self.assertHasStrings("<oai:Identify") self.assertValidatesXSD() /static/help.shtml self.assertHasStrings("Service discovery", "Search forms", "VOTable", "sidebar") /__system__/adql/query/form self.assertHasStrings("Service info", "Could not parse", 'Expected SELECT') /__system__/adql/query/form self.assertHasStrings("Could not locate table", "Result link") /__system__/tap/run/sync ', '', "Required parameter 'lang' missing.") ]]>
1
]]>
/tap/sync
self.assertXpath("//v:FIELD[1]", {"name": "oid"}) self.assertXpath("//v:FIELD[2]", {"name": "oid_"})
/ from gavo.utils import ElementTree tree = ElementTree.fromstring(self.data) self.assertEqual(tree[1].tag, '{http://www.w3.org/1999/xhtml}body') gzip/ import gzip, io stuff = gzip.GzipFile(fileobj=io.BytesIO(self.data)).read() self.assertTrue(b'src="/static/img/logo_medium.png"' in stuff, "decompressed response looks about right") for key, value in self.headers: if key=="X-Cache-Creation": self.assertFalse(value is None) break else: raise AssertionError("Compressed data comes from Cache") / self.assertHasStrings('src="/static/img/logo_medium.png"') for key, value in self.headers: if key=="X-Cache-Creation": self.assertFalse(value is None) break else: raise AssertionError("No x-cache-creation header") dyntemplate/qp/bombout self.assertHTTPStatus(200) # I'd like this to be a 500, but # this error only happens when the status line has been # written; HTML streaming is important enough for me with # my potentially large HTML tables that I'll suck this up. # The 500 will at least be in the log. self.assertHasStrings("Internal Error", "A(n) FlattenerError exception occurred", "UnsupportedType: &lt;_io.TextIOWrapper") excName, expStatus, id, extraText UnknownURI, 404, cur-a, within the data center ForbiddenURI, 403, cur-b, complain fiercely WebRedirect, 301, cur-c, different URL SeeOther, 303, cur-d, Please turn Authenticate, 401, cur-e, access is protected BadMethod, 405, cur-f, HTTP method DataError, 406, cur-g, server cannot generate test error, 500, cur-h, KeyError errors self.assertHasStrings('href="mailto:') self.assertHTTPStatus(\expStatus) if "\excName"=="Authenticate": # Auth template doesn't show exception self.assertHasStrings("\extraText") else: self.assertHasStrings("test error", "\extraText")