Upload the contribution of vstf as bottleneck network framework.
[bottlenecks.git] / vstf / vstf / controller / settings / html_settings.py
1 #!/usr/bin/python
2 # -*- coding: utf8 -*-
3 # author: wly
4 # date: 2015-09-25
5 # see license for license details
6 __version__ = ''' '''
7
8 import logging
9
10 import vstf.controller.settings.settings as sets
11
12 LOG = logging.getLogger(__name__)
13
14
15 class HtmlSettings(sets.Settings):
16     def __init__(self, path="/etc/vstf/", filename="reporters.html-settings", mode=sets.SETS_DEFAULT):
17         super(HtmlSettings, self).__init__(path, filename, mode)
18
19
20 def unit_test():
21     from vstf.common.log import setup_logging
22     setup_logging(level=logging.DEBUG, log_file="/var/log/html-settings.log", clevel=logging.DEBUG)
23     html_settings = HtmlSettings()
24     style = {
25         'table': {
26             'font-family': '"Trebuchet MS", Arial, Helvetica, sans-serif',
27             'border-collapse': 'collapse',
28             'border': '1px solid green',
29             'padding': '8px',
30             'text-align': 'center'
31         },
32         'td':
33             {
34                 'border': '1px solid green',
35                 'padding': '8px',
36                 'word-wrap': 'break-all'
37             },
38         'th':
39             {
40                 'background-color': '#EAF2D3',
41                 'border': '1px solid green',
42                 'padding': '8px'
43             }
44     }
45
46     html_settings.set_style(style)
47     LOG.info(html_settings.settings)
48
49
50 if __name__ == '__main__':
51     unit_test()