Mercurial > kallithea
diff rhodecode/tests/vcs/test_repository.py @ 3692:5f9f4ece4b52 beta
added __eq__ operation on vcs Repository objects
- eq compare if objects are same class and have the same path
- fixes some issues introduced after @LazyProperty was removed from scm_instance
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 05 Apr 2013 19:42:07 +0200 |
parents | 32471bd1f4ee |
children | d7488551578e |
line wrap: on
line diff
--- a/rhodecode/tests/vcs/test_repository.py Fri Apr 05 19:21:52 2013 +0200 +++ b/rhodecode/tests/vcs/test_repository.py Fri Apr 05 19:42:07 2013 +0200 @@ -31,6 +31,19 @@ self.assertEqual(self.repo.get_user_email(TEST_USER_CONFIG_FILE), 'foo.bar@example.com') + def test_repo_equality(self): + self.assertTrue(self.repo == self.repo) + + def test_repo_equality_broken_object(self): + import copy + _repo = copy.copy(self.repo) + delattr(_repo, 'path') + self.assertTrue(self.repo != _repo) + + def test_repo_equality_other_object(self): + class dummy(object): + path = self.repo.path + self.assertTrue(self.repo != dummy()) class RepositoryGetDiffTest(BackendTestMixin):