marnanel-wip
Marnanel Thurman 2023-11-16 00:53:06 +00:00
rodzic 9e1154cd6e
commit e581c4610c
1 zmienionych plików z 22 dodań i 13 usunięć

Wyświetl plik

@ -1,5 +1,8 @@
import sys
import traceback
import argparse
import requests
from bs4 import BeautifulSoup
class RemoteTests:
def __init__(self, user, host):
@ -23,19 +26,20 @@ class RemoteTests:
uri = '/.well-known/host-meta',
#accept = 'application/xrd+xml',
)
assert r.status_code==200, (
f"Status code should be 200 and was {r.status_code}"
)
assert r.headers['Content-Type'] == 'application/xrd+xml', (
f"Content-Type was {r.headers['Content-Type']}"
)
# FIXME also parse it
compare(r.status_code, '==', 200)
compare(r.headers['Content-Type'], '==',
'application/xrd+xml')
content = BeautifulSoup(r.text, features='xml')
compare (content, '==', 'banana')
def try_0020_not_gatewayed(self):
r = self.req(method = 'GET',
uri = '/.kepi-not-gatewayed',
)
assert r.status_code!=200
compare(r.status_code, '==', 200)
def run(self):
print('Looking up')
@ -50,15 +54,20 @@ class RemoteTests:
try:
result = getattr(self, name)()
except Exception as e:
result = repr(e)
success = True
except Exception:
_, _, tb = sys.exc_info()
stack = traceback.extract_tb(tb)
result = repr(stack[-1].line)
success = False
if result in (True, None):
if success:
print('ok')
else:
print('FAIL')
if result!=False:
print(result)
if result!=None:
print(result)
def main():
parser = argparse.ArgumentParser(