Example #1
0
    def test_file_surelink_public_stream(self):
        """ regression test for PMT #87084 """
        public_file = FileFactory(
            filename=("/media/h264/ccnmtl/public/"
                      "courses/56d27944-4131-11e1-8164-0017f20ea192"
                      "-Mediathread_video_uploaded_by_mlp55.mp4"))
        response = self.c.get("/file/%d/" % public_file.id)
        self.assertEquals(response.status_code, 200)

        response = self.c.get(
            "/file/%d/surelink/" % public_file.id,
            {'file': public_file.filename,
             'captions': '',
             'poster': ('http://wardenclyffe.ccnmtl.columbia.edu/'
                        'uploads/images/11213/00000238.jpg'),
             'width': public_file.guess_width(),
             'height': public_file.guess_height(),
             'protection': 'mp4_public_stream',
             'authtype': '',
             'player': 'v4',
             })
        self.assertEquals(response.status_code, 200)
        assert "<iframe" in response.content
        assert "file=/media/h264/ccnmtl/" not in response.content
        assert "file=/course" in response.content
Example #2
0
import pyglet

from factories import FileFactory, MockupFactory

if __name__ == "__main__":
    # Pyglet stuff
    player = pyglet.media.Player()
    window = pyglet.window.Window()
    label = pyglet.text.Label('Hello, world',
                              font_name='Times New Roman',
                              font_size=36,
                              x=window.width // 2,
                              y=window.height // 2,
                              anchor_x='center',
                              anchor_y='center')

    @window.event
    def on_draw():
        window.clear()
        label.draw()

    # Factories
    mockup_factory = MockupFactory(player)
    file_factory = FileFactory(player)
    # Test the mockup factory
    mockup_factory.play()
    # Test the file factory
    file_factory.play()
Example #3
0
 def test_get_absolute_url(self):
     f = FileFactory()
     self.assertEqual(f.get_absolute_url(), "/file/%d/" % f.id)
Example #4
0
 def test_update_metadata(self):
     f = FileFactory()
     f.set_metadata("foo", "bar")
     f.set_metadata("foo", "baz")
     self.assertEqual(f.get_metadata("foo"), "baz")