コード例 #1
0
ファイル: tests.py プロジェクト: Qt-MVC-MVVM/ebooksearchtool
 def test_search(self):
     """ tests search response"""
     client = Client()
     lang = Language(id=0)
     lang.save()
     book = Book(title="Book", language=lang)
     book.save()
     
     response = client.get('/search?query=Book')        
     print 'status code for good search request', response.status_code
     self.failUnlessEqual(response.status_code, 200)
     
     response = client.get('/search.atom?query=Book')        
     print 'status code for good search request', response.status_code
     self.failUnlessEqual(response.status_code, 200)
コード例 #2
0
ファイル: tests.py プロジェクト: Qt-MVC-MVVM/ebooksearchtool
    def test_book(self):
        """ tests book response"""
        client = Client()
        lang = Language(id=0)
        lang.save()
        book = Book(title="Book", language=lang)
        book.save()
        book_id = book.id
        
        response = client.get('/book.atom/id%s/' %(book_id,))
        print 'status code for good book request in atom', response.status_code
        self.failUnlessEqual(response.status_code, 200)

        response = client.get('/book/id%s/' %(book_id,))
        print 'status code for good book request in xhtml', response.status_code
        self.failUnlessEqual(response.status_code, 200)

        response = client.get('/book.atom/id%s/' %(book_id + 1,))
        print 'status code for bad book request in atom', response.status_code
        self.failUnlessEqual(response.status_code, 404)                          
        
        response = client.get('/book/id%s/' %(book_id + 1,))
        print 'status code for bad book request in xhtml', response.status_code
        self.failUnlessEqual(response.status_code, 404)