Add commits-since function
This commit is contained in:
@@ -3,7 +3,7 @@ import unittest.mock
|
||||
import requests
|
||||
import json
|
||||
|
||||
from nixprstatus.pr import commit_in_branch, pr_merge_status
|
||||
from nixprstatus.pr import commit_in_branch, pr_merge_status, commits_since
|
||||
|
||||
|
||||
def mocked_requests_get(*args, **kwargs):
|
||||
@@ -53,3 +53,12 @@ class TestCommitInBranch(unittest.TestCase):
|
||||
self.assertTrue(res)
|
||||
res = commit_in_branch(commit_sha, "nixos-24.05")
|
||||
self.assertFalse(res)
|
||||
|
||||
|
||||
class TestCommitsSince(unittest.TestCase):
|
||||
@unittest.mock.patch("requests.get", side_effect=mocked_requests_get)
|
||||
def test_commits_since_27e30d17(self, mock_get):
|
||||
commit_sha = "27e30d177e57d912d614c88c622dcfdb2e6e6515"
|
||||
|
||||
res = commits_since("nixos-unstable", commit_sha)
|
||||
self.assertEqual(res, 795)
|
||||
|
||||
Reference in New Issue
Block a user