Esempio n. 1
0
    def setUp(self):
        utils.http_request = lambda x, y=False: b'xxx'
        self.fd, self.dbfile = tempfile.mkstemp()
        self.cadir = tempfile.mkdtemp()
        preview = os.path.join(self.cadir, 'preview.png')
        open(preview, 'a').close()
        config.config()['agent']['database'] = 'sqlite:///' + self.dbfile
        config.config()['capture']['command'] = 'touch {{dir}}/{{name}}.mp4'
        config.config()['capture']['directory'] = self.cadir
        config.config()['capture']['preview'] = [preview]
        config.config()['service-capture.admin'] = ['']

        # Mock event
        db.init()
        self.event = db.BaseEvent()
        self.event.uid = '123123'
        self.event.title = u'äüÄÜß'
        self.event.start = utils.timestamp()
        self.event.end = self.event.start
        self.event.status = db.Status.UPCOMING
        data = [{'data': u'äüÄÜß',
                 'fmttype': 'application/xml',
                 'x-apple-filename': 'episode.xml'},
                {'data': u'äüÄÜß',
                 'fmttype': 'application/xml',
                 'x-apple-filename': 'series.xml'},
                {'data': u'event.title=äüÄÜß\n' +
                         u'org.opencastproject.workflow.config.x=123\n' +
                         u'org.opencastproject.workflow.definition=fast',
                 'fmttype': 'application/text',
                 'x-apple-filename': 'org.opencastproject.capture.agent' +
                                     '.properties'}]
        self.event.set_data({'attach': data})
Esempio n. 2
0
    def test_event_data(self):
        series = u'äöüßÄÖÜ'
        title = u'„xyz“'

        e = db.BaseEvent()
        e.set_data({'series': series, 'title': title})

        # Check data serialization
        data = e.get_data()
        assert data['title'] == title
        assert data['series'] == series
Esempio n. 3
0
    def test_event_data(self):
        series = u'äöüßÄÖÜ'
        title = u'„xyz“'

        e = db.BaseEvent()
        e.set_data({'series': series, 'title': title})

        # Check data serialization
        data = e.get_data()
        self.assertEqual(data['title'], title)
        self.assertEqual(data['series'], series)
Esempio n. 4
0
    def test_event(self):
        e = db.BaseEvent()
        e.uid = 'asd'
        e.start = 123
        e.end = 234
        e.status = db.Status.UPCOMING

        assert str(e) == '<Event(start=123, uid="asd")>'

        e = db.RecordedEvent(e)
        assert e.name() == 'recording-123-asd'
        assert e.status_str() == 'upcoming'
        assert e.serialize()['uid'] == 'asd'
        assert e.get_tracks() == []
Esempio n. 5
0
    def test_event(self):
        e = db.BaseEvent()
        e.uid = 'asd'
        e.start = 123
        e.end = 234
        e.status = db.Status.UPCOMING
        e.set_data({})

        self.assertEqual(str(e), '<Event(start=123, uid="asd")>')

        e = db.RecordedEvent(e)
        self.assertEqual(e.name(), 'recording-123-asd')
        self.assertEqual(e.status_str(), 'upcoming')
        self.assertEqual(e.serialize()['id'], 'asd')
        self.assertEqual(e.get_tracks(), [])