from jingrow.model.base_page import BasePage
from jingrow.tests.utils import JingrowTestCase


class TestBasePage(JingrowTestCase):
	def test_pagestatus(self):
		pg = BasePage({"pagestatus": 0, "pagetype": "ToDo"})
		self.assertTrue(pg.pagestatus.is_draft())
		self.assertEqual(pg.pagestatus, 0)

		pg.pagestatus = 1
		self.assertTrue(pg.pagestatus.is_submitted())
		self.assertEqual(pg.pagestatus, 1)

		pg.pagestatus = 2
		self.assertTrue(pg.pagestatus.is_cancelled())
		self.assertEqual(pg.pagestatus, 2)
