Day 17 - Th, Mar 21st, 2013¶
Schedule:
- Read over Homework #4 and ask questions.
- Read answers to questions from Day 13 – Tu, Feb 19th, 2013 and Day 14 – Th, Feb 21st, 2013.
- Work on questions from Day 15 - Tu, Mar 12th, 2013, Day 16 - Tu, Mar 19th, 2013, and today.
- Minute cards.
Testing WSGI and Web apps, round 1¶
Update your cse491-webz branch with the latest master from https://github.com/ctb/cse491-webz, and run the tests in test_app using nose:
%% nosetests
Now go look at ‘test_app.py’ –
- What is the call order of functions to get down to the ‘index’ function in app.py in test_index()?
- What is the call order of functions to get down to the ‘recv’ function in app.py in test_recv()?
- Why is the ‘/form’ function not called in the tests at all?
- Try refactoring test_app.py so that common code in test_index and test_form_recv is in one function that is then called in those two test functions.
Slightly more advanced magic¶
Look at the ‘magic’ branch on https://github.com/ctb/cse491-webz, especially the calls under __main__:
https://github.com/ctb/cse491-webz/blob/magic/json-rpc-client.py#L52
This is an attempt to clean up the equivalent calls from the main branch:
https://github.com/ctb/cse491-webz/blob/master/json-rpc-client.py#L30
How does this work??
More specifically,
- What is the chain of function calls that leads to and from ‘call_remote’ on the magic branch when you ask for ‘magic.hello()’ the first time? And the second time?
- What does JSON_RPC_Magic do, and why is it separate from or different from MagicFunction?
Minute Cards¶
In the last 5 minutes of class, please fill out this minute card survey.