def setUp(self):
     super(PasswordChangeFormTests, self).setUp()
     username = "******"
     password = "******"
     email = "*****@*****.**"
     self.user1 = UserFactory.create(username=username+"1", password=password+"1", email=email+"1")
     self.user2 = UserFactory.create(username=username+"2", password=password+"2", email=email+"2")
 def test_cannot_create_duplicate_email(self):
     # setup initial data or something
     # execute the behaviour you want to test
     # verify the output of the behaviour (sometimes mocks/stubs as well)
     
     """
     If I have a user with email "*****@*****.**"
     And I try to create a new user with the create user form with email "*****@*****.**"
     Then the form should be invalid
     """
     
     test_email = '*****@*****.**'
     UserFactory.create(email=test_email)
     
     from tao.models import TaoUser
     self.assertEqual(1, TaoUser.objects.count())
     user_form = UserCreationForm({'title': 'a',
         'first_name': 'b', 
         'last_name': 'c', 
         'institution': 'd', 
         'email': test_email, 
         'recaptcha_response_field': 'PASSED',
         'username': '******',
         'password1': 'funnyfish',
         'password2': 'funnyfish'}, user=AnonymousUser())
     self.assertFalse(user_form.is_valid())
     self.assertEqual(['That email is already taken.'], user_form.errors['email'])
 def setUp(self):
     super(UserRegisterTest, self).setUp()
     self.admin_emails = []
     for unused in range(10):
         u = UserFactory.create(is_staff=True)
         self.admin_emails.append(u.email)
     UserFactory.create(username="******", email="*****@*****.**")
     GlobalParameterFactory(parameter_name="registration.html", parameter_value="{{ pending_requests_url }}")
     GlobalParameterFactory(parameter_name="registration.txt", parameter_value="{{ pending_requests_url }}")
     mail.outbox = []
    def setUp(self):
        super(DiskStorageTests, self).setUp()

        username = '******'
        password = '******'

        self.user = UserFactory.create(username=username, is_superuser=True)
        self.user.set_password(password)
        self.user.save()
        self.login(username, password)

        output_path = 'job_output'
        self.job = JobFactory.create(user=self.user, status=Job.COMPLETED, output_path=output_path)
        file_content = 'abc' * 2000000
        file_name_to_content = {'file_name': file_content}
        helper.create_file(os.path.join(settings.FILES_BASE, output_path), 'file_name', file_name_to_content)
        self.job.save()

        self.simulation = SimulationFactory.create()
        self.galaxy = GalaxyModelFactory.create()
        self.dataset = DataSetFactory.create(simulation=self.simulation, galaxy_model=self.galaxy)
        self.output_prop = DataSetPropertyFactory.create(dataset=self.dataset, name='Central op', is_filter=False)
        self.filter = DataSetPropertyFactory.create(name='CentralMvir rf', units="Msun/h", dataset=self.dataset)
        self.computed_filter = DataSetPropertyFactory.create(name='Computed Property', dataset=self.dataset, is_computed=True)
        self.snapshot = SnapshotFactory.create(dataset=self.dataset, redshift='0.33')
        self.survey_preset = SurveyPresetFactory.create(name='Preset 1', parameters='<xml></xml>')

        self.default_disk_quota = GlobalParameterFactory.create(parameter_name='default_disk_quota', parameter_value='6')
    def setUp(self):
        super(SubmitLightConeTests, self).setUp()

        GlobalParameterFactory.create(parameter_name='maximum-random-light-cones', parameter_value='10')
        GlobalParameterFactory(parameter_name='INITIAL_JOB_STATUS', parameter_value='HELD')
        GlobalParameterFactory(parameter_name='job_too_large_warning', parameter_value='JOB_WARNING')
        simulation = SimulationFactory.create(box_size=500)
        galaxy_model = GalaxyModelFactory.create()
        dataset = DataSetFactory.create(simulation=simulation, galaxy_model=galaxy_model, max_job_box_count=15)

        self.redshifts = ['1.23456789', '2.987654321', '3.69154927', '4.567890123']
        for redshift in self.redshifts:
            SnapshotFactory.create(dataset=dataset, redshift=redshift)

        DataSetPropertyFactory.create(dataset=dataset)
        StellarModelFactory.create()
        BandPassFilterFactory.create()
        self.survey_preset = SurveyPresetFactory.create(name='Preset 1', parameters='<xml></xml>')

        self.username = "******"
        password = "******"
        self.user = UserFactory.create(username=self.username, password=password)

        
        self.parameters = """<lightcone>
                        <database_type>sqlite</database_type>
                        <database_name>random.db</database_name>
                        <catalogue_geometry>cone</catalogue_geometry>
                        </lightcone>
                    """
        
        self.login(self.username, password)
        self.visit('mock_galaxy_factory')
        self.click('tao-tabs-' + 'light_cone')
    def setUp(self):
        super(ListJobsTests, self).setUp()

        username = "******"
        password = "******"
        self.user = UserFactory.create(username=username, password=password)
        self.user.save()
        self.login(username, password)

        parameters = """<lightcone>
                        <database_type>sqlite</database_type>
                        <database_name>random.db</database_name>
                        <catalogue_geometry>cone</catalogue_geometry>
                        </lightcone>
                    """
        error_message = ['blah blah', 'wah wah', 'lah lah']

        self.held_job = JobFactory.create(user=self.user, parameters=parameters, status=Job.HELD)
        self.error_job = JobFactory.create(user=self.user, parameters=parameters, status=Job.ERROR, error_message=error_message[0])
        self.in_progress_job = JobFactory.create(user=self.user, parameters=parameters, status=Job.IN_PROGRESS)
        self.submitted_job = JobFactory.create(user=self.user, parameters=parameters, status=Job.SUBMITTED)
        self.completed_job = JobFactory.create(user=self.user, parameters=parameters, status=Job.COMPLETED)
        self.queued_job = JobFactory.create(user=self.user, parameters=parameters, status=Job.QUEUED)
        self.error_job2 = JobFactory.create(user=self.user, parameters=parameters, status=Job.ERROR, error_message=error_message[1])

        self.visit('job_index')
Пример #7
0
    def setUp(self):
        super(FilterTests, self).setUp()

        simulation1 = SimulationFactory.create()
        simulation2 = SimulationFactory.create()
        self.redshifts = ['1.123456789', '2.123456789', '3.123456789']

        for unused in range(4):
            galaxy_model = GalaxyModelFactory.create()
            dataset = DataSetFactory.create(simulation=simulation1, galaxy_model=galaxy_model, max_job_box_count=2)
            DataSetPropertyFactory.create(dataset=dataset)
            for redshift in self.redshifts:
                SnapshotFactory.create(dataset=dataset, redshift=redshift)

        for unused in range(5):
            galaxy_model = GalaxyModelFactory.create()
            dataset = DataSetFactory.create(simulation=simulation2, galaxy_model=galaxy_model)
            DataSetPropertyFactory.create(dataset=dataset)
            dsp = DataSetPropertyFactory.create(dataset=dataset, is_filter=False)
            dataset.default_filter_field = dsp
            dataset.save()
            for redshift in self.redshifts:
                SnapshotFactory.create(dataset=dataset, redshift=redshift)

        self.bp_filters = []
        for unused in range(3):
            self.bp_filters.append(BandPassFilterFactory.create())

        StellarModelFactory.create()

        username = "******"
        password = "******"
        UserFactory.create(username=username, password=password)
        self.login(username, password)

        self.visit('mock_galaxy_factory')
        self.click('tao-tabs-' + 'light_cone')
        self.select(self.lc_id('catalogue_geometry'), 'Light-Cone')
        self.select_dark_matter_simulation(simulation1)
        self.select_galaxy_model(simulation1.galaxymodel_set.all().order_by('id')[0])

        initial_simulation = Simulation.objects.all().order_by('id')[0]
        initial_galaxy_model = initial_simulation.galaxymodel_set.all().order_by('id')[0]
        self.initial_dataset = DataSet.objects.get(simulation=initial_simulation, galaxy_model=initial_galaxy_model)

        GlobalParameterFactory(parameter_name='INITIAL_JOB_STATUS', parameter_value='HELD')
Пример #8
0
    def setUp(self):
        super(JobTest, self).setUp()
        
        self.username = '******'
        self.password = '******'

        self.user = UserFactory.create(username=self.username, is_superuser=True)
        self.user.set_password(self.password)
        self.user.save()

        # self.job_description = 'This is a job description'
        self.job = JobFactory.create(user=self.user)
        GlobalParameterFactory.create(parameter_name='maximum-random-light-cones', parameter_value='10000')

        self.simulation = SimulationFactory.create()
        self.galaxy = GalaxyModelFactory.create()
        self.dataset = DataSetFactory.create(simulation=self.simulation, galaxy_model=self.galaxy)
        self.output_prop = DataSetPropertyFactory.create(dataset=self.dataset, name='Central op', is_filter=False)
        self.filter = DataSetPropertyFactory.create(name='CentralMvir rf', units="Msun/h", dataset=self.dataset)
        self.computed_filter = DataSetPropertyFactory.create(name='Computed Property', dataset=self.dataset, is_computed=True)
        self.sed = StellarModelFactory.create()
        self.dust = DustModelFactory.create()
        self.snapshot = SnapshotFactory.create(dataset=self.dataset, redshift='0.33')
        self.band_pass_filters = [BandPassFilterFactory.create(), BandPassFilterFactory.create()]

        self.output_paths = ['job1', 'large_job']
        self.dir_paths = [os.path.join(settings.FILES_BASE, output_path) for output_path in self.output_paths]
        txt_template = loader.get_template('jobs/light_cone_job-summary.txt')
        summary_context = Context(self.make_parameters())
        self.summary_text = txt_template.render(summary_context)
        self.file_names_to_contents = {
                                       'file1': 'abc\n',
                                       'filez2.txt': 'pqr\n',
                                       'file3': 'xyz\n',
                                       'job2/fileA.html': 'aaaahhhh & aaaaa',
                                       'job2/fileB': 'baaaaaa',
                                       'summary.txt': self.summary_text,
                                       }
        self.file_names_to_contents2 = {
                                       'waybigfile1': 'xnfaihnehrawlrwerajelrjxmjaeimrjwmrejlxaljrxm;kjmrlakjemrajlejrljrljaereirje;rjmriarie;rirjijeaim;jea;ljmxirjwra;ojer',
                                       'waybigfile2': 'xnfaihnehrawlrwerajelrjxmjaeimrjwmrejlxaljrxm;kjmrlakjemrajlejrljrljaereirje;rjmriarie;rirjijeaim;jea;ljmxirjwra;ojer',
                                       'waybigfile3': 'xnfaihnehrawlrwerajelrjxmjaeimrjwmrejlxaljrxm;kjmrlakjemrajlejrljrljaereirje;rjmriarie;rirjijeaim;jea;ljmxirjwra;ojer',
                                       'waybigfile4': 'xnfaihnehrawlrwerajelrjxmjaeimrjwmrejlxaljrxm;kjmrlakjemrajlejrljrljaereirje;rjmriarie;rirjijeaim;jea;ljmxirjwra;ojer',
                                       'waybigfile5': 'xnfaihnehrawlrwerajelrjxmjaeimrjwmrejlxaljrxm;kjmrlakjemrajlejrljrljaereirje;rjmriarie;rirjijeaim;jea;ljmxirjwra;ojer',
                                       }
        for file_name in self.file_names_to_contents.keys():
            helper.create_file(self.dir_paths[0], file_name, self.file_names_to_contents)
        for file_name in self.file_names_to_contents2.keys():
            helper.create_file(self.dir_paths[1], file_name, self.file_names_to_contents2)
        parameters = self.make_xml_parameters()
        self.job.parameters = parameters
        self.job.save()
        self.completed_job = JobFactory.create(user=self.user, status=Job.COMPLETED, output_path=self.output_paths[0], parameters=parameters)
        self.held_job = JobFactory.create(user=self.user, parameters=parameters, status=Job.HELD)
        self.error_job = JobFactory.create(user=self.user, parameters=parameters, status=Job.ERROR, error_message="error")
        self.in_progress_job = JobFactory.create(user=self.user, parameters=parameters, status=Job.IN_PROGRESS)
        self.submitted_job = JobFactory.create(user=self.user, parameters=parameters, status=Job.SUBMITTED)
        self.queued_job = JobFactory.create(user=self.user, parameters=parameters, status=Job.QUEUED)
 def setUp(self):
     super(PasswordResetTests, self).setUp()
     self.username = "******"
     self.first_name = "Bob"
     self.userpass = "******"
     self.email = "*****@*****.**"
     self.user = UserFactory.create(username=self.username, first_name=self.first_name, email=self.email)
     self.user.set_password(self.userpass)
     self.user.save()
Пример #10
0
 def setUp(self):
     super(SupportTests, self).setUp()
     self.username = '******'
     self.userpass = '******'
     self.user = UserFactory.create(username=self.username, email="*****@*****.**")
     self.user.set_password(self.userpass)
     self.user.save()
     GlobalParameterFactory(parameter_name='support-template.html', parameter_value='{{ user.email }} {{ message }}')
     GlobalParameterFactory(parameter_name='support-template.txt', parameter_value='{{ user.email }} {{ message }}')
     GlobalParameterFactory(parameter_name='support-recipients', parameter_value='[email protected], [email protected]')
     mail.outbox = []
    def setUp(self):
        super(MockImageTests, self).setUp()

        GlobalParameterFactory.create(parameter_name='maximum-random-light-cones', parameter_value='10')
        GlobalParameterFactory(parameter_name='INITIAL_JOB_STATUS', parameter_value='HELD')
        GlobalParameterFactory(parameter_name='job_too_large_warning', parameter_value='JOB_WARNING')
        simulation = SimulationFactory.create(box_size=500)
        galaxy_model = GalaxyModelFactory.create()
        dataset = DataSetFactory.create(simulation=simulation, galaxy_model=galaxy_model, max_job_box_count=15)
        DustModelFactory.create()

        self.redshifts = ['1.23456789', '2.987654321', '3.69154927', '4.567890123']
        for redshift in self.redshifts:
            SnapshotFactory.create(dataset=dataset, redshift=redshift)

        DataSetPropertyFactory.create(dataset=dataset)
        StellarModelFactory.create()
        BandPassFilterFactory.create()
        self.survey_preset = SurveyPresetFactory.create(name='Preset 1', parameters='<xml></xml>')

        self.username = "******"
        password = "******"
        self.user = UserFactory.create(username=self.username, password=password, is_staff=True, is_superuser=True)

        
        self.parameters = """<lightcone>
                        <database_type>sqlite</database_type>
                        <database_name>random.db</database_name>
                        <catalogue_geometry>cone</catalogue_geometry>
                        </lightcone>
                    """
        
        self.login(self.username, password)
        self.visit('mock_galaxy_factory')
        self.click('tao-tabs-' + 'light_cone')
        ## fill in ligght-cone and sed (correctly)
        self.select(self.lc_id('catalogue_geometry'), 'Light-Cone')
        self.fill_in_fields({
            'ra_opening_angle': '2',
            'dec_opening_angle': '2',
            'redshift_min': '1',
            'redshift_max': '2',
        }, id_wrap=self.lc_id)
        self.click(self.lc_2select('op_add_all'))
        self.click('tao-tabs-sed')
        self.click(self.sed('apply_sed'))
        self.click(self.sed_2select('op_add_all'))
        self.click('tao-tabs-record_filter')
        self.fill_in_fields({
            'min': '1\n',
            'max': '10\n',
        }, id_wrap=self.rf_id)
        self.click('tao-tabs-mock_image')
Пример #12
0
    def setUp(self):
        super(JobApiTest, self).setUp()

        self.client = Client()
        self.client.defaults = {'REMOTE_ADDR': '123.2.3.4'}

        user = UserFactory.create()
        self.job = JobFactory.create(user=user, status='HELD')

        self.url_all_job = reverse('api_dispatch_list', kwargs={'resource_name': 'job', 'api_name': 'v1'})
        self.url_by_job_id = reverse('api_dispatch_detail', kwargs={'resource_name': 'job', 'api_name': 'v1', 'pk': self.job.id})
        self.url_by_status = self.url_all_job + '?status=HELD'
        self.data = {'format': 'json'}
Пример #13
0
    def setUp(self):
        super(WorkflowTests, self).setUp()

        OUTPUT_FORMATS = [
            {'value':'csv', 'text':'CSV (Text2)', 'extension':'csv'},
            {'value':'hdf5', 'text':'HDF5', 'extension':'hdf5'},
            {'value': 'fits', 'text': 'FITS', 'extension': 'fits'},
            {'value': 'votable', 'text': 'VOTable', 'extension': 'xml'}
        ]
        self.output_formats = GlobalParameterFactory.create(parameter_name='output_formats', parameter_value=OUTPUT_FORMATS)
        # "2012-12-13T13:55:36+10:00"
        time.frozen_time = datetime.datetime(2012, 12, 20, 13, 55, 36, 0, UtcPlusTen())
        self.user = UserFactory.create()

        self.common_parameters = [
            {'attrs': {'name': 'database-type'}, 'value': 'postgresql'},
            {'attrs': {'name': 'database-host'}, 'value': 'tao02.hpc.swin.edu.au'},
            {'attrs': {'name': 'database-name'}, 'value': 'millennium_full'},
            {'attrs': {'name': 'database-port'}, 'value': '3306'},
            {'attrs': {'name': 'database-user'}, 'value': ''},
            {'attrs': {'name': 'database-pass'}, 'value': ''},
            {
                'attrs': {
                    'name': 'schema-version'
                },
                'value': '2.0',
            },
        ]
        self.simulation = SimulationFactory.create(box_size=500)
        self.galaxy_model = GalaxyModelFactory.create()
        self.dataset = DataSetFactory.create(simulation=self.simulation, galaxy_model=self.galaxy_model)
        self.filter = DataSetPropertyFactory.create(name='CentralMvir rf', units="Msun/h", dataset=self.dataset)
        self.computed_filter = DataSetPropertyFactory.create(name='Computed Filter', dataset=self.dataset, is_computed = True)
        self.output_prop = DataSetPropertyFactory.create(name='Central op', dataset=self.dataset, is_filter=False)
        self.snapshot = SnapshotFactory.create(dataset=self.dataset, redshift="0.1234567891")
        self.stellar_model = StellarModelFactory.create(name='Stella')
        self.band_pass_filter = BandPassFilterFactory.create(label='bandpass')
        self.dust_model = DustModelFactory.create()
        self.sed_parameters = {'apply_sed': True, 'single_stellar_population_model': self.stellar_model.id,
                               'band_pass_filters': [str(self.band_pass_filter.id) + '_apparent'], 'apply_dust': True,
                               'select_dust_model': self.dust_model.id}
        self.sed_disabled = {'apply_sed': False}
        self.sed_parameters_no_dust = {'apply_sed': True, 'single_stellar_population_model': self.stellar_model.id,
                                       'band_pass_filters': [str(self.band_pass_filter.id) + '_absolute']}


        # from code import interact
        # interact(local=locals())

        self.output_format = OUTPUT_FORMATS[0]['value']
        self.output_format_parameters = {'supported_formats': self.output_format}
    def setUp(self):
        super(WorkflowApiTest, self).setUp()

        self.client = Client()
        self.client.defaults = {'REMOTE_ADDR': '123.2.3.4'}

        user = UserFactory.create()
        self.job = JobFactory.create(user=user)
        self.wfcommand = WorkflowCommandFactory.create(job_id=self.job, submitted_by=user, execution_status='QUEUED')

        self.url_all_wfcommand = reverse('api_dispatch_list', kwargs={'resource_name': 'workflowcommand', 'api_name': 'v1'})
        # print self.url_all_wfcommand
        self.url_by_wf_id = reverse('api_dispatch_detail', kwargs={'resource_name': 'workflowcommand', 'api_name': 'v1', 'pk': self.wfcommand.id})
        # self.url_by_job_id = reverse('api_dipatch_detail', kwargs={'resource_name': 'workflowcommand', 'api_name': 'v1'}, job_id = job.id)
        # print self.url_by_job_id
        self.data = {'format': 'json'}
    def setUp(self):
        super(JobTypeFormTests, self).setUp()

        GlobalParameterFactory.create(parameter_name='maximum-random-light-cones', parameter_value='10')
        box_sim = SimulationFactory.create(box_size=500, name='simulation_000')
        lc_sim = SimulationFactory.create(box_size=60,name='simulation_001')

        self.params_path = os.path.join(PROJECT_DIR, 'test_data', 'params.xml')
        params_string = open(self.params_path).read()

        for i in range(3):
            g = GalaxyModelFactory.create(name='galaxy_model_%03d' % i)
            ds = DataSetFactory.create(simulation=box_sim, galaxy_model=g, max_job_box_count=25)
            for j in range(10):
                SnapshotFactory.create(dataset=ds, redshift=str(j)+".0")
            for j in range(3):
                dsp = DataSetPropertyFactory.create(dataset=ds, label='parameter_%03d label' % j, name='name_%03d' % j, description='description_%03d' % j)
                ds.default_filter_field = dsp
                ds.save()


        for i in range(4,8):
            g = GalaxyModelFactory.create(name='galaxy_model_%03d' % i)
            ds = DataSetFactory.create(simulation=lc_sim, galaxy_model=g, max_job_box_count=25, id=i)
            for j in range(10):
                SnapshotFactory.create(dataset=ds, redshift=str(j)+".0")
            for j in range(4,7):
                dsp = DataSetPropertyFactory.create(dataset=ds, label='parameter_%03d label' % j, name='name_%03d' % j, description='description_%03d' % j)
                ds.default_filter_field = dsp
                ds.save()


        for i in range(3):
            StellarModelFactory.create(label='stellar_label_%03d' % i,
                                       name='model{0}/sspm.dat'.format(i),
                                       description='<p>Description %d </p>' % i)
            BandPassFilterFactory.create(label='Band pass filter %03d' % i, filter_id='%d' % i)
            DustModelFactory.create(name='Dust_model_%03d.dat' % i, label='Dust model %03d' % i, details='<p>Detail %d </p>' % i)
            SurveyPresetFactory.create(name='Preset %d' % i, parameters=params_string)

        username = "******"
        password = "******"
        self.user = UserFactory.create(username=username, password=password, is_staff=True, is_active=True, is_superuser=True)
        self.login(username, password)

        self.visit('mock_galaxy_factory')
        self.click('tao-tabs-job_type')
    def setUp(self):
        super(MockGalaxyFactoryTests, self).setUp()

        OUTPUT_FORMATS = [
            {'value':'csv', 'text':'CSV (Text2)', 'extension':'csv'},
            {'value':'hdf5', 'text':'HDF5', 'extension':'hdf5'},
            {'value': 'fits', 'text': 'FITS', 'extension': 'fits'},
            {'value': 'votable', 'text': 'VOTable', 'extension': 'xml'}
        ]
        self.output_formats = GlobalParameterFactory.create(parameter_name='output_formats', parameter_value=OUTPUT_FORMATS)

        self.simulation = SimulationFactory.create()
        galaxy_model = GalaxyModelFactory.create()
        self.dataset = DataSetFactory.create(simulation=self.simulation, galaxy_model=galaxy_model, max_job_box_count=11)
        self.filter = DataSetPropertyFactory.create(dataset=self.dataset)
        self.filter_long = DataSetPropertyFactory.create(dataset=self.dataset, data_type=DataSetProperty.TYPE_LONG_LONG)
        self.filter_float = DataSetPropertyFactory.create(dataset=self.dataset, data_type=DataSetProperty.TYPE_FLOAT)
        self.computed_filter = DataSetPropertyFactory.create(dataset=self.dataset, is_computed=True)
        self.dataset.default_filter_field = self.filter
        self.dataset.save()
        SnapshotFactory.create(dataset=self.dataset)
        self.survey_preset = SurveyPresetFactory.create(name='Preset 1', parameters='<xml></xml>')

        self.stellar_model = StellarModelFactory.create()
        self.bandpass = BandPassFilterFactory.create()


        self.user = UserFactory.create()
        #expected_timestamp = "2012-11-13 13:45:32+1000"
        time.frozen_time = datetime.datetime(2012, 11, 13, 13, 45, 32, 0, UtcPlusTen())
        self.output_format = OUTPUT_FORMATS[0]['value']
        self.default_form_values = {}
        self.default_form_values['light_cone'] = {
            'catalogue_geometry': LightConeForm.CONE,
            'dark_matter_simulation': 1,
            'galaxy_model': self.dataset.id,
            'output_properties': [str(self.filter.id)],
            'ra_opening_angle': '2',
            'dec_opening_angle': '2',
            'redshift_min': '1',
            'redshift_max': '2',
            'number_of_light_cones': '1',
            }
        self.default_form_values['sed'] = {
            'apply_sed': False,
        }
        self.default_form_values['record_filter'] = {'filter' : 'X-'+NO_FILTER}
Пример #17
0
    def test_other_user_cannot_view_or_download(self):
        username = '******'
        password = '******'

        user2 = UserFactory.create(username=username)
        user2.set_password(password)
        user2.save()
                
        completed_job = JobFactory.create(user=self.user, status=Job.COMPLETED, output_path=self.output_paths[0])
        
        helper.create_file(self.dir_paths[0], 'file1', self.file_names_to_contents)
        
        self.login(username, password)
        self.visit('view_job', completed_job.id)
        self.assert_page_has_content('Forbidden')
        
        self.visit('get_file', completed_job.id, 'file1')
        self.assert_page_has_content('Forbidden')
        
        download_path = os.path.join(self.DOWNLOAD_DIRECTORY, 'file1')
        self.assertFalse(os.path.exists(download_path))
Пример #18
0
    def setUp(self):
        super(TAPServicesTests, self).setUp()
        
        self.username = '******'
        self.password = '******'
        
        self.query = {'QUERY':'select property_name from dataset_name where property_name > 0 and property_name < 10 limit 0,100',
                      'REQUEST': 'doQuery'}

        self.user = UserFactory.create(username=self.username)
        self.user.set_password(self.password)
        self.user.save()
        
        self.dataset = {'name': u'dataset_name', 'label': u'dataset_label'}
        self.property = {'name': u'property_name', 'label': u'property_label', 'units': u'property_units'}
        sim = SimulationFactory.create()
        gal = GalaxyModelFactory.create(id=1, name='gm')
        dat = DataSetFactory.create(simulation=sim, galaxy_model=gal, database=self.dataset['name'])
        DataSetPropertyFactory.create(dataset=dat, name=self.property['name'], label=self.property['label'], units=self.property['units'])
        
        self.client = Client()
Пример #19
0
    def setUp(self):
        super(DatasetTests, self).setUp()

        s1 = SimulationFactory.create()
        s2 = SimulationFactory.create()
        s3 = SimulationFactory.create()

        gm1 = GalaxyModelFactory.create()
        gm2 = GalaxyModelFactory.create()

        ds1 = DataSetFactory.create(simulation=s1, galaxy_model=gm1, max_job_box_count=25)
        ds2 = DataSetFactory.create(simulation=s2, galaxy_model=gm2, max_job_box_count=25)
        ds3 = DataSetFactory.create(simulation=s3, galaxy_model=gm2, max_job_box_count=25)
        self.default_dataset = ds2

        DataSetPropertyFactory.create(dataset=ds1, name="dataset property 1")
        DataSetPropertyFactory.create(dataset=ds2, name="dataset property 2")
        self.default_dataset.default_filter_field = DataSetPropertyFactory.create(
            dataset=ds3, name="dataset property 3"
        )
        self.default_dataset.save()
        SnapshotFactory.create(dataset=self.default_dataset, redshift="0.33")
        self.survey_preset = SurveyPresetFactory.create(name="Preset 1", parameters="<xml></xml>")

        for i in range(3):
            StellarModelFactory.create(
                label="stellar_label_%03d" % i, name="stellar_name_%03d" % i, description="<p>Description %d </p>" % i
            )
            BandPassFilterFactory.create(label="Band pass filter %03d" % i, filter_id="%d" % i)
            DustModelFactory.create(
                name="Dust_model_%03d.dat" % i, label="Dust model %03d" % i, details="<p>Detail %d </p>" % i
            )
            SnapshotFactory.create(dataset_id=i)

        password = "******"
        user = UserFactory.create(username="******", is_superuser=True)
        user.set_password(password)
        user.save()
        self.login(user.username, password)
    def setUp(self):
        super(MockGalaxyFactoryTest, self).setUp()

        GlobalParameterFactory.create(parameter_name='maximum-random-light-cones', parameter_value='10')
        simulation = SimulationFactory.create(box_size=500)
        simulation2 = SimulationFactory.create()

        for unused in range(3):
            g = GalaxyModelFactory.create()
            ds = DataSetFactory.create(simulation=simulation, galaxy_model=g)
            for unused in range(5):
                DataSetPropertyFactory.create(dataset=ds)
            SnapshotFactory.create(dataset=ds)

        for unused in range(4):
            g = GalaxyModelFactory.create()
            ds = DataSetFactory.create(simulation=simulation2, galaxy_model=g)
            dsp = DataSetPropertyFactory.create(dataset=ds)
            ds.default_filter_field = dsp
            ds.save()

        for i in range(3):
            StellarModelFactory.create()
            BandPassFilterFactory.create(description='<p>BPF Description %s</p>' % i)
            DustModelFactory.create()

        self.survey_preset = SurveyPresetFactory.create(name='Preset 1', parameters='<xml></xml>')
        
        username = "******"
        password = "******"
        self.user = UserFactory.create(username=username, password=password)
        self.login(username, password)

        self.visit('mock_galaxy_factory')
        self.click('tao-tabs-' + 'light_cone')
        self.select(self.lc_id('catalogue_geometry'), 'Light-Cone')
 def setUp(self):
     super(WorkflowCommandsTests, self).setUp()
     user = UserFactory.create()
     job = JobFactory.create(user=user)
     self.jobID = job.id
     self.wfcommand = WorkflowCommandFactory.create(submitted_by=user, job_id=job, execution_comment='')