def test_close_registrations(self):
        system = EMS()
        user = system.get_user('4119998')
        seminar = (1,0,'Test Seminar',4119993,'Testing','2018-12-10 22:00:00','UNSW','2019-01-01 22:00:00','2019-01-30 22:00:00','2018-12-1 22:00:00',1,100,0)
        dbInserter.insert_Seminar(seminar)
        session1 = (1,'Hi','Tommy','Hi',50,0,1,0)
        dbInserter.insert_Session(session1)
        session2 = (2,'Bye','Tommy','Bye',50,0,1,0)
        dbInserter.insert_Session(session2)

        test_sess = system.get_event('Session', 1)

        with pytest.raises(Exception) as e_info:
            updated = system.update_attendees('register', test_sess, 'Session', user.email)

        test_sess = system.get_event('Session',1)
        self.assertEqual(test_sess.noAttendees, 0)
        session_list = dbHandler.select_all_products("Session")
        self.assertEqual(session_list[0], session1)
    def test_active_register_seminar(self):
        system = EMS()
        user = system.get_user('6119988')
        date_format = "%Y-%m-%d %H:%M:%S"
        yesterday = str(datetime.strftime(datetime.now() - timedelta(1), date_format))
        tomorrow = str(datetime.strftime(datetime.now() + timedelta(1), date_format))
        seminar = (1,1,'Test Seminar',4119993,'Testing','2018-12-10 22:00:00','UNSW',yesterday,tomorrow,'2018-12-1 22:00:00',1,100,0)
        dbInserter.insert_Seminar(seminar)
        session = (1,'Hi','Tommy','Hi',50,0,1,1)
        dbInserter.insert_Session(session)
        session = (2,'Bye','Tommy','Bye',50,0,1,1)
        dbInserter.insert_Session(session)

        test_sess = system.get_event('Session', 1)

        with pytest.raises(Exception) as e_info:
            updated = system.update_attendees('register', test_sess, 'Session', user.email)

        seminar_registration = dbHandler.select_all_products("User_Seminar")
        self.assertEqual(seminar_registration, [])
        session_registration = dbHandler.select_all_products("User_Session")
        self.assertEqual(session_registration, [])
    def test_full_register_seminar(self):
        system = EMS()
        user = system.get_user('6119988')
        seminar = (1,1,'Test Seminar',4119993,'Testing','2018-12-10 22:00:00','UNSW','2019-01-01 22:00:00','2019-01-30 22:00:00','2018-12-1 22:00:00',1,100,100)
        dbInserter.insert_Seminar(seminar)
        session1 = (1,'Hi','Tommy','Hi',50,50,1,1)
        dbInserter.insert_Session(session1)
        session2 = (2,'Bye','Tommy','Bye',50,50,1,1)
        dbInserter.insert_Session(session2)

        test_sess = system.get_event('Session', 1)

        self.assertTrue(system.update_attendees('register', test_sess, 'Session', user.email) == 0)
        test_sess = system.get_event('Session',1)
        self.assertEqual(test_sess.noAttendees, 50)
        session1 = (1,'Hi','Tommy','Hi',50,50,1,1)
        session_list = dbHandler.select_all_products("Session")
        self.assertEqual(session_list[0], session1)

        seminar_registration = dbHandler.select_products("User_Seminar", "Email", "*****@*****.**")
        self.assertTrue(seminar_registration == [])
        session_registration = dbHandler.select_products("User_Session", "Email", "*****@*****.**")
        self.assertTrue(session_registration == [])