Ejemplo n.º 1
0
def testmod():
    import doctest
    global testEntry, testCatalog, testToHtml, testArchiveToHtml
    
    urn = 'urn:x-internet-archive:bookserver:catalog'
    testCatalog = Catalog(title='Internet Archive OPDS', urn=urn)
    testLink    = Link(url  = 'http://archive.org/download/itemid.pdf',
                       type = 'application/pdf', rel='http://opds-spec.org/acquisition/buying')
    catalogLink = Link(url = '/providers/IA', type = Link.opds)
    testEntry = Entry({'urn'  : 'x-internet-archive:item:itemid',
                        'title'   : u'test item',
                        'updated' : '2009-01-01T00:00:00Z',
                        'date': '1977-06-17T00:00:55Z',
                        'summary': '<p>Fantastic book.</p>',
                        },
                        links=[testLink])
                        
    start    = 0
    numFound = 2
    numRows  = 1
    urlBase  = '/alpha/a/'
    testNavigation = Navigation.initWithBaseUrl(start, numRows, numFound, urlBase)
    testCatalog.addNavigation(testNavigation)
    
    osDescription = 'http://bookserver.archive.org/catalog/opensearch.xml'
    testSearch = OpenSearch(osDescription)
    testCatalog.addOpenSearch(testSearch)
    
    testCatalog.addEntry(testEntry)
    testToHtml = CatalogToHtml(testCatalog)
    
    testArchiveToHtml = ArchiveCatalogToHtml(testCatalog)
    
    doctest.testmod()
Ejemplo n.º 2
0
def testmod():
    import doctest
    global testEntry, testCatalog, testToHtml, testArchiveToHtml

    urn = 'urn:x-internet-archive:bookserver:catalog'
    testCatalog = Catalog(title='Internet Archive OPDS', urn=urn)
    testLink = Link(url='http://archive.org/download/itemid.pdf',
                    type='application/pdf',
                    rel='http://opds-spec.org/acquisition/buying')
    catalogLink = Link(url='/providers/IA', type=Link.opds)
    testEntry = Entry(
        {
            'urn': 'x-internet-archive:item:itemid',
            'title': u'test item',
            'updated': '2009-01-01T00:00:00Z',
            'date': '1977-06-17T00:00:55Z',
            'summary': '<p>Fantastic book.</p>',
        },
        links=[testLink])

    start = 0
    numFound = 2
    numRows = 1
    urlBase = '/alpha/a/'
    testNavigation = Navigation.initWithBaseUrl(start, numRows, numFound,
                                                urlBase)
    testCatalog.addNavigation(testNavigation)

    osDescription = 'http://bookserver.archive.org/catalog/opensearch.xml'
    testSearch = OpenSearch(osDescription)
    testCatalog.addOpenSearch(testSearch)

    testCatalog.addEntry(testEntry)
    testToHtml = CatalogToHtml(testCatalog)

    testArchiveToHtml = ArchiveCatalogToHtml(testCatalog)

    doctest.testmod()