def test_should_build_query_with_start_and_end_date_for_mm_yyyy_format(self):
     mock_form_model = MagicMock(spec=FormModel)
     mock_form_model.get_field_by_code.return_value = DateField(name='q1', code='q1', label='q1',
                                                                date_format='mm.yyyy')
     mock_form_model.id = 'form_id'
     actual_query = DateQuestionRangeFilter('11.2013-09.2013', mock_form_model, 'q1').build_filter_query()
     self.assertDictEqual(actual_query.to_dict(),
                          {'range': {'form_id_q1_value': {'gte': u'11.2013', 'lte': u'09.2013'}}})
    def test_should_call_query_match_for_current_day(self):
        mock_form_model = MagicMock(spec=FormModel)
        mock_form_model.get_field_by_code.return_value = DateField(name='q1', code='q1', label='q1',
                                                                   date_format='dd.mm.yyyy')
        mock_form_model.id = 'form_id'
        today = "26.11.2013"

        actual_query = DateQuestionRangeFilter(today, mock_form_model, 'q1').build_filter_query()

        self.assertDictEqual(actual_query.to_dict(),
                             {'range': {'form_id_q1_value': {'gte': u'26.11.2013', 'lte': u'26.11.2013'}}})