def test_get_by_recent_miss_not_shared(self): Mission.create(editor=self.user.id, name="test mission 3", city="LA", state="CA", country='US') db.session.commit() recent = Mission.get_by_recent() self.assertEqual(len(recent), 2)
def missions(): """Missions view.""" query_params = request.args.to_dict() if not query_params: missions = Mission.get_by_recent() else: missions = Mission.search(query_params) return render_template('main_views/missions.html', missions=missions, form_data=query_params)
def test_get_by_recent(self): mission3 = Mission.create(editor=self.user.id, name="test mission 3", city="LA", state="CA", country='US') mission3.share() db.session.commit() recent = Mission.get_by_recent() self.assertEqual(len(recent), 3) self.assertEqual(recent[0], mission3)