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 master.
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 master
19 """.strip().replace('^A', chr(0x01)).split('\n') + [''] # noqa
22 class DAGTestCase(helper
.GitRepositoryTestCase
):
25 helper
.GitRepositoryTestCase
.setUp(self
)
26 self
.params
= dag
.DAG('HEAD', 1000)
27 self
.reader
= dag
.RepoReader(self
.context
, self
.params
)
29 @mock.patch('cola.models.dag.core')
30 def test_repo_reader(self
, core
):
31 expect
= len(LOG_LINES
) - 1
34 core
.readline
.return_value
= LOG_LINES
[0]
35 for idx
, _
in enumerate(self
.reader
.get()):
36 core
.readline
.return_value
= LOG_LINES
[idx
+1]
39 self
.assertEqual(expect
, actual
)
41 @mock.patch('cola.models.dag.core')
42 def test_repo_reader_order(self
, core
):
44 'ad454b189fe5785af397fd6067cf103268b6626e',
45 '1ba04ad185cf9f04c56c8482e9a73ef1bd35c695',
46 'fa5ad6c38be603e2ffd1f9b722a3a5c675f63de2',
47 '103766573cd4e6799d3ee792bcd632b92cf7c6c0',
48 'e3f5a2d0248de6197d6e0e63c901810b8a9af2f8',
49 'f4fb8fd5baaa55d9b41faca79be289bb4407281e',
50 '23e7eab4ba2c94e3155f5d261c693ccac1342eb9',
52 core
.readline
.return_value
= LOG_LINES
[0]
53 for idx
, commit
in enumerate(self
.reader
.get()):
54 core
.readline
.return_value
= LOG_LINES
[idx
+1]
56 self
.assertEqual(commits
[idx
], commit
.oid
)
58 @mock.patch('cola.models.dag.core')
59 def test_repo_reader_parents(self
, core
):
62 ['ad454b189fe5785af397fd6067cf103268b6626e'],
63 ['1ba04ad185cf9f04c56c8482e9a73ef1bd35c695'],
64 ['fa5ad6c38be603e2ffd1f9b722a3a5c675f63de2'],
65 ['fa5ad6c38be603e2ffd1f9b722a3a5c675f63de2'],
66 ['e3f5a2d0248de6197d6e0e63c901810b8a9af2f8'],
67 ['f4fb8fd5baaa55d9b41faca79be289bb4407281e'],
69 core
.readline
.return_value
= LOG_LINES
[0]
70 for idx
, commit
in enumerate(self
.reader
.get()):
71 core
.readline
.return_value
= LOG_LINES
[idx
+1]
73 self
.assertEqual(parents
[idx
], [p
.oid
for p
in commit
.parents
])
75 @mock.patch('cola.models.dag.core')
76 def test_repo_reader_contract(self
, core
):
77 core
.exists
.return_value
= True
78 core
.readline
.return_value
= LOG_LINES
[0]
80 for idx
, _
in enumerate(self
.reader
.get()):
81 core
.readline
.return_value
= LOG_LINES
[idx
+1]
83 core
.start_command
.assert_called()
84 call_args
= core
.start_command
.call_args
85 self
.assertTrue('log.abbrevCommit=false' in call_args
[0][0])
86 self
.assertTrue('log.showSignature=false' in call_args
[0][0])