annotate tests/doctest.txt @ 38:ee29001674af

begin to make a temporary copy (though itd be better to work in memory, ideally)
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 01 Mar 2012 10:02:31 -0800
parents 1bdece293671
children 089d5650d7e2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
5ee4fe3decd9 more stubbing
Jeff Hammel <jhammel@mozilla.com>
parents: 6
diff changeset
1 Test simpypi
5ee4fe3decd9 more stubbing
Jeff Hammel <jhammel@mozilla.com>
parents: 6
diff changeset
2 ============
6
232e67cac00c stub testing
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3
232e67cac00c stub testing
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 The obligatory imports::
232e67cac00c stub testing
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5
33
058182b7b309 note test-requires.txt in the readme
Jeff Hammel <jhammel@mozilla.com>
parents: 8
diff changeset
6 >>> import os
6
232e67cac00c stub testing
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7 >>> import simpypi
33
058182b7b309 note test-requires.txt in the readme
Jeff Hammel <jhammel@mozilla.com>
parents: 8
diff changeset
8 >>> from paste.fixture import TestApp
6
232e67cac00c stub testing
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9
33
058182b7b309 note test-requires.txt in the readme
Jeff Hammel <jhammel@mozilla.com>
parents: 8
diff changeset
10 The directory is initially empty::
058182b7b309 note test-requires.txt in the readme
Jeff Hammel <jhammel@mozilla.com>
parents: 8
diff changeset
11
058182b7b309 note test-requires.txt in the readme
Jeff Hammel <jhammel@mozilla.com>
parents: 8
diff changeset
12 >>> os.listdir(directory)
058182b7b309 note test-requires.txt in the readme
Jeff Hammel <jhammel@mozilla.com>
parents: 8
diff changeset
13 []
058182b7b309 note test-requires.txt in the readme
Jeff Hammel <jhammel@mozilla.com>
parents: 8
diff changeset
14
058182b7b309 note test-requires.txt in the readme
Jeff Hammel <jhammel@mozilla.com>
parents: 8
diff changeset
15 Make a test application::
058182b7b309 note test-requires.txt in the readme
Jeff Hammel <jhammel@mozilla.com>
parents: 8
diff changeset
16
058182b7b309 note test-requires.txt in the readme
Jeff Hammel <jhammel@mozilla.com>
parents: 8
diff changeset
17 >>> app = simpypi.SimPyPI(directory)
058182b7b309 note test-requires.txt in the readme
Jeff Hammel <jhammel@mozilla.com>
parents: 8
diff changeset
18 >>> testapp = TestApp(app)
36
a02d08627d9c stub a test to upload a package
Jeff Hammel <jhammel@mozilla.com>
parents: 33
diff changeset
19
a02d08627d9c stub a test to upload a package
Jeff Hammel <jhammel@mozilla.com>
parents: 33
diff changeset
20 Upload a package::
a02d08627d9c stub a test to upload a package
Jeff Hammel <jhammel@mozilla.com>
parents: 33
diff changeset
21
a02d08627d9c stub a test to upload a package
Jeff Hammel <jhammel@mozilla.com>
parents: 33
diff changeset
22 >>> field = 'package'
a02d08627d9c stub a test to upload a package
Jeff Hammel <jhammel@mozilla.com>
parents: 33
diff changeset
23 >>> filename = 'HelloWorld-0.0.tar.gz'
a02d08627d9c stub a test to upload a package
Jeff Hammel <jhammel@mozilla.com>
parents: 33
diff changeset
24 >>> contents = file(os.path.join(here, filename)).read()
37
1bdece293671 * fix calling signature in test
Jeff Hammel <jhammel@mozilla.com>
parents: 36
diff changeset
25 >>> response = testapp.post('/', upload_files=[(field, filename, contents)])