Files
sciagent/be0/tests/test_user_notifications_merit.py
T
Thinh Lam 688fac73e9
CI/CD / backend (push) Failing after 2m8s
CI/CD / frontend (push) Failing after 1m40s
CI/CD / deploy (push) Has been skipped
sciagent code + Gitea Actions CI/CD
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 09:38:30 +07:00

67 lines
2.2 KiB
Python

"""Unit tests for merit label derivation from draft JSON (notification body).
Run: cd be0 && python -m unittest tests.test_user_notifications_merit -v
"""
from __future__ import annotations
import unittest
class MeritCategoryFromDraftTests(unittest.TestCase):
def test_poster_without_review_is_trung_binh(self) -> None:
from src.initiative_db.user_notifications import merit_category_label_from_draft_payload
payload = {
"tabs": {
"application": {
"initiativeClassification": "research",
"researchEvidenceKind": "poster-without-review",
}
}
}
self.assertEqual(merit_category_label_from_draft_payload(payload), "Trung bình")
def test_international_remains_xuat_sac(self) -> None:
from src.initiative_db.user_notifications import merit_category_label_from_draft_payload
payload = {
"tabs": {
"application": {
"initiativeClassification": "research",
"researchEvidenceKind": "international",
}
}
}
self.assertEqual(merit_category_label_from_draft_payload(payload), "Xuất sắc")
def test_textbook_book_is_xuat_sac(self) -> None:
from src.initiative_db.user_notifications import merit_category_label_from_draft_payload
payload = {
"tabs": {
"application": {
"initiativeClassification": "textbook",
"textbookEvidenceKind": "book",
}
}
}
self.assertEqual(merit_category_label_from_draft_payload(payload), "Xuất sắc")
def test_poster_with_review_still_kha_bucket(self) -> None:
from src.initiative_db.user_notifications import merit_category_label_from_draft_payload
payload = {
"tabs": {
"application": {
"initiativeClassification": "research",
"researchEvidenceKind": "poster",
}
}
}
self.assertEqual(merit_category_label_from_draft_payload(payload), "Khá")
if __name__ == "__main__":
unittest.main()