[Zope3-Users] Functional tests - new_value parameter question

Douglas Douglas replaceafill at yahoo.com
Fri Mar 4 12:45:55 EST 2005


Hello Stephan:

> There is no such limit. Your editor probably just inserted a newline
character 
> somewhere to break the line. Can you send the full traceback and code?

Here's the code I'm using:

********************* browser.txt *********************

Book Browser-Based User Interface
=================================

This document describes how to use book object.

First, let's create a book named 12345678123:

  >>> print http(r"""
  ... POST /@@contents.html HTTP/1.1
  ... Authorization: Basic mgr:mgrpw
  ... Content-Length: 59
  ... Content-Type: application/x-www-form-urlencoded
  ... Referer:
http://192.168.5.83:8081/@@contents.html?type_name=BrowserAdd__bookdemo.book.Book
  ...
  ... type_name=BrowserAdd__bookdemo.book.Book&new_value=12345678123""")
  HTTP/1.1 303 ...

Now, we can visit the book and see the basic book information displayed:

  >>> print http(r"""
  ... GET /12345678123 HTTP/1.1
  ... Authorization: Basic mgr:mgrpw
  ... """)
  HTTP/1.1 200 ...
          <table>
          <caption>Book information</caption>
          <tr>
            <td>Title:</td>
            <td></td>
          </tr>
          <tr>
            <td>Author:</td>
            <td></td>
          </tr>
          <tr>
            <td>ISBN:</td>
            <td></td>
          </tr>
          <tr>
            <td>Number of pages:</td>
            <td>0</td>
          </tr>
        </table> ...

********************* end of browser.txt *********************

When I run "python test.py -s bookdemo", it ouputs:

elbixio at physics:~/zopex3$ python test.py -s bookdemo
Configuration file found.
Running UNIT tests from /home/elbixio/zopex3
----------------------------------------------------------------------
Ran 3 tests in 0.051s

OK
Running FUNCTIONAL tests from /home/elbixio/zopex3
Parsing ftesting.zcml
Failure in test /home/elbixio/zopex3/src/bookdemo/browser.txt
Traceback (most recent call last):
  File "/home/elbixio/zopex3/src/zope/testing/doctest.py", line 2187, in
runTest    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for browser.txt
  File "/home/elbixio/zopex3/src/bookdemo/browser.txt", line 0

----------------------------------------------------------------------
File "/home/elbixio/zopex3/src/bookdemo/browser.txt", line 20, in browser.txt
Failed example:
    print http(r"""
    GET /12345678123 HTTP/1.1
    Authorization: Basic mgr:mgrpw
    """)
Differences (ndiff with -expected +actual):
    - HTTP/1.1 200 ...
    -         <table>
    -         <caption>Book information</caption>
    -         <tr>
    -           <td>Title:</td>
    -           <td></td>
    + HTTP/1.1 404 Not Found
    + Content-Length: 3229
    + Content-Type: text/html;charset=utf-8

    [snip]
    + <h3>
    +   The page that you are trying to access is not available
    + </h3>
    [snip]

When I change the value of the new_value parameter to 12345678, the tests work!

> Note that the Zope 3 book explains all types of tests.

Yeah, I'm reading it right now :)


	
		
__________________________________ 
Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 
http://birthday.yahoo.com/netrospective/


More information about the Zope3-users mailing list