~panda-roux/MoonGem

ref: fee4c7c3300f74d8444be03923034bd4973258aa MoonGem/test/test.py -rw-r--r-- 521 bytes
fee4c7c3 — panda-roux adding a testing framework 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import test_definitions as td
import ignition as ig
import sys

tests = {
    'empty.gmi':      td.exists,
    'does_not_exist.gmi': td.does_not_exist
}

def main():
    for route, func in tests.items():
        response = ig.request(f'//localhost:1966/{route}')
        passed, msg = func(response)
        if not passed:
            print(f'[{func.__name__}] failed ({route}): {msg}') 
            sys.exit(-1)
        else:
            print(f'{func.__name__} passed ({route})')

if __name__ == '__main__':
    main()