def test_placeholdercheck_in_config(self): # this pipeline does not contain the '%s' placeholder and because # of that should not be created coherence = self.CoherenceStump(transcoder=self.failing_config) self.manager = tc.TranscoderManager(coherence) self._check_for_transcoders(known_transcoders) self.assertRaises(KeyError, self.manager.select, 'failing', 'http://another/uri')
def test_is_loading_one_process_from_config(self): coherence = self.CoherenceStump(transcoder=self.process_config) self.manager = tc.TranscoderManager(coherence) self._check_for_transcoders(known_transcoders) transcoder = self.manager.select('megaprocess', 'http://another/uri') self.assertTrue(isinstance(transcoder, tc.ExternalProcessPipeline)) self._check_transcoder_attrs(transcoder, 'uiui%suiui', 'http://another/uri')
def test_is_loading_one_gst_from_config(self): coherence = self.CoherenceStump(transcoder=self.gst_config) self.manager = tc.TranscoderManager(coherence) self._check_for_transcoders(known_transcoders) my_pipe = self.manager.select('supertest', 'http://my_uri') self.assertTrue(isinstance(my_pipe, tc.GStreamerTranscoder)) self._check_transcoder_attrs(my_pipe, pipeline='pp%spppl', uri="http://my_uri")
def test_loaded_gst_always_new_instance(self): coherence = self.CoherenceStump(transcoder=self.gst_config) self.manager = tc.TranscoderManager(coherence) self._check_for_transcoders(known_transcoders) transcoder_a = self.manager.select('supertest', 'http://my_uri') self.assertTrue(isinstance(transcoder_a, tc.GStreamerTranscoder)) self._check_transcoder_attrs(transcoder_a, pipeline='pp%spppl', uri="http://my_uri") transcoder_b = self.manager.select('supertest', 'http://another/uri') self.assertTrue(isinstance(transcoder_b, tc.GStreamerTranscoder)) self._check_transcoder_attrs(transcoder_b, pipeline='pp%spppl', uri="http://another/uri") self.assertNotEquals(transcoder_a, transcoder_b) self.assertNotEquals(id(transcoder_a), id(transcoder_b))
def test_is_loading_multiple_from_config(self): coherence = self.CoherenceStump( transcoder=[self.gst_config, self.process_config]) self.manager = tc.TranscoderManager(coherence) self._check_for_transcoders(known_transcoders) # check the megaprocess transcoder = self.manager.select('megaprocess', 'http://another/uri') self.assertTrue(isinstance(transcoder, tc.ExternalProcessPipeline)) self._check_transcoder_attrs(transcoder, 'uiui%suiui', 'http://another/uri') # check the gstreamer transcoder transcoder = self.manager.select('supertest', 'http://another/uri2') self.assertTrue(isinstance(transcoder, tc.GStreamerTranscoder)) self._check_transcoder_attrs(transcoder, 'pp%spppl', 'http://another/uri2')
def test_is_loading_no_config(self): coherence = self.CoherenceStump() self.manager = tc.TranscoderManager(coherence) self._check_for_transcoders(known_transcoders)
def test_is_loading_all_known_transcoders(self): self.manager = tc.TranscoderManager() self._check_for_transcoders(known_transcoders)
def test_is_really_singleton(self): # FIXME: singleton tests should be outsourced some when old_id = id(self.manager) new_manager = tc.TranscoderManager() self.assertEquals(old_id, id(new_manager))
def setUp(self): self.manager = tc.TranscoderManager()