fix issue label state transitions
This commit is contained in:
1 parent
fdb454414d
commit
3c6d41b49c
2 files changed
+29
-3
No files matched your search
+27
-1
@@ -1,9 +1,35 @@
|
||||
import unittest
|
||||
|
||||
from scripts.lab_loop import LoopError, issue_label_names, transition, validate_owner
|
||||
from scripts.lab_loop import Gitea, LoopError, issue_label_names, transition, validate_owner
|
||||
|
||||
|
||||
class RecordingGitea(Gitea):
|
||||
def __init__(self):
|
||||
super().__init__("https://example.invalid/api/v1", "owner/repo", "secret")
|
||||
self.calls = []
|
||||
|
||||
def labels(self):
|
||||
return {"agent:timmy": 1, "state:claimed": 2, "priority:P0": 3}
|
||||
|
||||
def request(self, method, path, payload=None):
|
||||
self.calls.append((method, path, payload))
|
||||
|
||||
|
||||
class LoopProtocolTests(unittest.TestCase):
|
||||
def test_set_labels_uses_gitea_replace_labels_endpoint(self):
|
||||
api = RecordingGitea()
|
||||
api.set_labels(7, {"agent:timmy", "state:claimed", "priority:P0"})
|
||||
self.assertEqual(
|
||||
api.calls,
|
||||
[
|
||||
(
|
||||
"PUT",
|
||||
"/repos/owner/repo/issues/7/labels",
|
||||
{"labels": [1, 3, 2]},
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
def test_transition_replaces_agent_and_state_but_preserves_kind_and_priority(self):
|
||||
labels = {"agent:timmy", "state:claimed", "priority:P1", "kind:build"}
|
||||
self.assertEqual(
|
||||
|
||||
Reference in new issue
Block a user