test_reflog.py 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # test_reflog.py -- tests for reflog.py
  2. # encoding: utf-8
  3. # Copyright (C) 2015 Jelmer Vernooij <jelmer@samba.org>
  4. #
  5. # This program is free software; you can redistribute it and/or
  6. # modify it under the terms of the GNU General Public License
  7. # as published by the Free Software Foundation; version 2
  8. # of the License or (at your option) any later version of
  9. # the License.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  19. # MA 02110-1301, USA.
  20. """Tests for dulwich.reflog."""
  21. from dulwich.reflog import (
  22. format_reflog_line,
  23. parse_reflog_line,
  24. )
  25. from dulwich.tests import (
  26. TestCase,
  27. )
  28. class ReflogLineTests(TestCase):
  29. def test_format(self):
  30. self.assertEqual(
  31. b'0000000000000000000000000000000000000000 '
  32. b'49030649db3dfec5a9bc03e5dde4255a14499f16 Jelmer Vernooij '
  33. b'<jelmer@jelmer.uk> 1446552482 +0000 '
  34. b'clone: from git://jelmer.uk/samba',
  35. format_reflog_line(
  36. b'0000000000000000000000000000000000000000',
  37. b'49030649db3dfec5a9bc03e5dde4255a14499f16',
  38. b'Jelmer Vernooij <jelmer@jelmer.uk>',
  39. 1446552482, 0, b'clone: from git://jelmer.uk/samba'))
  40. self.assertEqual(
  41. b'0000000000000000000000000000000000000000 '
  42. b'49030649db3dfec5a9bc03e5dde4255a14499f16 Jelmer Vernooij '
  43. b'<jelmer@jelmer.uk> 1446552482 +0000 '
  44. b'clone: from git://jelmer.uk/samba',
  45. format_reflog_line(
  46. None,
  47. b'49030649db3dfec5a9bc03e5dde4255a14499f16',
  48. b'Jelmer Vernooij <jelmer@jelmer.uk>',
  49. 1446552482, 0, b'clone: from git://jelmer.uk/samba'))
  50. def test_parse(self):
  51. self.assertEqual(
  52. (b'0000000000000000000000000000000000000000',
  53. b'49030649db3dfec5a9bc03e5dde4255a14499f16',
  54. b'Jelmer Vernooij <jelmer@jelmer.uk>',
  55. 1446552482, 0, b'clone: from git://jelmer.uk/samba'),
  56. parse_reflog_line(
  57. b'0000000000000000000000000000000000000000 '
  58. b'49030649db3dfec5a9bc03e5dde4255a14499f16 Jelmer Vernooij '
  59. b'<jelmer@jelmer.uk> 1446552482 +0000 '
  60. b'clone: from git://jelmer.uk/samba'))