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