Merge "Change PTL informatin in INFO"
[bottlenecks.git] / testsuites / vstf / vstf_scripts / vstf / controller / reporters / report / provider / html_provider.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 LOG = logging.getLogger(__name__)
13 from vstf.controller.settings.html_settings import HtmlSettings
14 from vstf.controller.settings.template_settings import TemplateSettings
15
16
17 class HtmlProvider(object):
18
19     def __init__(self, info, style):
20         self._info = info
21         self._style = style
22
23     @property
24     def get_style(self):
25         assert "style" in self._style
26         return self._style["style"]
27
28     @property
29     def get_context(self):
30         assert "context" in self._info
31         return self._info["context"]
32
33
34 def main():
35     from vstf.common.log import setup_logging
36     setup_logging(
37         level=logging.DEBUG,
38         log_file="/var/log/html-provder.log",
39         clevel=logging.INFO)
40
41     html_settings = HtmlSettings()
42     LOG.info(html_settings.settings)
43     info = TemplateSettings()
44     provider = HtmlProvider(info.settings, html_settings.settings)
45     LOG.info(provider.get_style)
46     LOG.info(provider.get_context)
47
48 if __name__ == '__main__':
49     main()