!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache/2.2.16 (Debian). PHP/5.3.3-7+squeeze19 

uname -a: Linux mail.tri-specialutilitydistrict.com 2.6.32-5-amd64 #1 SMP Tue May 13 16:34:35 UTC
2014 x86_64
 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/usr/share/pyshared/coherence/upnp/core/test/   drwxr-xr-x
Free 129.8 GB of 142.11 GB (91.33%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     test_didl.py (3.6 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
# -*- coding: utf-8 -*-

# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php

# Copyright 2008, Frank Scholz <coherence@beebits.net>

"""
Test cases for L{upnp.core.DIDLLite}
"""

from copy import copy

from twisted.trial import unittest

from coherence.upnp.core import DIDLLite

didl_fragment = """
<DIDL-Lite xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"
           xmlns:dc="http://purl.org/dc/elements/1.1/"
           xmlns:dlna="urn:schemas-dlna-org:metadata-1-0"
           xmlns:pv="http://www.pv.com/pvns/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/">
    <container childCount="23" id="1161" parentID="103" restricted="0">
        <dc:title>12</dc:title>
        <upnp:class>object.container.album.musicAlbum</upnp:class>
        <dc:date>1997-02-28T17:20:00+01:00</dc:date>
        <upnp:albumArtURI dlna:profileID="JPEG_TN" xmlns:dlna="urn:schemas-dlna-org:metadata-1-0">http://192.168.1.1:30020/776dec17-1ce1-4c87-841e-cac61a14a2e0/1161?cover.jpg</upnp:albumArtURI>
        <upnp:artist>Herby Sängermeister</upnp:artist>
    </container>
</DIDL-Lite>"""

test_didl_fragment = """
<DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/"
           xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/"
           xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite">
    <item id="" restricted="0">
        <dc:title>New Track</dc:title>
        <upnp:class>object.item.audioItem.musicTrack</upnp:class>
        <res protocolInfo="*:*:audio:*">
        </res>
    </item>
</DIDL-Lite>"""

class TestDIDLLite(unittest.TestCase):

    def test_DIDLElement_class_detect(self):
        """ tests class creation from an XML DIDLLite fragment,
            expects a MusicAlbum container in return
        """
        didl_element = DIDLLite.DIDLElement.fromString(didl_fragment)
        items = didl_element.getItems()
        self.assertEqual(len(items),1)
        self.assertTrue(isinstance(items[0],DIDLLite.MusicAlbum))

    def test_DIDLElement_class_2_detect(self):
        """ tests class creation from an XML DIDLLite fragment,
            expects a MusicTrack item in return
        """
        didl_element = DIDLLite.DIDLElement.fromString(test_didl_fragment)
        items = didl_element.getItems()
        self.assertEqual(len(items),1)
        self.assertTrue(isinstance(items[0],DIDLLite.MusicTrack))

    def test_DIDLElement_class_fallback_1(self):
        """ tests class fallback creation from an XML DIDLLite fragment with
            an unknown UPnP class identifier,
            expects an Album container in return
        """
        wrong_didl_fragment = copy(didl_fragment)
        wrong_didl_fragment = wrong_didl_fragment.replace('object.container.album.musicAlbum', 'object.container.album.videoAlbum')
        didl_element = DIDLLite.DIDLElement.fromString(wrong_didl_fragment)
        items = didl_element.getItems()
        self.assertEqual(len(items),1)
        self.assertTrue(isinstance(items[0],DIDLLite.Album))

    def test_DIDLElement_class_fallback_2(self):
        """ tests class fallback creation from an XML DIDLLite fragment with
            an unknown UPnP class identifier,
            expects an Exception.AttributeError
        """
        wrong_didl_fragment = copy(didl_fragment)
        wrong_didl_fragment = wrong_didl_fragment.replace('object.container.album.musicAlbum', 'object.wrongcontainer.wrongalbum.videoAlbum')
        e = None
        try:
            didl_element = DIDLLite.DIDLElement.fromString(wrong_didl_fragment)
        except AttributeError:
            return
        self.assert_(False,"DIDLElement didn't return None from a totally wrong UPnP class identifier")

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0168 ]--