<commit_before>from test_base import MainTestCase
from odk_viewer.views import csv_export, xls_export, zip_export, kml_export
from django.core.urlresolvers import reverse

import time

class TestFormExports(MainTestCase):

    def setUp(self):
        MainTestCase.setUp(self)
        self._create_user_and_login()
        self._publish_transporation_form_and_submit_instance()
        self.csv_url = reverse(csv_export, kwargs={
                'username': self.user.username,
                'id_string': self.xform.id_string})

    def test_csv_raw_export_name(self):
        response = self.client.get(self.csv_url + '?raw=1')
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response['Content-Disposition'], 'attachment;')

    def test_filter_by_date(self):
        time.sleep(1)
        before_time = time.strftime('%Y_%m_%d_%H_%M_%S')
        response = self.client.get(self.csv_url + '?end=%s' % before_time)
        before_length = response['Content-Length']
        self._make_submissions()
        after_time = time.strftime('%Y_%m_%d_%H_%M_%S')
        response = self.client.get(self.csv_url + '?start=%s' % before_time)
        after_length = response['Content-Length']
        response = self.client.get(self.csv_url)
        full_length = response['Content-Length']
        self.assertEqual(after_length > before_length, True)
        self.assertEqual(full_length > after_length, True)
<commit_msg>test end<commit_after>from test_base import MainTestCase
from odk_viewer.views import csv_export, xls_export, zip_export, kml_export
from django.core.urlresolvers import reverse

import time

class TestFormExports(MainTestCase):

    def setUp(self):
        MainTestCase.setUp(self)
        self._create_user_and_login()
        self._publish_transporation_form_and_submit_instance()
        self.csv_url = reverse(csv_export, kwargs={
                'username': self.user.username,
                'id_string': self.xform.id_string})

    def test_csv_raw_export_name(self):
        response = self.client.get(self.csv_url + '?raw=1')
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response['Content-Disposition'], 'attachment;')

    def test_filter_by_date(self):
        first_time = time.strftime('%Y_%m_%d_%H_%M_%S')
        time.sleep(1)
        before_time = time.strftime('%Y_%m_%d_%H_%M_%S')
        response = self.client.get(self.csv_url + '?end=%s' % before_time)
        before_length = response['Content-Length']
        self._make_submissions()
        after_time = time.strftime('%Y_%m_%d_%H_%M_%S')
        response = self.client.get(self.csv_url + '?start=%s' % before_time)
        after_length = response['Content-Length']
        response = self.client.get(self.csv_url)
        full_length = response['Content-Length']
        self.assertEqual(after_length > before_length, True)
        self.assertEqual(full_length > after_length, True)
        response = self.client.get(self.csv_url + '?end=%s' % first_time)
        before_length = response['Content-Length']
        self.assertEqual(after_length > before_length, True)
        self.assertEqual(full_length > before_length, True)

{'fraction_non_alphanumeric': 0.117813383600377, 'fraction_numerical': 0.0031416902293433867, 'mean_word_length': 3.434540389972145, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2467001', 'n_tokens_mistral': 1037, 'n_tokens_neox': 1013, 'n_words': 155}