def test_autoimport_jobs(self): """Test JOB autoimport jobs works.""" user = UserFactory.create(pro=True) AppFactory.create(owner=user) jobs = get_autoimport_jobs() msg = "There should be 0 jobs." assert len(jobs) == 0, msg
def test_autoimport_jobs_without_pro(self): """Test JOB autoimport jobs works without pro users.""" ProjectFactory.create() jobs_generator = get_autoimport_jobs() jobs = [] for job in jobs_generator: jobs.append(job) msg = "There should be 0 jobs." assert len(jobs) == 0, msg
def test_autoimport_jobs(self): """Test JOB autoimport jobs works.""" user = UserFactory.create(pro=True) ProjectFactory.create(owner=user) jobs_generator = get_autoimport_jobs() jobs = [] for job in jobs_generator: jobs.append(job) msg = "There should be 0 jobs." assert len(jobs) == 0, msg
def test_autoimport_jobs_without_pro_when_only_pro(self): """Test JOB autoimport jobs does not return normal user owned projects if autoimporter is only enabled for pros.""" ProjectFactory.create(info=dict(autoimporter='foobar')) jobs_generator = get_autoimport_jobs() jobs = [] for job in jobs_generator: jobs.append(job) msg = "There should be 0 jobs." assert len(jobs) == 0, msg
def test_autoimport_jobs_no_autoimporter(self): """Test JOB autoimport does not return projects without autoimporter.""" user = UserFactory.create(pro=True) ProjectFactory.create(owner=user) jobs_generator = get_autoimport_jobs() jobs = [] for job in jobs_generator: jobs.append(job) msg = "There should be 0 jobs." assert len(jobs) == 0, msg
def test_autoimport_jobs_without_pro_when_only_pro(self): """Test JOB autoimport jobs does not return normal user owned projects if autoimporter is only enabled for pros.""" ProjectFactory.create(info=dict(autoimporter="foobar")) jobs_generator = get_autoimport_jobs() jobs = [] for job in jobs_generator: jobs.append(job) msg = "There should be 0 jobs." assert len(jobs) == 0, msg
def test_autoimport_jobs_with_autoimporter(self): """Test JOB autoimport jobs works with autoimporters.""" user = UserFactory.create(pro=True) app = AppFactory.create(owner=user, info=dict(autoimporter='foobar')) jobs = get_autoimport_jobs() msg = "There should be 1 jobs." assert len(jobs) == 1, msg job = jobs[0] msg = "There sould be the same app." assert job['args'] == [app.id], msg msg = "There sould be the kwargs." assert job['kwargs'] == 'foobar', msg
def test_autoimport_jobs_without_pro_when_for_everyone(self): """Test JOB autoimport jobs returns normal user owned projects if autoimporter is enabled for everyone.""" project = ProjectFactory.create(info=dict(autoimporter='foobar')) jobs_generator = get_autoimport_jobs() jobs = [] for job in jobs_generator: jobs.append(job) msg = "There should be 1 job." assert len(jobs) == 1, msg job = jobs[0] msg = "There sould be the same project." assert job['args'] == [project.id], msg msg = "There sould be the kwargs." assert job['kwargs'] == 'foobar', msg
def test_autoimport_jobs_with_autoimporter(self): """Test JOB autoimport jobs works with autoimporters.""" user = UserFactory.create(pro=True) project = ProjectFactory.create(owner=user,info=dict(autoimporter='foobar')) jobs_generator = get_autoimport_jobs() jobs = [] for job in jobs_generator: jobs.append(job) msg = "There should be 1 jobs." assert len(jobs) == 1, msg job = jobs[0] msg = "There sould be the same project." assert job['args'] == [project.id], msg msg = "There sould be the kwargs." assert job['kwargs'] == 'foobar', msg
def test_autoimport_jobs_without_pro_when_for_everyone(self): """Test JOB autoimport jobs returns normal user owned projects if autoimporter is enabled for everyone.""" project = ProjectFactory.create(info=dict(autoimporter="foobar")) jobs_generator = get_autoimport_jobs() jobs = [] for job in jobs_generator: jobs.append(job) msg = "There should be 1 job." assert len(jobs) == 1, msg job = jobs[0] msg = "There sould be the same project." assert job["args"] == [project.id], msg msg = "There sould be the kwargs." assert job["kwargs"] == "foobar", msg
def test_autoimport_jobs_without_pro(self): """Test JOB autoimport jobs works without pro users.""" AppFactory.create() jobs = get_autoimport_jobs() msg = "There should be 0 jobs." assert len(jobs) == 0, msg