Exemplo n.º 1
0
    def test_search_miss(self):
        miss = Mission.search({
            'city': 'ithica',
            'state': 'ny',
            'keywords': 'potato',
            'country': 'us',
            'sort_by': 'recent'
        })

        self.assertListEqual([], miss)
Exemplo n.º 2
0
    def test_search_hit(self):

        hit = Mission.search({
            'city': 'ithica',
            'state': 'ny',
            'keywords': 'little',
            'country': 'us',
            'sort_by': 'recent'
        })

        self.assertListEqual([self.mission2], hit)
Exemplo n.º 3
0
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)
Exemplo n.º 4
0
    def test_search_miss_not_shared(self):

        m3 = Mission.create(
            editor=self.user.id,
            name='I like cheese.',
            city='San Francisco',
            state='CA',
            country='US',
            description="What is there to explain. Let's get some cheese.")

        m3.businesses.append(self.business)
        db.session.commit()

        miss = Mission.search({
            'city': '',
            'state': '',
            'keywords': '',
            'country': '',
            'sort_by': 'recent'
        })

        self.assertEqual(len(miss), 2)