-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from camptocamp/imp-commits-data-cache
utils.git.Commit: leverage user's cache to get commit file paths
- Loading branch information
Showing
6 changed files
with
159 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Copyright 2023 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) | ||
|
||
from . import common | ||
|
||
from oca_port.utils import cache | ||
|
||
|
||
class TestUserCache(common.CommonCase): | ||
def setUp(self): | ||
super().setUp() | ||
app = self._create_app( | ||
self._settings["remote_branch1"], | ||
self._settings["remote_branch2"], | ||
from_org="TEST", | ||
) | ||
self.cache = cache.UserCache(app) | ||
|
||
def test_commit_ported(self): | ||
sha = "TEST" | ||
self.assertFalse(self.cache.is_commit_ported(sha)) | ||
self.cache.mark_commit_as_ported(sha) | ||
self.assertTrue(self.cache.is_commit_ported(sha)) | ||
|
||
def test_commit_pr(self): | ||
sha = "TEST" | ||
pr_data = { | ||
"number": 10, | ||
"title": "TEST", | ||
} | ||
self.assertFalse(self.cache.get_pr_from_commit(sha)) | ||
self.cache.store_commit_pr(sha, pr_data) | ||
self.assertDictEqual(self.cache.get_pr_from_commit(sha), pr_data) | ||
|
||
def test_commit_files(self): | ||
sha = "TEST" | ||
files = ["a/b/test", "a/data"] | ||
self.assertFalse(self.cache.get_commit_files(sha)) | ||
self.cache.set_commit_files(sha, files) | ||
self.assertEqual(self.cache.get_commit_files(sha), files) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters