import influxframework
from influxframework.boot import get_unseen_notes
from influxframework.desk.doctype.note.note import mark_as_seen
from influxframework.tests.utils import InfluxFrameworkTestCase


class TestBootData(InfluxFrameworkTestCase):
	def test_get_unseen_notes(self):
		influxframework.db.delete("Note")
		influxframework.db.delete("Note Seen By")
		note = influxframework.get_doc(
			{
				"doctype": "Note",
				"title": "Test Note",
				"notify_on_login": 1,
				"content": "Test Note 1",
				"public": 1,
			}
		)
		note.insert()

		influxframework.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, [])
