예제 #1
0
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
예제 #2
0
 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)
예제 #3
0
 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_native_python()
     
     x = compare_dictionaries(reference_participant,
                              django_participant,
                              ignore=['id', 'deleted'])
     self.assertTrue(x)
예제 #4
0
 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)