def test_two_commits_with_different_email_are_not_equal(self):
     hash = get_rand_hash()
     author = 'PZ'
     date = get_curr_date()
     subject = 'Commit message'
     commit1 = Commit(hash, author, '*****@*****.**', date, subject)
     commit2 = Commit(hash, author, '*****@*****.**', date, subject)
     self.assertNotEqual(commit1, commit2)
 def test_two_commits_with_different_author_are_not_equal(self):
     hash = get_rand_hash()
     email = '*****@*****.**'
     date = get_curr_date()
     subject = 'Commit message'
     commit1 = Commit(hash, 'Petr Zemek', email, date, subject)
     commit2 = Commit(hash, 'PZ', email, date, subject)
     self.assertNotEqual(commit1, commit2)
 def test_two_commits_with_equal_data_are_equal(self):
     hash = get_rand_hash()
     author = 'PZ'
     email = '*****@*****.**'
     date = get_curr_date()
     subject = 'Commit message'
     commit1 = Commit(hash, author, email, date, subject)
     commit2 = Commit(hash, author, email, date, subject)
     self.assertEqual(commit1, commit2)
 def test_two_commits_with_different_date_do_not_hash_to_same_value(self):
     commit1 = Commit(
         40 * 'a',
         'PZ',
         '*****@*****.**',
         get_curr_date(),
         'message'
     )
     commit2 = Commit(
         40 * 'f',
         'PZ',
         '*****@*****.**',
         get_curr_date(),
         'message'
     )
     self.assertNotEqual(hash(commit1), hash(commit2))
def create_commit(hash=None, author=None, email=None, date=None, subject=None):
    """Returns a new commit, possibly based on the given data (if not None)."""
    hash = hash if hash is not None else get_rand_hash()
    author = author if author is not None else 'Petr Zemek'
    email = email if email is not None else '*****@*****.**'
    date = date if date is not None else get_curr_date()
    subject = subject if subject is not None else 'Commit message'
    return Commit(hash, author, email, date, subject)
 def test_two_identical_commits_are_equal(self):
     commit = Commit(
         get_rand_hash(),
         'PZ',
         '*****@*****.**',
         get_curr_date(),
         'Commit message'
     )
     self.assertEqual(commit, commit)
 def _commit_from_row(self, row):
     """Creates a commit from the data in the given row."""
     return Commit(
         row.hash,
         row.author,
         row.email,
         row.date,
         row.subject
     )
 def test_two_commits_with_different_msg_are_not_equal(self):
     hash = get_rand_hash()
     author = 'PZ'
     date = get_curr_date()
     commit1 = Commit(
         hash,
         author,
         '*****@*****.**',
         date,
         'Commit message'
     )
     commit2 = Commit(
         hash,
         author,
         '*****@*****.**',
         date,
         'Some other commit message'
     )
     self.assertNotEqual(commit1, commit2)
 def test_two_commits_with_different_date_are_not_equal(self):
     hash = get_rand_hash()
     author = 'PZ'
     email = '*****@*****.**'
     subject = 'Commit message'
     commit1 = Commit(
         hash,
         author,
         email,
         datetime.datetime(2007, 12, 11, 5, 43, 14),
         subject
     )
     commit2 = Commit(
         hash,
         author,
         email,
         datetime.datetime(2014, 5, 18, 10, 27, 53),
         subject
     )
     self.assertNotEqual(commit1, commit2)
 def test_data_passed_into_constructor_are_accessible_after_creation(self):
     hash = get_rand_hash()
     author = 'Petr Zemek'
     email = '*****@*****.**'
     date = get_curr_date()
     subject = 'Commit message'
     commit = Commit(hash, author, email, date, subject)
     self.assertEqual(commit.hash, hash)
     self.assertEqual(commit.author, author)
     self.assertEqual(commit.email, email)
     self.assertEqual(commit.date, date)
     self.assertEqual(commit.subject, subject)
 def test_returns_correct_commit(self):
     self.assertEqual(
         self.repo.get_current_commit(),
         Commit(self.hash, self.author, self.email, self.date, self.subject)
     )
 def test_two_equal_commits_hash_to_same_value(self):
     date = get_curr_date()
     commit1 = Commit(40 * 'a', 'PZ', '*****@*****.**', date, 'message')
     commit2 = Commit(40 * 'a', 'PZ', '*****@*****.**', date, 'message')
     self.assertEqual(hash(commit1), hash(commit2))