def test_fake(self): """ Verify that fake() redirects the provider to look for fake content. """ # Create unsorted job definitions that define a1, a2, a3 and a4 fake_content = [ PlugIn(self.JOBS_DIR + "/path/to/jobs1.txt", ("id: a2\n" "plugin: shell\n" "command: true\n" "\n" "id: a1\n" "plugin: shell\n" "command: true\n")), PlugIn(self.JOBS_DIR + "/path/to/jobs2.txt", ("id: a3\n" "plugin: shell\n" "command: true\n" "\n" "id: a4\n" "plugin: shell\n" "command: true\n")) ] fake_problems = [IOError("first problem"), OSError("second problem")] with self.provider.fake(fake_content, fake_problems): job_list = self.provider.job_list problem_list = self.provider.problem_list self.assertEqual(len(job_list), 4) self.assertEqual(job_list[0].partial_id, "a1") self.assertEqual(job_list[1].partial_id, "a2") self.assertEqual(job_list[2].partial_id, "a3") self.assertEqual(job_list[3].partial_id, "a4") self.assertEqual(problem_list, fake_problems)
def test_plugin_load_time(self): """ verify that PlugIn.plugin_load_time getter works """ self.assertEqual(PlugIn(self.NAME, self.OBJ).plugin_load_time, 0) self.assertEqual( PlugIn(self.NAME, self.OBJ, self.LOAD_TIME).plugin_load_time, self.LOAD_TIME)
def setUp(self): self.plugin = PlugIn(self.NAME, self.OBJ)
def setUp(self): self.col = DummyPlugInCollection() self.plug1 = PlugIn("name1", "obj1") self.plug2 = PlugIn("name2", "obj2")