Esempio n. 1
0
 def setUp(self):
     self.attachment_count = 0
     MainTestCase.setUp(self)
     self._create_user_and_login()
     self._publish_transportation_form()
     self._submit_transport_instance_w_attachment()
     self.url = reverse(attachment_url, kwargs={'size': 'original'})
Esempio n. 2
0
 def setUp(self):
     MainTestCase.setUp(self)
     xls_file_path = os.path.join(
         os.path.dirname(os.path.abspath(__file__)),
         "../fixtures/tutorial/tutorial.xls"
     )
     self._publish_xls_file_and_set_xform(xls_file_path)
 def setUp(self):
     MainTestCase.setUp(self)
     xls_file_path = os.path.join(
         os.path.dirname(os.path.abspath(__file__)),
         "fixtures/submission_time_validation_x_test.xls"
     )
     self._publish_xls_file_and_set_xform(xls_file_path)
Esempio n. 4
0
 def setUp(self):
     MainTestCase.setUp(self)
     self._create_user_and_login()
     self._publish_transportation_form()
     self._make_submissions()
     self.factory = RequestFactory()
     self.extra = {'HTTP_AUTHORIZATION': 'Token %s' % self.user.auth_token}
Esempio n. 5
0
 def setUp(self):
     self.attachment_count = 0
     MainTestCase.setUp(self)
     self._create_user_and_login()
     self._publish_transportation_form()
     self._submit_transport_instance_w_attachment()
     self.url = reverse(
         attachment_url, kwargs={'size': 'original'})
Esempio n. 6
0
 def setUp(self):
     MainTestCase.setUp(self)
     self._create_user_and_login()
     self._publish_transportation_form_and_submit_instance()
     self.url = reverse(instance, kwargs={
         'username': self.user.username,
         'id_string': self.xform.id_string
     })
Esempio n. 7
0
 def setUp(self):
     MainTestCase.setUp(self)
     self._create_user_and_login()
     self._publish_transportation_form()
     self._make_submissions()
     self.factory = RequestFactory()
     self.extra = {
         'HTTP_AUTHORIZATION': 'Token %s' % self.user.auth_token}
Esempio n. 8
0
 def setUp(self):
     MainTestCase.setUp(self)
     self._create_user_and_login(username='******', password='******')
     self._publish_transportation_form()
     self.api_url = reverse(views.api, kwargs={
         'username': self.user.username,
         'id_string': self.xform.id_string
     })
     self._logout()
Esempio n. 9
0
 def setUp(self):
     MainTestCase.setUp(self)
     self._publish_transportation_form_and_submit_instance()
     media_file = "1335783522563.jpg"
     media_file = os.path.join(
         self.this_directory, 'fixtures',
         'transportation', 'instances', self.surveys[0], media_file)
     instance = Instance.objects.all()[0]
     self.attachment = Attachment.objects.create(
         instance=instance, media_file=File(open(media_file), media_file))
Esempio n. 10
0
 def setUp(self):
     MainTestCase.setUp(self)
     self._publish_transportation_form()
     #
     self.csv_filepath = os.path.join(
         os.path.dirname(os.path.abspath(__file__)), "fixtures",
         "test_update_xform_uuids.csv")
     # get the last defined uuid
     with open(self.csv_filepath, "r") as f:
         lines = csv.reader(f)
         for line in lines:
             self.new_uuid = line[2]
Esempio n. 11
0
 def setUp(self):
     MainTestCase.setUp(self)
     self._publish_transportation_form()
     #
     self.csv_filepath = os.path.join(
         os.path.dirname(os.path.abspath(__file__)),
         "fixtures", "test_update_xform_uuids.csv"
     )
     # get the last defined uuid
     with open(self.csv_filepath, "r") as f:
         lines = csv.reader(f)
         for line in lines:
             self.new_uuid = line[2]
Esempio n. 12
0
 def setUp(self):
     MainTestCase.setUp(self)
     self.instances = settings.MONGO_DB.instances
     self.instances.remove()
     self.assertEquals(list(self.instances.find()), [])
     xls_path = os.path.join(self.this_directory, 'fixtures',
             'transportation', 'mongo',
             'transportation_with_dirty_mongo_ids.xls')
     count = XForm.objects.count()
     response = self._publish_xls_file(xls_path)
     self.assertEqual(XForm.objects.count(), count + 1)
     self.xform = XForm.objects.all().reverse()[0]
     self._make_submission(os.path.join(self.this_directory, 'fixtures',
                 'transportation', 'mongo',
                 'transport_2011-07-25_19-05-36' + '.xml'))
     self.pi = self.xform.surveys.all()[0].parsed_instance
Esempio n. 13
0
    def setUp(self):
        MainTestCase.setUp(self)
        self.survey = create_survey_from_xls("odk_viewer/tests/name_survey.xls")
        json_str = json.dumps(self.survey.to_json_dict())
        self.data_dictionary = DataDictionary.objects.create(
            xml=self.survey.to_xml(), json=json_str, user = self.user)

        info = {
            "survey_name" : self.survey.name,
            "id_string" : self.survey.id_string,
            "name" : "Andrew"
            }
        xml_str = u'<?xml version=\'1.0\' ?><%(survey_name)s id="%(id_string)s"><name>%(name)s</name></%(survey_name)s>' % info
        self.instance = Instance.objects.create(xml=xml_str, user=self.user)
        self.parsed_instance = ParsedInstance.objects.get(
                instance=self.instance)
Esempio n. 14
0
 def setUp(self):
     MainTestCase.setUp(self)
     self.instances = settings.MONGO_DB.instances
     self.instances.remove()
     self.assertEquals(list(self.instances.find()), [])
     xls_path = os.path.join(self.this_directory, 'fixtures',
                             'transportation', 'mongo',
                             'transportation_with_dirty_mongo_ids.xls')
     count = XForm.objects.count()
     response = self._publish_xls_file(xls_path)
     self.assertEqual(XForm.objects.count(), count + 1)
     self.xform = XForm.objects.all().reverse()[0]
     self._make_submission(
         os.path.join(self.this_directory, 'fixtures', 'transportation',
                      'mongo', 'transport_2011-07-25_19-05-36' + '.xml'))
     self.pi = self.xform.surveys.all()[0].parsed_instance
Esempio n. 15
0
    def setUp(self):
        MainTestCase.setUp(self)
        self.survey = create_survey_from_xls(
            "odk_viewer/tests/name_survey.xls")
        json_str = json.dumps(self.survey.to_json_dict())
        self.data_dictionary = DataDictionary.objects.create(
            xml=self.survey.to_xml(), json=json_str, user=self.user)

        info = {
            "survey_name": self.survey.name,
            "id_string": self.survey.id_string,
            "name": "Andrew"
        }
        xml_str = u'<?xml version=\'1.0\' ?><%(survey_name)s id="%(id_string)s"><name>%(name)s</name></%(survey_name)s>' % info
        self.instance = Instance.objects.create(xml=xml_str, user=self.user)
        ParsedInstance.objects.get_or_create(instance=self.instance)
        self.parsed_instance = ParsedInstance.objects.get(
            instance=self.instance)
Esempio n. 16
0
 def setUp(self):
     MainTestCase.setUp(self)
Esempio n. 17
0
 def setUp(self):
     MainTestCase.setUp(self)
     self._create_user_and_login()
     self._publish_transportation_form_and_submit_instance()
Esempio n. 18
0
 def setUp(self):
     MainTestCase.setUp(self)
 def setUp(self):
     MainTestCase.setUp(self)
     self._create_user_and_login()
     self._publish_transportation_form_and_submit_instance()
Esempio n. 20
0
 def setUp(self):
     MainTestCase.setUp(self)
     self._create_user_and_login()
     self._publish_transportation_form()
     self._submit_transport_instance_w_attachment()
     self.url = reverse(attachment_url)
Esempio n. 21
0
 def setUp(self):
     MainTestCase.setUp(self)
     self._publish_xls_file(
         os.path.join(
             settings.PROJECT_ROOT,
             "odk_logger", "fixtures", "test_forms", "tutorial.xls"))
Esempio n. 22
0
 def setUp(self):
     MainTestCase.setUp(self)
     xls_file_path = os.path.join(
         os.path.dirname(os.path.abspath(__file__)),
         "../fixtures/tutorial/tutorial.xls")
     self._publish_xls_file_and_set_xform(xls_file_path)