Ejemplo n.º 1
0
    def test_search_by_name_for_substring(self):
        request = self.factory.get("", {"current_query": "Bar"})

        request.user = get_user()

        response = views.vendors(request)

        self.assertEqual(response.content.count("Showing 1 vendors"), 1)

        request = self.factory.get("", {"current_query": "Vendor"})
        request.user = get_user()

        response = views.vendors(request)
        self.assertEqual(response.content.count("Showing 4 vendors"), 1)
Ejemplo n.º 2
0
 def count_option_elements():
     request = self.factory.get("")
     request.user = get_user()
     response = views.vendors(request)
     content = BeautifulSoup(response.content)
     neighborhood_element = filter(lambda x: x["name"] == "neighborhood", content.find_all("select"))[0]
     return len(neighborhood_element.find_all("option"))
Ejemplo n.º 3
0
 def count_option_elements():
     request = self.factory.get('')
     request.user = get_user()
     response = views.vendors(request)
     content = BeautifulSoup(response.content)
     neighborhood_element = filter(
         lambda x: x['name'] == 'neighborhood',
         content.find_all('select'))[0]
     return len(neighborhood_element.find_all('option'))
Ejemplo n.º 4
0
    def test_search_by_name_approved_only(self):
        self.v4.approval_status = SF.QUARANTINED
        self.v4.save()

        request = self.factory.get("", {"current_query": "Vendor"})
        request.user = get_user()

        response = views.vendors(request)
        self.assertEqual(response.content.count("Showing 3 vendors"), 1)
Ejemplo n.º 5
0
    def test_search_by_name_approved_only(self):
        self.v4.approval_status = 'quarantined'
        self.v4.save()

        request = self.factory.get('',
                                   {'current_query': 'Vendor', })
        request.user = get_user()

        response = views.vendors(request)
        self.assertEqual(response.content.count("Showing 3 vendors"), 1)