提交
This commit is contained in:
1 parent
48dcf991dc
commit
be2226e4ca
100 files changed
+61340
-40975
No files matched your search
@@ -257,24 +257,32 @@ class TestCommentCrud(unittest.TestCase):
|
||||
)
|
||||
self.assertEqual(again["status"], "revoked")
|
||||
|
||||
def test_cannot_comment_when_not_running(self):
|
||||
def test_can_comment_and_revoke_when_completed(self):
|
||||
from app.services import oa_instance_comment as svc
|
||||
from app.services.oa_engine import OaEngineError
|
||||
from app.models.models import OaInstance
|
||||
|
||||
inst = self.db.query(OaInstance).filter(OaInstance.id == "i1").one()
|
||||
inst.status = "completed"
|
||||
self.db.commit()
|
||||
with self.assertRaises(OaEngineError):
|
||||
svc.create_comment(
|
||||
self.db,
|
||||
instance_id="i1",
|
||||
tenant_no="zkxw",
|
||||
user_id="u1",
|
||||
dept_id="d1",
|
||||
content="x",
|
||||
attachment_refs=None,
|
||||
)
|
||||
row = svc.create_comment(
|
||||
self.db,
|
||||
instance_id="i1",
|
||||
tenant_no="zkxw",
|
||||
user_id="u1",
|
||||
dept_id="d1",
|
||||
content="结束后仍可评论",
|
||||
attachment_refs=None,
|
||||
)
|
||||
self.assertEqual(row["status"], "normal")
|
||||
self.assertTrue(row["canRevoke"])
|
||||
revoked = svc.revoke_comment(
|
||||
self.db,
|
||||
instance_id="i1",
|
||||
comment_id=row["id"],
|
||||
tenant_no="zkxw",
|
||||
user_id="u1",
|
||||
)
|
||||
self.assertEqual(revoked["status"], "revoked")
|
||||
|
||||
|
||||
class TestCommentMentionGrant(unittest.TestCase):
|
||||
|
||||
Reference in new issue
Block a user