import xhiveframework
from xhiveframework.deferred_insert import deferred_insert, save_to_db
from xhiveframework.tests.utils import XhiveFrameworkTestCase


class TestDeferredInsert(XhiveFrameworkTestCase):
	def test_deferred_insert(self):
		route_history = {"route": xhiveframework.generate_hash(), "user": "Administrator"}
		deferred_insert("Route History", [route_history])

		save_to_db()
		self.assertTrue(xhiveframework.db.exists("Route History", route_history))
