Mercurial > hg > simpypi
comparison tests/test_ttw.txt @ 65:83327bc715be
make the virtualenv convenience method return more stuff
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Thu, 01 Mar 2012 18:31:52 -0800 |
| parents | 7c154953acc4 |
| children | a2ba66be2e31 |
comparison
equal
deleted
inserted
replaced
| 64:bb8d993376aa | 65:83327bc715be |
|---|---|
| 3 | 3 |
| 4 Test ``simpypi`` through the web with a test server. | 4 Test ``simpypi`` through the web with a test server. |
| 5 | 5 |
| 6 The obligatory imports:: | 6 The obligatory imports:: |
| 7 | 7 |
| 8 >>> import os | |
| 8 >>> import urllib2 | 9 >>> import urllib2 |
| 9 >>> from simpypi.factory import factory | 10 >>> from simpypi.factory import factory |
| 10 | 11 |
| 11 Create a WSGI app:: | 12 Create a WSGI app:: |
| 12 | 13 |
| 31 >>> resource = urllib2.urlopen(url + 'index') | 32 >>> resource = urllib2.urlopen(url + 'index') |
| 32 >>> contents = resource.read() | 33 >>> contents = resource.read() |
| 33 >>> 'Simple Index' in contents | 34 >>> 'Simple Index' in contents |
| 34 True | 35 True |
| 35 | 36 |
| 37 | |
| 38 There should be no files to start out with:: | |
| 39 | |
| 40 >>> os.listdir(directory) | |
| 41 [] | |
| 42 | |
| 43 Upload a file:: | |
| 44 | |
| 45 >>> path = os.path.join(here, 'HelloWorld-0.0.tar.gz') | |
| 46 >>> upload = MultiPartForm() | |
| 47 >>> upload.add_file('package', path) | |
| 48 >>> response = upload.post(url) | |
| 49 | |
| 50 Let's see if its in the right place:: | |
| 51 | |
| 52 >>> os.listdir(directory) | |
| 53 ['HelloWorld'] | |
| 54 >>> os.listdir(os.path.join(directory, 'HelloWorld')) | |
| 55 ['HelloWorld-0.0.tar.gz'] | |
| 56 | |
| 36 Shut down the server:: | 57 Shut down the server:: |
| 37 | 58 |
| 38 >>> server.stop() | 59 >>> server.stop() |
