def test_grow_session(self): self.make_data_grow_session() self.assertEqual(len(GrowSession.get_active()), 1, "Number of active grow sessions is wrong") grow_session = GrowSession.get_active()[0] self.assertTrue(grow_session.is_active()) grow_session2 = GrowSession.get_inactive()[0] self.assertFalse(grow_session2.is_active())
def make_data_subscriber(self): self.db.session.add(GrowSession(name="grow_session", start_date=datetime.now())) grow_session = GrowSession.get_active()[0] self.db.session.add(Subscriber(name="test_subscriber", grow_session_id=grow_session.id)) self.db.session.add(GrowSession(name="grow_session2")) grow_session2 = GrowSession.get_inactive()[0] self.db.session.add(Subscriber(name="test_subscriber2", grow_session_id=grow_session2.id)) self.db.session.commit()