Exemplo n.º 1
0
    def setUp(self):

        # Make some mock subjects.
        subjects_utils.subject_enroll(testing.mock_subjects)

        # Make a mock git project.
        self.mock_repository_setup_dir\
            = testing_utils.make_mock_repository_files()

        self.mock_repository\
             = testing_utils.MockExperimentRepository(
                 setup_dir = self.mock_repository_setup_dir)

        self.mock_repository.initialize()
        self.number_of_revisions = 10
        self.mock_repository.update(revisions=self.number_of_revisions)

        # Make a repository, archives, etc for the experiments.
        setup_fields = dict(name = 'mock',
                      description = 'A mock repository',
                      date_created = datetime.datetime.now(),
                      is_active = True,
                      path = self.mock_repository.path)

        self.experiment_repository = archives_models.ExperimentRepository\
            .objects.create(**setup_fields)
        self.experiment_repository.make_archives()

        # Set current version to default.
        archives_models.Experiment.objects.set_default_current_version()
Exemplo n.º 2
0
 def handle(self, *args, **options):
     try:
         for arg in args:
             subjects_bulk_enroll_file = configobj.ConfigObj(arg)
             utils.subject_enroll(subjects_bulk_enroll_file)
     except:
         CommandError('Enroll did not work.')
Exemplo n.º 3
0
    def setUp(self):
        '''
        We will use the testing GenericSetup to create the mock
        ExperimentRepository, Experiment and ExperimentVersion models.

        In addition, we will create mock subjects, and then create a mock
        experiment session for an arbitrarily chosen mock subject and mock
        experiment. Finally, we create a live experiment session for this
        experiment session.

        '''

        self.generic_setup = testing_utils.GenericSetup()

        for attr in ('mock_repository', 'mock_repository_setup_dir'):
            setattr(self, attr, getattr(self.generic_setup, attr))

        subjects_utils.subject_enroll(testing.mock_subjects)

        # FIXME. How about randomly choosing a subject and experiment.
        self.subject_name = choice(testing.mock_subjects.keys())
        self.subject = subjects_models.Subject.objects.get(
            user__username = self.subject_name)

        self.experiment_name = 'Rusty'
        self.experiment = archives_models.Experiment.objects.get(
            class_name = self.experiment_name
        )

        experiment_session\
            = session_models.ExperimentSession.new(self.subject, 
                                                   self.experiment_name)

        self.experiment_session_uid = experiment_session.uid

        live_session = presenter_models.LiveExperimentSession.new(
                experiment_session)
        self.live_session_uid = live_session.uid
Exemplo n.º 4
0
def enroll_mock_subjects():
    return subject_enroll(mock_subjects)