comparison tests/doctest.txt @ 50:e4a97d6f2811

* add kinda a redundant test * stub out introspecting packages
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 01 Mar 2012 14:26:28 -0800
parents ca456e08924f
children 6a8071eab89e
comparison
equal deleted inserted replaced
49:ca456e08924f 50:e4a97d6f2811
4 The obligatory imports:: 4 The obligatory imports::
5 5
6 >>> import os 6 >>> import os
7 >>> import shutil 7 >>> import shutil
8 >>> import simpypi 8 >>> import simpypi
9 >>> import tempfile
9 >>> from paste.fixture import TestApp 10 >>> from paste.fixture import TestApp
10 11
11 The directory is initially empty:: 12 The directory is initially empty::
12 13
13 >>> os.listdir(directory) 14 >>> os.listdir(directory)
30 >>> os.listdir(directory) 31 >>> os.listdir(directory)
31 ['HelloWorld'] 32 ['HelloWorld']
32 >>> os.listdir(os.path.join(directory, 'HelloWorld')) 33 >>> os.listdir(os.path.join(directory, 'HelloWorld'))
33 ['HelloWorld-0.0.tar.gz'] 34 ['HelloWorld-0.0.tar.gz']
34 35
36 Ensure the package is what you expect it to be::
37
38 >>> tmpdir = tempfile.mkdtemp()
39 >>> shutil.rmtree(tmpdir)
40
35 Upload the same package but with the wrong name:: 41 Upload the same package but with the wrong name::
36 42
37 >>> shutil.rmtree(os.path.join(directory, 'HelloWorld')) 43 >>> shutil.rmtree(os.path.join(directory, 'HelloWorld'))
38 >>> os.listdir(directory) 44 >>> os.listdir(directory)
39 [] 45 []
40 >>> response = testapp.post('/', upload_files=[(field, 'MisleadingName.tar.gz', contents)]) 46 >>> response = testapp.post('/', upload_files=[(field, 'MisleadingName.tar.gz', contents)])
41 >>> os.listdir(directory) 47 >>> os.listdir(directory)
42 ['HelloWorld'] 48 ['HelloWorld']
43 >>> os.listdir(os.path.join(directory, 'HelloWorld')) 49 >>> os.listdir(os.path.join(directory, 'HelloWorld'))
44 ['HelloWorld-0.0.tar.gz'] 50 ['HelloWorld-0.0.tar.gz']
45 51 >>> shutil.rmtree(os.path.join(directory, 'HelloWorld'))
52 >>> os.listdir(directory)
53 []
54 >>> filename = 'MisleadingFilename.tar.gz'
55 >>> contents = file(os.path.join(here, filename)).read()
56 >>> response = testapp.post('/', upload_files=[(field, filename, contents)])
57 >>> os.listdir(directory)
58 ['HelloWorld']
59 >>> os.listdir(os.path.join(directory, 'HelloWorld'))
60 ['HelloWorld-0.0.tar.gz']