1
"""Tests for distutils.command.upload."""
6
from distutils.command.upload import upload
7
from distutils.core import Distribution
9
from distutils.tests import support
10
from distutils.tests.test_config import PYPIRC, PyPIRCCommandTestCase
12
PYPIRC_NOPASSWORD = """\
23
class uploadTestCase(PyPIRCCommandTestCase):
25
def test_finalize_options(self):
28
f = open(self.rc, 'w')
34
cmd.finalize_options()
35
for attr, waited in (('username', 'me'), ('password', 'secret'),
37
('repository', 'http://pypi.python.org/pypi')):
38
self.assertEquals(getattr(cmd, attr), waited)
40
def test_saved_password(self):
41
# file with no password
42
f = open(self.rc, 'w')
43
f.write(PYPIRC_NOPASSWORD)
49
cmd.finalize_options()
50
self.assertEquals(cmd.password, None)
52
# make sure we get it as well, if another command
53
# initialized it at the dist level
56
cmd.finalize_options()
57
self.assertEquals(cmd.password, 'xxx')
60
return unittest.makeSuite(uploadTestCase)
62
if __name__ == "__main__":
63
unittest.main(defaultTest="test_suite")