~pexego/openobject-addons/6.1-pexego-sale_commission

« back to all changes in this revision

Viewing changes to pexego-runbot/try-template.py

  • Committer: Santi Argueso (Pexego)
  • Date: 2013-02-06 17:03:36 UTC
  • mfrom: (10.1.6 pexego-addons_6.1)
  • Revision ID: santiago@pexego.es-20130206170336-ml430s6p9jknun0j
[MERGE]

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Use a mako template with some sample data.
2
 
import re
3
 
import sys
4
 
import time
5
 
 
6
 
import openerprunbot.templates
7
 
 
8
 
if __name__ == "__main__":
9
 
    class RunBotBranch(object):
10
 
        """ Dummy Branch class to test mako templates. """
11
 
        project_name = 'server'
12
 
        unique_name = '~openerp-dev/openobject-server/trunk-dummy'
13
 
        merge_count = 1
14
 
        local_revision_count = 333
15
 
        overriden_repo_path = None
16
 
        overriden_project_name = None
17
 
 
18
 
    class Point(object):
19
 
        """ Dummy Point class to test mako templates. """
20
 
        state = 'running'
21
 
        test_base_result = True
22
 
        test_all_result = True
23
 
        job_id = 2
24
 
        subdomain = 'trunk_dummy_2'
25
 
        port = 22
26
 
        need_run_reason = ['server']
27
 
        manual_build = sys.maxint
28
 
        running_t0 = 100000
29
 
        repo_updates = [RunBotBranch()]
30
 
        version = 'trunk'
31
 
 
32
 
    class RunBotGroupedBranchBase(object):
33
 
        """ Dummy Group class to test mako templates. """
34
 
        name = 'trunk-dummy'
35
 
        team_name = 'openerp-dev'
36
 
        manual_build = sys.maxint
37
 
        wrong_matching = False
38
 
        points = [None, None, Point()]
39
 
        version = 'trunk'
40
 
        def repo_updates(selef):
41
 
            return [RunBotBranch()]
42
 
 
43
 
    class RunBot(object):
44
 
        """ Dummy RunBot class to test mako templates. """
45
 
        domain = 'runbotdev.openerp.com'
46
 
        number = 555
47
 
        workers = 666
48
 
        current_job_id = 777
49
 
        manual_build_count = 888
50
 
        server_net_port = 12000
51
 
        server_xml_port = 12100
52
 
        def nginx_index_time(self, t):
53
 
            return 'sometime'
54
 
        def available_workers(self):
55
 
            return 444
56
 
        def nginx_groups_sticky(self, team_name):
57
 
            return [RunBotGroupedBranchBase()]
58
 
        def nginx_groups_others(self, team_name):
59
 
            return []
60
 
        def nginx_groups_registered(self, team_name):
61
 
            return []
62
 
        def teams_with_branches(self):
63
 
            return ['openerp-dev']
64
 
 
65
 
    response = openerprunbot.templates.render_template('notice.html.mako',
66
 
        r=RunBot(), t=time.time(), re=re, team_name='openerp-dev', sys=sys, message="Hello")
67
 
    print response
68