コード例 #1
0
ファイル: tests.py プロジェクト: PabloCastellano/alterchef
    def test_failed_job(self):
        fwjob = FwJob.objects.create(profile=self.profile, user=self.user, job_data=self.job_data)
        FwJob.set_make_commands_func(lambda *x: ["ls /inexistent"])

        FwJob.process_jobs(sync=True)
        self.assertEqual(len(FwJob.failed.all()), 1)
        with self.env:
            fwjob = FwJob.objects.get(pk=fwjob.pk)
            self.assertTrue("No such file or directory" in fwjob.build_log)
コード例 #2
0
    def test_failed_job(self):
        fwjob = FwJob.objects.create(profile=self.profile,
                                     user=self.user,
                                     job_data=self.job_data)
        FwJob.set_make_commands_func(lambda *x: ["ls /inexistent"])

        FwJob.process_jobs(sync=True)
        self.assertEqual(len(FwJob.failed.all()), 1)
        fwjob = FwJob.objects.get(pk=fwjob.pk)
        self.assertTrue("No such file or directory" in fwjob.build_log)
コード例 #3
0
ファイル: tests.py プロジェクト: PabloCastellano/alterchef
    def _test_cook(self):
        response = self.client.get(self.cook_url)
        self.assertEqual(response.status_code, 200)

        response = self.client.post(self.cook_url, {"other_devices": "TLMR3020", "openwrt_revision": "stable"})
        self.assertEqual(response.status_code, 302)

        self.assertEqual(len(FwJob.started.all()), 0)
        self.assertEqual(len(FwJob.waiting.all()), 1)
        FwJob.process_jobs()
        self.assertEqual(len(FwJob.started.all()), 1)
        self.assertEqual(len(FwJob.waiting.all()), 0)
コード例 #4
0
    def _test_cook(self):
        response = self.client.get(self.cook_url)
        self.assertEqual(response.status_code, 200)

        response = self.client.post(self.cook_url, {
            "other_devices": "TLMR3020",
            "openwrt_revision": "stable"
        })
        self.assertEqual(response.status_code, 302)

        self.assertEqual(len(FwJob.started.all()), 0)
        self.assertEqual(len(FwJob.waiting.all()), 1)
        FwJob.process_jobs()
        self.assertEqual(len(FwJob.started.all()), 1)
        self.assertEqual(len(FwJob.waiting.all()), 0)
コード例 #5
0
 def test_make_commands(self):
     commands = FwJob.make_commands("quintanalibre.org.ar", "profile1",
                                    ["TLMR3220", "NONEatherosDefault"],
                                    "33333")
     self.assertTrue("33333 ar71xx quintanalibre.org.ar profile1 TLMR3220"
                     in commands[0])
     self.assertTrue("33333 atheros quintanalibre.org.ar profile1 Default"
                     in commands[1])
コード例 #6
0
ファイル: tests.py プロジェクト: PabloCastellano/alterchef
    def test_process_some_jobs(self):
        FwJob.objects.create(profile=self.profile, user=self.user, job_data=self.job_data)
        FwJob.objects.create(profile=self.profile, user=self.user, job_data=self.job_data)

        FwJob.set_make_commands_func(lambda *x: ["sleep 0.1"])

        self.assertEqual(len(FwJob.started.all()), 0)
        self.assertEqual(len(FwJob.waiting.all()), 2)

        FwJob.process_jobs(sync=True)
        self.assertEqual(len(FwJob.waiting.all()), 1)
        self.assertEqual(len(FwJob.finished.all()), 1)

        FwJob.process_jobs(sync=True)
        self.assertEqual(len(FwJob.finished.all()), 2)
コード例 #7
0
    def test_process_some_jobs(self):
        fwjob = FwJob.objects.create(profile=self.profile,
                                     user=self.user,
                                     job_data=self.job_data)
        fwjob = FwJob.objects.create(profile=self.profile,
                                     user=self.user,
                                     job_data=self.job_data)

        FwJob.set_make_commands_func(lambda *x: ["sleep 0.1"])

        self.assertEqual(len(FwJob.started.all()), 0)
        self.assertEqual(len(FwJob.waiting.all()), 2)

        FwJob.process_jobs(sync=True)
        self.assertEqual(len(FwJob.waiting.all()), 1)
        self.assertEqual(len(FwJob.finished.all()), 1)

        FwJob.process_jobs(sync=True)
        self.assertEqual(len(FwJob.finished.all()), 2)
コード例 #8
0
ファイル: tests.py プロジェクト: PabloCastellano/alterchef
 def test_make_commands(self):
     commands = FwJob.make_commands("quintanalibre.org.ar", "profile1", ["TLMR3220", "NONEatherosDefault"], "33333")
     self.assertTrue("33333 ar71xx quintanalibre.org.ar profile1 TLMR3220" in commands[0])
     self.assertTrue("33333 atheros quintanalibre.org.ar profile1 Default" in commands[1])
コード例 #9
0
ファイル: tests.py プロジェクト: PabloCastellano/alterchef
 def tearDown(self):
     FwJob.set_make_commands_func(FwJob.default_make_commands)
コード例 #10
0
 def tearDown(self):
     FwJob.set_make_commands_func(FwJob.default_make_commands)