test: Add a test case to validate get_unseen_notes
This commit is contained in:
parent
6bbd8fcb32
commit
67350e9ac3
1 changed files with 29 additions and 0 deletions
29
frappe/tests/test_boot.py
Normal file
29
frappe/tests/test_boot.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import unittest
|
||||
|
||||
import frappe
|
||||
from frappe.boot import get_unseen_notes
|
||||
from frappe.desk.doctype.note.note import mark_as_seen
|
||||
|
||||
|
||||
class TestBootData(unittest.TestCase):
|
||||
def test_get_unseen_notes(self):
|
||||
frappe.db.delete("Note")
|
||||
frappe.db.delete("Note Seen By")
|
||||
note = frappe.get_doc(
|
||||
{
|
||||
"doctype": "Note",
|
||||
"title": "Test Note",
|
||||
"notify_on_login": 1,
|
||||
"content": "Test Note 1",
|
||||
"public": 1,
|
||||
}
|
||||
)
|
||||
note.insert()
|
||||
|
||||
frappe.set_user("test@example.com")
|
||||
unseen_notes = [d.title for d in get_unseen_notes()]
|
||||
self.assertListEqual(unseen_notes, ["Test Note"])
|
||||
|
||||
mark_as_seen(note.name)
|
||||
unseen_notes = [d.title for d in get_unseen_notes()]
|
||||
self.assertListEqual(unseen_notes, [])
|
||||
Loading…
Add table
Reference in a new issue