!C99Shell v. 1.0 pre-release build #16!

Software: Apache/2.0.54 (Fedora). PHP/5.0.4 

uname -a: Linux mina-info.me 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686 

uid=48(apache) gid=48(apache) groups=48(apache)
context=system_u:system_r:httpd_sys_script_t
 

Safe-mode: OFF (not secure)

/usr/lib/4Suite/tests/Xml/Core/   drwxr-xr-x
Free 3.74 GB of 27.03 GB (13.83%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     test_nss.py (6.88 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
from Ft.Xml import InputSource
from Ft.Xml import Domlette

def test_get_all_ns(tester, module):
    tester.startGroup("GetAllNs")
    
    src_1 = """
<foo:bar xmlns:foo='http://foo.com'><baz:bar xmlns:baz='http://baz.com'/>
</foo:bar>
"""
    isrc = InputSource.DefaultFactory.fromString(src_1, "dummy")
    doc = module.NonvalParse(isrc)

    tester.startTest("Simple")
    node = doc.documentElement
    res = module.GetAllNs(node)
    tester.compare(2,len(res.keys()))
    tester.compare(1,res.has_key('xml'))
    tester.compare(1,res.has_key('foo'))
    tester.compare('http://foo.com',res['foo'])
    tester.compare('http://www.w3.org/XML/1998/namespace',res['xml'])
    tester.testDone()


    tester.startTest("Simple One Deep")
    node = doc.documentElement.firstChild
    res = module.GetAllNs(node)
    tester.compare(3,len(res.keys()))
    tester.compare(1,res.has_key('xml'))
    tester.compare(1,res.has_key('foo'))
    tester.compare(1,res.has_key('baz'))
    tester.compare('http://foo.com',res['foo'])
    tester.compare('http://baz.com',res['baz'])
    tester.compare('http://www.w3.org/XML/1998/namespace',res['xml'])
    tester.testDone()

    src_2 = """
<foo:bar xmlns='http://default.com'
         xmlns:foo='http://foo.com'
         xmlns:baz='http://baz.com'
/>"""
    isrc = InputSource.DefaultFactory.fromString(src_2, "dummy")
    doc = module.NonvalParse(isrc)

    tester.startTest("Unused xmlns declaration")
    node = doc.documentElement
    res = module.GetAllNs(node)
    tester.compare(4,len(res.keys()))
    tester.compare(1,res.has_key('xml'))
    tester.compare(1,res.has_key('foo'))
    tester.compare(1,res.has_key('baz'))
    tester.compare(1,res.has_key(None))
    tester.compare('http://foo.com',res['foo'])
    tester.compare('http://baz.com',res['baz'])
    tester.compare('http://default.com',res[None])
    tester.compare('http://www.w3.org/XML/1998/namespace',res['xml'])
    tester.testDone()

    doc = module.implementation.createDocument(None,None,None)
    elem = doc.createElementNS("http://element.com","foo:root")
    elem.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:foo","http://attrDecl")

    tester.startTest("Different element and namespace decl")
    res = module.GetAllNs(elem)
    tester.compare(2,len(res.keys()))
    tester.compare(1,res.has_key('xml'))
    tester.compare(1,res.has_key('foo'))
    tester.compare('http://element.com',res['foo'])
    tester.compare('http://www.w3.org/XML/1998/namespace',res['xml'])
    tester.testDone()

    tester.groupDone()
    return

def test_seek_nss(tester, module):
    tester.startGroup("SeekNss")
    
    src_1 = """
<foo:bar xmlns:foo='http://foo.com'>
  <baz:bar xmlns:baz='http://baz.com'/>
</foo:bar>
"""
    isrc = InputSource.DefaultFactory.fromString(src_1, "dummy")
    doc = module.NonvalParse(isrc)

    tester.startTest("Simple")
    node = doc.documentElement
    res = module.SeekNss(node)
    tester.compare(2,len(res.keys()))
    tester.compare(1,res.has_key('foo'))
    tester.compare('http://foo.com',res['foo'])
    tester.compare(1,res.has_key('baz'))
    tester.compare('http://baz.com',res['baz'])
    tester.testDone()

    src_1a = """
<foo:bar xmlns:foo='http://foo.com'>
  <foo:bar xmlns:foo='http://other-foo.com'/>
</foo:bar>
"""
    isrc = InputSource.DefaultFactory.fromString(src_1a, "dummy")
    doc = module.NonvalParse(isrc)

    tester.startTest("Redefined prefix")
    node = doc.documentElement
    res = module.SeekNss(node)
    tester.compare(1,len(res.keys()))
    tester.compare(1,res.has_key('foo'))
    tester.compare('http://foo.com',res['foo'])
    tester.testDone()

    src_2 = """
<foo:bar xmlns='http://default.com'
         xmlns:foo='http://foo.com'
         xmlns:baz='http://baz.com'
/>"""
    isrc = InputSource.DefaultFactory.fromString(src_2, "dummy")
    doc = module.NonvalParse(isrc)

    tester.startTest("Unused xmlns declaration")
    node = doc.documentElement
    res = module.SeekNss(node)
    tester.compare(3,len(res.keys()))
    tester.compare(1,res.has_key('foo'))
    tester.compare(1,res.has_key('baz'))
    tester.compare(1,res.has_key(None))
    tester.compare('http://foo.com',res['foo'])
    tester.compare('http://baz.com',res['baz'])
    tester.compare('http://default.com',res[None])
    tester.testDone()

    src_3 = """
<foo:bar xmlns:foo='http://foo.com'
         xmlns:baz='http://baz.com'>
  <bar xmlns='http://default.com'/>
  <bar xmlns='http://other-default.com'/>
</foo:bar>"""
    isrc = InputSource.DefaultFactory.fromString(src_3, "dummy")
    doc = module.NonvalParse(isrc)

    tester.startTest("Default xmlns declaration")
    node = doc.documentElement
    res = module.SeekNss(node)
    tester.compare(3,len(res.keys()))
    tester.compare(1,res.has_key('foo'))
    tester.compare(1,res.has_key('baz'))
    tester.compare(1,res.has_key(None))
    tester.compare('http://foo.com',res['foo'])
    tester.compare('http://baz.com',res['baz'])
    tester.compare('http://default.com',res[None])
    tester.testDone()

    src_4 = """
<foo:bar xmlns:foo='http://foo.com'
         xmlns:baz='http://baz.com'>
  <bar xmlns='http://default.com'/>
  <bar xmlns='http://other-default.com'/>
</foo:bar>"""
    isrc = InputSource.DefaultFactory.fromString(src_4, "dummy")
    doc = module.NonvalParse(isrc)

    tester.startTest("Multiple default xmlns declarations")
    node = doc.documentElement
    res = module.SeekNss(node)
    tester.compare(3,len(res.keys()))
    tester.compare(1,res.has_key('foo'))
    tester.compare(1,res.has_key('baz'))
    tester.compare(1,res.has_key(None))
    tester.compare('http://foo.com',res['foo'])
    tester.compare('http://baz.com',res['baz'])
    tester.compare('http://default.com',res[None])
    tester.testDone()

    tester.startTest("Multiple redefined xmlns declarations")
    src_5 = """
<S:foo xmlns:S="http://example.com/1">
  <bar>test</bar>
  <bar xmlns='http://example.com/2'>test2</bar>
  <S:bar xmlns:S='http://example.com/2'>test2</S:bar>
</S:foo>"""
    isrc = InputSource.DefaultFactory.fromString(src_5, "dummy")
    doc = module.NonvalParse(isrc)
    res = module.SeekNss(doc)
    tester.compare(1,len(res.keys()))
    tester.compare(1,res.has_key('S'))
    tester.compare('http://example.com/1', res['S'])
    tester.testDone()

    doc = module.implementation.createDocument(None,None,None)
    elem = doc.createElementNS("http://element.com","foo:root")
    elem.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:foo","http://attrDecl")

    tester.startTest("Different element and namespace decl")
    res = module.SeekNss(elem)
    tester.compare(1,len(res.keys()))
    tester.compare(1,res.has_key('foo'))
    tester.compare('http://element.com',res['foo'])
    tester.testDone()

    tester.groupDone()
    return

def Test(tester):
    # -- GetAllNs ------------------------------------------------------
    test_get_all_ns(tester, Domlette)

    # -- SeekNss -------------------------------------------------------
    test_seek_nss(tester, Domlette)
    return

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

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

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

--[ c99shell v. 1.0 pre-release build #16 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0042 ]--