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