Home | Trees | Indices | Help |
---|
|
1 # -*- coding: utf-8 -*- 2 # Elisa - Home multimedia server 3 # Copyright (C) 2006-2008 Fluendo Embedded S.L. (www.fluendo.com). 4 # All rights reserved. 5 # 6 # This file is available under one of two license agreements. 7 # 8 # This file is licensed under the GPL version 3. 9 # See "LICENSE.GPL" in the root of this distribution including a special 10 # exception to use Elisa with Fluendo's plugins. 11 # 12 # The GPL part of Elisa is also available under a commercial licensing 13 # agreement from Fluendo. 14 # See "LICENSE.Elisa" in the root directory of this distribution package 15 # for details on that license. 16 17 from twisted.trial import unittest 18 19 from elisa.core.tests.component_test_case import ComponentTestCase 20 from elisa.core.media_uri import MediaUri 21 22 from elisa.base_components.media_provider import MediaProvider, media_types 2325 26 component_class = MediaProvider 27 3182 83 # start from the first and continue to the next at every callback, this 84 # is easier to debug than doing a bunch of get_media_type() and 85 # returning a DeferredList 86 return get_media_type_next(None, 0) 87 88 # def test_is_directory(self): 89 # pass 90 # test_is_directory.skip = "Not implemented yet" 91 92 93 # def test_has_children_with_types(self): 94 # pass 95 # test_has_children_with_types.skip = "Not implemented yet" 96 97 # def test_get_direct_children(self): 98 # pass 99 # test_get_direct_children.skip = "Not implemented yet" 100 101 102 # def test_open(self): 103 # pass 104 # test_open.skip = "Not implemented yet" 105 106 107 # def test_close(self): 108 # pass 109 # test_close.skip = "Not implemented yet" 110 111 # def test_seek(self): 112 # pass 113 # test_seek.skip = "Not implemented yet" 114 115 # def test_read(self): 116 # pass 117 # test_read.skip = "Not implemented yet" 118 119 # def test_next_location(self): 120 # pass 121 # test_next_location.skip = "Not implemented yet" 122 123 # def test_previous_location(self): 124 # pass 125 # test_previous_location.skip = "Not implemented yet" 12633 """ 34 Return a list of validated URIs used by the generic tests. 35 36 @rtype: list of MediaUris for testing 37 """ 38 msg = "No valid URIs available" 39 raise unittest.SkipTest(msg)4042 schemes = self.component.scannable_uri_schemes 43 self.failUnless(isinstance(schemes, list)) 44 45 for scheme in schemes: 46 self.failUnless(isinstance(scheme, str))4749 schemes = self.component.supported_uri_schemes 50 self.failUnless(isinstance(schemes, dict)) 51 52 for key, value in schemes.items(): 53 self.failUnless(isinstance(key, str)) 54 self.failUnless(isinstance(value, int))5557 for uri in self._uris: 58 real = self.component.get_real_uri(uri) 59 self.failUnless(isinstance(real, MediaUri))6062 def get_media_type_next(result, uri_index): 63 if uri_index == len(self._uris): 64 # finished 65 return 66 67 uri = self._uris[uri_index] 68 dfr = self.component.get_media_type(uri) 69 dfr.addCallback(get_media_type_done) 70 dfr.addCallback(get_media_type_next, uri_index + 1) 71 72 return dfr73 74 def get_media_type_done(media_type): 75 self.assertEquals(set(media_type.keys()), 76 set(['file_type', 'mime_type'])) 77 self.failUnless(media_type['file_type'] in media_types or \ 78 media_type['file_type'] == '') 79 self.failUnless(isinstance(media_type['mime_type'], str)) 80 81 return media_type128 try: 129 to_monitor = [] 130 131 for uri in self._uris: 132 is_monitorable = self.component.uri_is_monitorable(uri) 133 self.failUnless(isinstance(is_monitorable, bool)) 134 135 # monitor only 2 of them 136 if is_monitorable and len(to_monitor) < 2: 137 to_monitor.append(uri) 138 139 self.failUnless(not self.component.uri_is_monitored(uri)) 140 141 for uri in to_monitor: 142 def do_nothing(): 143 pass144 self.component.monitor_uri(uri, do_nothing) 145 self.failUnless(self.component.uri_is_monitored(uri)) 146 except NotImplementedError: 147 return 148 149 # def test_copy(self): 150 # pass 151 # test_copy.skip = "Not implemented yet" 152 # 153 # def test_move(self): 154 # pass 155 # test_move.skip = "Not implemented yet" 156 # 157 # def test_delete(self): 158 # pass 159 # test_delete.skip = "Not implemented yet" 160
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0beta1 on Wed Jan 16 19:10:57 2008 | http://epydoc.sourceforge.net |