1
# Copyright (C) 2009, 2010, 2011, 2016 Canonical Ltd
1
# Copyright (C) 2009, 2011 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
61
61
"""Test unpacking a revision"""
62
62
rev = chk_bencode_serializer.read_revision_from_string(
63
63
_working_revision_bencode1)
64
self.assertEqual(rev.committer,
64
self.assertEquals(rev.committer,
65
65
"Canonical.com Patch Queue Manager <pqm@pqm.ubuntu.com>")
66
self.assertEqual(rev.inventory_sha1,
66
self.assertEquals(rev.inventory_sha1,
67
67
"4a2c7fb50e077699242cf6eb16a61779c7b680a7")
68
self.assertEqual(["pqm@pqm.ubuntu.com-20090514104039-kggemn7lrretzpvc",
68
self.assertEquals(["pqm@pqm.ubuntu.com-20090514104039-kggemn7lrretzpvc",
69
69
"jelmer@samba.org-20090510012654-jp9ufxquekaokbeo"],
71
self.assertEqual("(Jelmer) Move dpush to InterBranch.", rev.message)
72
self.assertEqual("pqm@pqm.ubuntu.com-20090514113250-jntkkpminfn3e0tz",
71
self.assertEquals("(Jelmer) Move dpush to InterBranch.", rev.message)
72
self.assertEquals("pqm@pqm.ubuntu.com-20090514113250-jntkkpminfn3e0tz",
74
self.assertEqual({"branch-nick": u"+trunk"}, rev.properties)
75
self.assertEqual(3600, rev.timezone)
74
self.assertEquals({"branch-nick": u"+trunk"}, rev.properties)
75
self.assertEquals(3600, rev.timezone)
77
77
def test_written_form_matches(self):
78
78
rev = chk_bencode_serializer.read_revision_from_string(
83
83
def test_unpack_revision_no_timezone(self):
84
84
rev = chk_bencode_serializer.read_revision_from_string(
85
85
_working_revision_bencode1_no_timezone)
86
self.assertEqual(None, rev.timezone)
86
self.assertEquals(None, rev.timezone)
88
88
def assertRoundTrips(self, serializer, orig_rev):
89
89
text = serializer.write_revision_to_string(orig_rev)
90
90
new_rev = serializer.read_revision_from_string(text)
91
self.assertEqual(orig_rev, new_rev)
91
self.assertEquals(orig_rev, new_rev)
93
93
def test_roundtrips_non_ascii(self):
94
94
rev = Revision("revid1")