Statistics
| Revision:

gvsig-scripting / org.gvsig.scripting / trunk / org.gvsig.scripting / org.gvsig.scripting.app / org.gvsig.scripting.app.mainplugin / src / main / resources-plugin / scripting / lib / dulwich / tests / test_reflog.py @ 959

History | View | Annotate | Download (2.78 KB)

1
# test_reflog.py -- tests for reflog.py
2
# encoding: utf-8
3
# Copyright (C) 2015 Jelmer Vernooij <jelmer@samba.org>
4
#
5
# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
6
# General Public License as public by the Free Software Foundation; version 2.0
7
# or (at your option) any later version. You can redistribute it and/or
8
# modify it under the terms of either of these two licenses.
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15
#
16
# You should have received a copy of the licenses; if not, see
17
# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
18
# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
19
# License, Version 2.0.
20
#
21

    
22
"""Tests for dulwich.reflog."""
23

    
24

    
25
from dulwich.reflog import (
26
    format_reflog_line,
27
    parse_reflog_line,
28
    )
29

    
30
from dulwich.tests import (
31
    TestCase,
32
    )
33

    
34

    
35
class ReflogLineTests(TestCase):
36

    
37
    def test_format(self):
38
        self.assertEqual(
39
            b'0000000000000000000000000000000000000000 '
40
            b'49030649db3dfec5a9bc03e5dde4255a14499f16 Jelmer Vernooij '
41
            b'<jelmer@jelmer.uk> 1446552482 +0000        '
42
            b'clone: from git://jelmer.uk/samba',
43
            format_reflog_line(
44
                b'0000000000000000000000000000000000000000',
45
                b'49030649db3dfec5a9bc03e5dde4255a14499f16',
46
                b'Jelmer Vernooij <jelmer@jelmer.uk>',
47
                1446552482, 0, b'clone: from git://jelmer.uk/samba'))
48

    
49
        self.assertEqual(
50
            b'0000000000000000000000000000000000000000 '
51
            b'49030649db3dfec5a9bc03e5dde4255a14499f16 Jelmer Vernooij '
52
            b'<jelmer@jelmer.uk> 1446552482 +0000        '
53
            b'clone: from git://jelmer.uk/samba',
54
            format_reflog_line(
55
                None,
56
                b'49030649db3dfec5a9bc03e5dde4255a14499f16',
57
                b'Jelmer Vernooij <jelmer@jelmer.uk>',
58
                1446552482, 0, b'clone: from git://jelmer.uk/samba'))
59

    
60
    def test_parse(self):
61
        self.assertEqual(
62
                (b'0000000000000000000000000000000000000000',
63
                 b'49030649db3dfec5a9bc03e5dde4255a14499f16',
64
                 b'Jelmer Vernooij <jelmer@jelmer.uk>',
65
                 1446552482, 0, b'clone: from git://jelmer.uk/samba'),
66
                 parse_reflog_line(
67
                     b'0000000000000000000000000000000000000000 '
68
                     b'49030649db3dfec5a9bc03e5dde4255a14499f16 Jelmer Vernooij '
69
                     b'<jelmer@jelmer.uk> 1446552482 +0000        '
70
                     b'clone: from git://jelmer.uk/samba'))