def test_s3_upload(self): study = Study(object_id='0vsvxgyx5skpI0ndOSAk1Duf', encryption_key='aabbccddefggiijjkklmnoppqqrrsstt', name='TEST_STUDY_FOR_TESTS') study.save() test_data = "THIS IS TEST DATA" s3_upload("test_file_for_tests.txt", test_data, study.object_id) s3_data = s3_retrieve("test_file_for_tests.txt", study.object_id) self.assertEqual(s3_data, test_data)
def create_dummy_study(object_id): s = DStudy( name="Old Unnamed Study %s" % object_id, encryption_key="0"*32, object_id=str(object_id), deleted=True, ) s.save() study_id_dict[object_id] = {"pk": s.id} return s
def test_settings_mongo_integrity(self): study = Study(**self.translated_reference_study) study.save() mongo_reference_settings = self.translated_reference_device_settings mongo_reference_settings['study'] = study django_settings = DeviceSettings(**mongo_reference_settings) x = compare_dictionaries(mongo_reference_settings, django_settings.as_dict(), ignore=['deleted', 'id']) self.assertTrue(x)
def test_participant_mongo_integrity(self): study = Study(**self.translated_reference_study) study.save() reference_participant = self.translated_reference_participant django_participant = Participant(study=study, **reference_participant).as_unpacked_native_python() x = compare_dictionaries(reference_participant, django_participant, ignore=['id', 'deleted']) self.assertTrue(x)
def test_survey_mongo_integrity(self): study = Study(**self.translated_reference_study) study.save() mongo_reference_survey = self.translated_reference_survey mongo_reference_survey['study'] = study django_reference_survey = Survey(study=study, **self.translated_reference_survey) # This comparison requires the as_dict comparison because it has jsonfields x = compare_dictionaries(mongo_reference_survey, django_reference_survey.as_dict(), ignore=['deleted', 'id', 'last_modified']) self.assertTrue(x)