Beispiel #1
0
 def test_date_another_day(self):
     # Add a specific date (in the past, as the business logic of not
     # allowing appointments in the past will not have been applied
     # yet.
     self.fake_request.POST[u'anotherday'] = [u'11/28/2010']
     result = process_POST_params(self.fake_request)
     self.assertEqual(result['dates'], [self.today, date(2010, 11, 28)])
Beispiel #2
0
 def test_date_tomorrow_without_today(self):
     # Add tomorrow.
     self.fake_request.POST[u'tomorrow'] = [u'on']
     # Remove today.
     del self.fake_request.POST[u'today']
     result = process_POST_params(self.fake_request)
     self.assertEqual(result['dates'], [self.today + timedelta(days=1)])
Beispiel #3
0
    def test_location(self):
        result = process_POST_params(self.fake_request)

        self.assertEqual(result['lat_long'], {
            u'lat': 37.7749295,
            u'lng': -122.4194155
        })
        self.assertEqual(result['location_full_text'],
                         u'San Francisco, CA, USA')
Beispiel #4
0
def _get_results(request):
    if __debug__:
        _P(request.POST)
    criteria = process_POST_params(request)
    if __debug__:
        print 'post process_POST_params() ->'
        _P(criteria)
        print
    results = dumps(search_for_availabilities(**criteria))
    return results, criteria
Beispiel #5
0
 def test_date_tomorrow(self):
     # Find tomorrow.
     self.fake_request.POST[u'tomorrow'] = [u'on']
     result = process_POST_params(self.fake_request)
     self.assertEqual(result['dates'],
                      [self.today, self.today + timedelta(days=1)])
Beispiel #6
0
 def test_date_today(self):
     # Find today as per the request params above.
     result = process_POST_params(self.fake_request)
     self.assertEqual(result['dates'], [self.today])