Esempio n. 1
0
 def test_get_export_task_jobs(self):
     """Test JOB export task jobs works."""
     app = AppFactory.create()
     jobs = get_export_task_jobs()
     msg = "There should be only one job."
     assert len(jobs) == 1, len(jobs)
     job = jobs[0]
     msg = "The job should be for the same app.id"
     assert job['args'] == [app.id], msg
     msg = "The job should be enqueued in low priority."
     assert job['queue'] == 'low', msg
Esempio n. 2
0
 def test_get_export_task_pro_jobs(self):
     """Test JOB export task jobs for pro users works."""
     user = UserFactory.create(pro=True)
     app = AppFactory.create(owner=user)
     jobs = get_export_task_jobs()
     msg = "There should be only one job."
     assert len(jobs) == 1, len(jobs)
     job = jobs[0]
     msg = "The job should be for the same app.id"
     assert job['args'] == [app.id], msg
     msg = "The job should be enqueued in high priority."
     assert job['queue'] == 'high', msg
Esempio n. 3
0
    def test_get_export_task_jobs(self):
        """Test JOB export task jobs works."""
        project = ProjectFactory.create()
        jobs_generator = get_export_task_jobs(queue='low')
        jobs = []
        for job in jobs_generator:
            jobs.append(job)

        msg = "There should be only one job."
        assert len(jobs) == 1, len(jobs)
        job = jobs[0]
        msg = "The job should be for the same project.id"
        assert job['args'] == [project.id], msg
        msg = "The job should be enqueued in low priority."
        assert job['queue'] == 'low', msg
Esempio n. 4
0
    def test_get_export_task_jobs(self):
        """Test JOB export task jobs works."""
        project = ProjectFactory.create()
        jobs_generator = get_export_task_jobs(queue='low')
        jobs = []
        for job in jobs_generator:
            jobs.append(job)

        msg = "There should be only one job."
        assert len(jobs) == 1, len(jobs)
        job = jobs[0]
        msg = "The job should be for the same project.id"
        assert job['args'] == [project.id], msg
        msg = "The job should be enqueued in low priority."
        assert job['queue'] == 'low', msg
Esempio n. 5
0
    def test_get_export_task_pro_jobs(self):
        """Test JOB export task jobs for pro users works."""
        user = UserFactory.create(pro=True)
        project = ProjectFactory.create(owner=user)
        jobs_generator = get_export_task_jobs(queue='high')
        jobs = []
        for job in jobs_generator:
            jobs.append(job)

        msg = "There should be only one job."
        assert len(jobs) == 1, len(jobs)
        job = jobs[0]
        msg = "The job should be for the same project.id"
        assert job['args'] == [project.id], msg
        msg = "The job should be enqueued in high priority."
        assert job['queue'] == 'high', msg
Esempio n. 6
0
    def test_get_export_task_pro_jobs(self):
        """Test JOB export task jobs for pro users works."""
        user = UserFactory.create(pro=True)
        project = ProjectFactory.create(owner=user)
        jobs_generator = get_export_task_jobs(queue='high')
        jobs = []
        for job in jobs_generator:
            jobs.append(job)

        msg = "There should be only one job."
        assert len(jobs) == 1, len(jobs)
        job = jobs[0]
        msg = "The job should be for the same project.id"
        assert job['args'] == [project.id], msg
        msg = "The job should be enqueued in high priority."
        assert job['queue'] == 'high', msg
Esempio n. 7
0
    def test_get_export_task_jobs_pro_disabled_high_queue(self):
        """Test JOB export task jobs returns non pro projects for high queue if
        updated exports is enabled for everyone."""
        user = UserFactory.create()
        project = ProjectFactory.create(owner=user)
        jobs_generator = get_export_task_jobs(queue='high')
        jobs = []
        for job in jobs_generator:
            jobs.append(job)

        msg = "There should be only one job."
        assert len(jobs) == 1, len(jobs)
        job = jobs[0]
        msg = "The job should be for the same project.id"
        assert job['args'] == [project.id], msg
        msg = "The job should be enqueued in high priority."
        assert job['queue'] == 'high', msg
Esempio n. 8
0
    def test_get_export_task_jobs_pro_disabled_high_queue(self):
        """Test JOB export task jobs returns non pro projects for high queue if
        updated exports is enabled for everyone."""
        user = UserFactory.create()
        project = ProjectFactory.create(owner=user)
        jobs_generator = get_export_task_jobs(queue='high')
        jobs = []
        for job in jobs_generator:
            jobs.append(job)

        msg = "There should be only one job."
        assert len(jobs) == 1, len(jobs)
        job = jobs[0]
        msg = "The job should be for the same project.id"
        assert job['args'] == [project.id], msg
        msg = "The job should be enqueued in high priority."
        assert job['queue'] == 'high', msg