OILS / soil / web_test.py View on Github | oils.pub

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