OILS / soil / web_test.py View on Github | oilshell.org

53 lines, 32 significant
1#!/usr/bin/env python2
2"""
3web_test.py: Tests for web.py
4"""
5from __future__ import print_function
6
7import itertools
8import unittest
9
10from soil import web # module under test
11
12
13class WebTest(unittest.TestCase):
14
15 def testParse(self):
16 print(web._ParsePullTime('real 19.99'))
17
18 def testTemplates(self):
19 print(web.HTML_BODY_TOP_T.expand({'title': 'title & other'}))
20
21 job = {
22 'job_num': '123',
23 'job_url': 'https://yo',
24 'git-branch': 'soil-staging',
25 'run_wwz_path': 'dev-minimal.wwz',
26 'index_run_url': '123/',
27
28 'job-name': 'dev-minimal',
29 'start_time_str': '2:22',
30 'pull_time_str': '1:00',
31 'run_time_str': '2:00',
32
33 'details-url': '1234/',
34
35 'GITHUB_RUN_NUMBER': '1234',
36
37 'run_tsv_path': 'tsv',
38 'run_json_path': 'json',
39 'run_wwz_path': 'wwz',
40 }
41
42 jobs = [job]
43
44 jobs.sort(key=web.ByGithubRun, reverse=True)
45 groups = web.GroupJobs(jobs, web.ByGithubRun)
46
47 web.PrintIndexHtml('title', groups)
48
49 web.PrintRunHtml('title', jobs)
50
51
52if __name__ == '__main__':
53 unittest.main()