'Checks the one to many relationship between event and session_types and
the many to one relationship between session and session_types'

def test_add_session_type_to_db(self):

    self.app = Setup.create_app()
    with app.test_request_context():
        event = ObjectMother.get_event()
        session1 = ObjectMother.get_session()
        session_type1 = SessionType(name='Type1', length='30', event_id='1')
        session_type2 = SessionType(name='Type2', length='30', event_id='1')
        session2 = Session(title='test2', long_abstract='dsadsd', starts_at=datetime(2003, 8, 4, 12, 30, 45).replace(tzinfo=timezone('UTC')), ends_at=datetime(2003, 8, 4, 12, 30, 45).replace(tzinfo=timezone('UTC')), session_type=session_type1)
        save_to_db(event, 'Event    Saved')
        save_to_db(session1, 'Session1    Saved')
        save_to_db(session2, 'Session2    Saved')
        save_to_db(session_type1, 'SessionType1    Saved')
        save_to_db(session_type2, 'SessionType2    Saved')
        self.assertEqual(session_type1.event_id, 1)
        self.assertEqual(session_type2.event_id, 1)
        self.assertEqual(session2.session_type_id, 1)
        self.assertEqual(session1.session_type_id, None)
