JIRA: BOTTLENECKS-29
[bottlenecks.git] / vstf / vstf / controller / settings / html_settings.py
1 ##############################################################################
2 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
3 #
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9
10 import logging
11
12 import vstf.controller.settings.settings as sets
13
14 LOG = logging.getLogger(__name__)
15
16
17 class HtmlSettings(sets.Settings):
18     def __init__(self, path="/etc/vstf/", filename="reporters.html-settings", mode=sets.SETS_DEFAULT):
19         super(HtmlSettings, self).__init__(path, filename, mode)
20
21
22 def unit_test():
23     from vstf.common.log import setup_logging
24     setup_logging(level=logging.DEBUG, log_file="/var/log/html-settings.log", clevel=logging.DEBUG)
25     html_settings = HtmlSettings()
26     style = {
27         'table': {
28             'font-family': '"Trebuchet MS", Arial, Helvetica, sans-serif',
29             'border-collapse': 'collapse',
30             'border': '1px solid green',
31             'padding': '8px',
32             'text-align': 'center'
33         },
34         'td':
35             {
36                 'border': '1px solid green',
37                 'padding': '8px',
38                 'word-wrap': 'break-all'
39             },
40         'th':
41             {
42                 'background-color': '#EAF2D3',
43                 'border': '1px solid green',
44                 'padding': '8px'
45             }
46     }
47
48     html_settings.set_style(style)
49     LOG.info(html_settings.settings)
50
51
52 if __name__ == '__main__':
53     unit_test()