2 """Tests DAG functionality"""
3 from __future__
import absolute_import
, division
, unicode_literals
6 from cola
.models
import dag
12 ad454b189fe5785af397fd6067cf103268b6626e^A^A (tag: refs/tags/v0.0)^ADavid Aguilar^AFri Nov 30 00:03:28 2007 -0800^Adavvid@gmail.com^Afirst cut of ugit
13 1ba04ad185cf9f04c56c8482e9a73ef1bd35c695^Aad454b189fe5785af397fd6067cf103268b6626e^A^ADavid Aguilar^AFri Nov 30 05:07:47 2007 -0800^Adavvid@gmail.com^Aupdated model/view/controller api
14 fa5ad6c38be603e2ffd1f9b722a3a5c675f63de2^A1ba04ad185cf9f04c56c8482e9a73ef1bd35c695^A^ADavid Aguilar^AFri Nov 30 05:19:05 2007 -0800^Adavvid@gmail.com^AAvoid multiple signoffs
15 103766573cd4e6799d3ee792bcd632b92cf7c6c0^Afa5ad6c38be603e2ffd1f9b722a3a5c675f63de2^A^ADavid Aguilar^ATue Dec 11 05:13:21 2007 -0800^Adavvid@gmail.com^AAdded TODO
16 e3f5a2d0248de6197d6e0e63c901810b8a9af2f8^Afa5ad6c38be603e2ffd1f9b722a3a5c675f63de2^A^ADavid Aguilar^AMon Dec 3 02:36:06 2007 -0800^Adavvid@gmail.com^AMerged qlistwidgets into main.
17 f4fb8fd5baaa55d9b41faca79be289bb4407281e^Ae3f5a2d0248de6197d6e0e63c901810b8a9af2f8^A^ADavid Aguilar^ATue Dec 4 03:14:56 2007 -0800^Adavvid@gmail.com^ASquashed commit of the following:
18 23e7eab4ba2c94e3155f5d261c693ccac1342eb9^Af4fb8fd5baaa55d9b41faca79be289bb4407281e^A^ADavid Aguilar^AThu Dec 6 18:59:20 2007 -0800^Adavvid@gmail.com^AMerged diffdisplay into main
19 """.strip().replace( # noqa
28 class DAGTestCase(helper
.GitRepositoryTestCase
):
30 helper
.GitRepositoryTestCase
.setUp(self
)
31 self
.params
= dag
.DAG('HEAD', 1000)
32 self
.reader
= dag
.RepoReader(self
.context
, self
.params
)
34 @mock.patch('cola.models.dag.core')
35 def test_repo_reader(self
, core
):
36 expect
= len(LOG_LINES
) - 1
39 core
.readline
.return_value
= LOG_LINES
[0]
40 for idx
, _
in enumerate(self
.reader
.get()):
41 core
.readline
.return_value
= LOG_LINES
[idx
+ 1]
44 self
.assertEqual(expect
, actual
)
46 @mock.patch('cola.models.dag.core')
47 def test_repo_reader_order(self
, core
):
49 'ad454b189fe5785af397fd6067cf103268b6626e',
50 '1ba04ad185cf9f04c56c8482e9a73ef1bd35c695',
51 'fa5ad6c38be603e2ffd1f9b722a3a5c675f63de2',
52 '103766573cd4e6799d3ee792bcd632b92cf7c6c0',
53 'e3f5a2d0248de6197d6e0e63c901810b8a9af2f8',
54 'f4fb8fd5baaa55d9b41faca79be289bb4407281e',
55 '23e7eab4ba2c94e3155f5d261c693ccac1342eb9',
57 core
.readline
.return_value
= LOG_LINES
[0]
58 for idx
, commit
in enumerate(self
.reader
.get()):
59 core
.readline
.return_value
= LOG_LINES
[idx
+ 1]
61 self
.assertEqual(commits
[idx
], commit
.oid
)
63 @mock.patch('cola.models.dag.core')
64 def test_repo_reader_parents(self
, core
):
67 ['ad454b189fe5785af397fd6067cf103268b6626e'],
68 ['1ba04ad185cf9f04c56c8482e9a73ef1bd35c695'],
69 ['fa5ad6c38be603e2ffd1f9b722a3a5c675f63de2'],
70 ['fa5ad6c38be603e2ffd1f9b722a3a5c675f63de2'],
71 ['e3f5a2d0248de6197d6e0e63c901810b8a9af2f8'],
72 ['f4fb8fd5baaa55d9b41faca79be289bb4407281e'],
74 core
.readline
.return_value
= LOG_LINES
[0]
75 for idx
, commit
in enumerate(self
.reader
.get()):
76 core
.readline
.return_value
= LOG_LINES
[idx
+ 1]
78 self
.assertEqual(parents
[idx
], [p
.oid
for p
in commit
.parents
])
80 @mock.patch('cola.models.dag.core')
81 def test_repo_reader_contract(self
, core
):
82 core
.exists
.return_value
= True
83 core
.readline
.return_value
= LOG_LINES
[0]
85 for idx
, _
in enumerate(self
.reader
.get()):
86 core
.readline
.return_value
= LOG_LINES
[idx
+ 1]
88 core
.start_command
.assert_called()
89 call_args
= core
.start_command
.call_args
90 self
.assertTrue('log.abbrevCommit=false' in call_args
[0][0])
91 self
.assertTrue('log.showSignature=false' in call_args
[0][0])