Exemple #1
0
 def test_create_dict_jobs(self):
     """Test JOB create_dict_jobs works."""
     data = [{'id': 1, 'short_name': 'app'}]
     jobs_gen = create_dict_jobs(data, 'function')
     jobs = []
     for j in jobs_gen:
         jobs.append(j)
     assert len(jobs) == 1
     assert jobs[0]['name'] == 'function'
Exemple #2
0
 def test_create_dict_jobs(self):
     """Test JOB create_dict_jobs works."""
     data = [{'id': 1, 'short_name': 'app'}]
     jobs_gen = create_dict_jobs(data, 'function')
     jobs = []
     for j in jobs_gen:
         jobs.append(j)
     assert len(jobs) == 1
     assert jobs[0]['name'] == 'function'
Exemple #3
0
 def test_create_dict_jobs(self):
     """Test JOB create_dict_jobs works."""
     data = [{"id": 1, "short_name": "app"}]
     jobs_gen = create_dict_jobs(data, "function")
     jobs = []
     for j in jobs_gen:
         jobs.append(j)
     assert len(jobs) == 1
     assert jobs[0]["name"] == "function"
Exemple #4
0
 def test_create_dict_jobs(self):
     """Test JOB create_dict_jobs works."""
     data = [{'id': 1, 'short_name': 'app'}]
     timeout = self.flask_app.config.get('TIMEOUT')
     jobs_gen = create_dict_jobs(data, 'function', timeout)
     jobs = []
     for j in jobs_gen:
         jobs.append(j)
     assert len(jobs) == 1
     assert jobs[0]['name'] == 'function', jobs[0]
     assert jobs[0]['timeout'] == timeout, jobs[0]
Exemple #5
0
 def test_create_dict_jobs(self):
     """Test JOB create_dict_jobs works."""
     data = [{'id': 1, 'short_name': 'app'}]
     timeout = self.flask_app.config.get('TIMEOUT')
     jobs_gen = create_dict_jobs(data, 'function', timeout)
     jobs = []
     for j in jobs_gen:
         jobs.append(j)
     assert len(jobs) == 1
     assert jobs[0]['name'] == 'function', jobs[0]
     assert jobs[0]['timeout'] == timeout, jobs[0]
Exemple #6
0
    def test_create_dict_job(self):
        """Test JOB create dict job works."""
        user = UserFactory.create(pro=True)
        app = AppFactory.create(owner=user)
        from sqlalchemy.sql import text
        from pybossa.core import db
        sql = text('''SELECT app.id, app.short_name FROM app, "user"
                   WHERE app.owner_id="user".id AND "user".pro=True;''')
        results = db.slave_session.execute(sql)
        jobs = create_dict_jobs(results, get_app_stats, (10 * 60))

        err_msg = "There should be only one job"
        assert len(jobs) == 1, err_msg

        job = jobs[0]
        assert 'get_app_stats' in job['name'].__name__
        assert job['args'] == [app.id, app.short_name]
Exemple #7
0
    def test_create_dict_job(self):
        """Test JOB create dict job works."""
        user = UserFactory.create(pro=True)
        app = AppFactory.create(owner=user)
        from sqlalchemy.sql import text
        from pybossa.core import db
        sql = text('''SELECT app.id, app.short_name FROM app, "user"
                   WHERE app.owner_id="user".id AND "user".pro=True;''')
        results = db.slave_session.execute(sql)
        jobs = create_dict_jobs(results, get_app_stats, (10 * 60))

        err_msg = "There should be only one job"
        assert len(jobs) == 1, err_msg

        job = jobs[0]
        assert 'get_app_stats' in job['name'].__name__
        assert job['args'] == [app.id, app.short_name]
        assert job['interval'] == 10 * 60
    def test_create_dict_job(self):
        """Test JOB create dict job works."""
        user = UserFactory.create(pro=True)
        project = ProjectFactory.create(owner=user)
        from sqlalchemy.sql import text
        from pybossa.core import db
        sql = text('''SELECT project.id, project.short_name FROM project, "user"
                   WHERE project.owner_id="user".id AND "user".pro=True;''')
        results = db.slave_session.execute(sql)
        jobs_generator = create_dict_jobs(results, get_project_stats, (10 * 60))
        jobs = []
        for job in jobs_generator:
            jobs.append(job)

        err_msg = "There should be only one job"
        assert len(jobs) == 1, err_msg

        job = jobs[0]
        assert 'get_project_stats' in job['name'].__name__
        assert job['args'] == [project.id, project.short_name]
Exemple #9
0
    def test_create_dict_job(self):
        """Test JOB create dict job works."""
        user = UserFactory.create(pro=True)
        project = ProjectFactory.create(owner=user)
        from sqlalchemy.sql import text
        from pybossa.core import db
        sql = text('''SELECT project.id, project.short_name FROM project, "user"
                   WHERE project.owner_id="user".id AND "user".pro=True;''')
        results = db.slave_session.execute(sql)
        jobs_generator = create_dict_jobs(results, get_project_stats, (10 * 60))
        jobs = []
        for job in jobs_generator:
            jobs.append(job)

        err_msg = "There should be only one job"
        assert len(jobs) == 1, err_msg

        job = jobs[0]
        assert 'get_project_stats' in job['name'].__name__
        assert job['args'] == [project.id, project.short_name]
Exemple #10
0
 def test_create_dict_jobs(self):
     """Test JOB create_dict_jobs works."""
     data = [{'id': 1, 'short_name': 'app'}]
     jobs = create_dict_jobs(data, 'function')
     assert len(jobs) == 1
     assert jobs[0]['name'] == 'function'