Parent: [11cfbe] (diff)

Child: [022f09] (diff)

Download this file

test_parser.py    56 lines (44 with data), 1.6 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import os
from unittest import TestCase
from pylons import c, g
import ming
from pyforge import model as M
from pyforge.lib import app_globals
from forgescm.lib import hg, git
from forgescm import model as FM
ming.configure(**{'ming.main.master':'mongo://localhost:27017/pyforge'})
class EmptyClass(object): pass
class TestHgLogParser(TestCase):
def setUp(self):
path = os.path.join(
os.path.dirname(__file__),
'hg.log')
self.fp = open(path)
g._push_object(app_globals.Globals())
c._push_object(EmptyClass())
c.project = M.Project.m.get(_id='projects/test/')
c.app = c.project.app_instance('src')
FM.Commit.m.remove(dict(app_conf_id=c.app.config._id))
FM.Patch.m.remove(dict(app_conf_id=c.app.config._id))
def test_parse_hg(self):
parser = hg.LogParser(c.app.repo._id)
commits = parser.feed(self.fp)
for ct in commits:
pass
class TestGitLogParser(TestCase):
def setUp(self):
path = os.path.join(
os.path.dirname(__file__),
'git.log')
self.fp = open(path)
g._push_object(app_globals.Globals())
c._push_object(EmptyClass())
c.project = M.Project.m.get(_id='projects/test/')
c.app = c.project.app_instance('src_git')
FM.Commit.m.remove(dict(app_conf_id=c.app.config._id))
FM.Patch.m.remove(dict(app_conf_id=c.app.config._id))
def test_parse_git(self):
parser = git.LogParser(c.app.repo._id)
commits = parser.feed(self.fp)
for ct in commits:
pass