def test_get_commit_time_without_date(self): mocked_repo = MagicMock() with patch("gitfs.views.history.time") as mocked_time: mocked_time.time.return_value = "1" history = HistoryView(repo=mocked_repo) assert history._get_commit_time(0) == 1
def test_first_commit_time(self): mocked_repo = MagicMock() mocked_commit_time = MagicMock() mocked_commit_time.return_value = 1 history = HistoryView(repo=mocked_repo) history._get_commit_time = mocked_commit_time assert history._get_first_commit_time() == 1 mocked_commit_time.assert_called_once_with(0)
def test_get_commit_time_with_invalid_date(self): mocked_repo = MagicMock() mocked_commit = MagicMock() mocked_commit.timestamp = 1 mocked_repo.commits = {"now": [mocked_commit]} with patch("gitfs.views.history.time") as mocked_time: mocked_time.time.return_value = "1" history = HistoryView(repo=mocked_repo) history.date = "not-now" assert history._get_commit_time(0) == 1