!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/Server/Server/SCore/   drwxr-xr-x
Free 4.93 GB of 27.03 GB (18.24%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     test_xslt_document.py (4.14 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
import time

from Ft.Server.Common import ResourceTypes, ValidationInfo
from Ft.Server.Server import FtServerServerException, Error

import test_helper

def test_create(tester):


    tester.startTest("Create XSLT Document")

    #Create XML Document
    repo = test_helper.GetRepo(tester)
    test = repo.fetchResource('/test')
    doc = test.createDocument('sheet1',SHEET1,forcedType=ResourceTypes.ResourceType.XSLT_DOCUMENT)

    tester.compare(ResourceTypes.ResourceType.XSLT_DOCUMENT,test.hasResource('sheet1'))
    tester.compare(doc,test.fetchResource('sheet1'))

    tester.compare(ResourceTypes.ResourceType.XSLT_DOCUMENT,doc.getResourceType())
    tester.compare(1,doc.isResourceType(ResourceTypes.ResourceType.RAW_FILE))
    tester.compare(1,doc.isResourceType(ResourceTypes.ResourceType.XML_DOCUMENT))
    tester.compare(1,doc.isResourceType(ResourceTypes.ResourceType.XSLT_DOCUMENT))
    tester.compare(0,doc.isResourceType(ResourceTypes.ResourceType.CONTAINER))
    repo.txCommit()

    repo = repo = test_helper.GetRepo(tester)
    test = repo.fetchResource('/test')
    tester.compare(ResourceTypes.ResourceType.XSLT_DOCUMENT,test.hasResource('sheet1'))
    repo.txRollback()

    repo = repo = test_helper.GetRepo(tester)
    sheet = repo.fetchResource('/test/sheet1')
    test = repo.fetchResource('/test')
    tester.compare(test,sheet.getParent())
    repo.txRollback()
                  
    tester.testDone()
    return



def test_access(tester):

    tester.startTest("XSLT Document Access")

    repo = test_helper.GetRepo(tester)
    sheet = repo.fetchResource('/test/sheet1')
    tester.compare('text/xml',sheet.getImt())
    tester.compare(SHEET1,sheet.getContent())
    vi = sheet.getValidationInfo()
    test_helper.CompareValidationInfo(tester,ValidationInfo.NoValidation(),vi)
    #Just call, don't test
    sheet.getCreationDate()
    sheet.getLastModifiedDate()
    repo.txRollback()
    
    tester.testDone()


def test_modify(tester):

    tester.startTest("XSLT Document Modification")

    repo = test_helper.GetRepo(tester)
    sheet = repo.fetchResource('/test/sheet1')
    lmd = sheet.getLastModifiedDate()
    time.sleep(1)
    sheet.setContent(SHEET2)
    tester.compare(SHEET2,sheet.getContent())
    repo.txCommit()

    repo = test_helper.GetRepo(tester)
    sheet = repo.fetchResource('/test/sheet1')
    tester.compare(SHEET2,sheet.getContent())
    tester.compare(1,sheet.getLastModifiedDate() > lmd)
    repo.txRollback()
    tester.testDone()



def test_delete(tester):

    tester.startTest("Delete XSLT Document")
    repo = test_helper.GetRepo(tester)
    sheet = repo.fetchResource('/test/sheet1')
    test = sheet.getParent()
    sheet.delete()
    tester.compare(0,test.hasResource('sheet1'))
    tester.testException(sheet.getContent,(),FtServerServerException,{'code':Error.OBJECT_DELETED})
    repo.txCommit()

    repo = test_helper.GetRepo(tester)
    test = repo.fetchResource('/test')
    tester.compare(0,test.hasResource('sheet1'))
    repo.txRollback()

    tester.testDone()

def test_xml_interfaces(tester):

    tester.startTest("XSLT Document to Stylesheet")
    repo = test_helper.GetRepo(tester)
    test = repo.fetchResource('/test')
    sheet1 = test.createDocument('sheet1',SHEET1,forcedType = ResourceTypes.ResourceType.XSLT_DOCUMENT)

    dom = sheet1.asStylesheet()
    tester.compare(1,hasattr(dom,'expandedName'))
    repo.txRollback()
    tester.testDone()





def cleanup(tester):

    tester.startTest("Clean Up")
    repo = test_helper.GetRepo(tester)
    if repo.hasResource('/test'):
        repo.deleteResource('/test')
    repo.createContainer("/test",1)
    repo.txCommit()
    tester.testDone()



SHEET1 = """<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:template match="/">
  Sheet 1
  </xsl:template>
</xsl:stylesheet>"""

SHEET2 = """<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:template match="/">
  Sheet 2
  </xsl:template>
</xsl:stylesheet>"""

def Test(tester):

    cleanup(tester)
    test_create(tester)
    test_access(tester)
    test_modify(tester)
    test_delete(tester)
    test_xml_interfaces(tester)



:: 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.004 ]--