]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/tests/test_upload.py
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Lib / distutils / tests / test_upload.py
diff --git a/AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/tests/test_upload.py b/AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/tests/test_upload.py
deleted file mode 100644 (file)
index 51c2f05..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-# -*- encoding: utf8 -*-\r
-"""Tests for distutils.command.upload."""\r
-import os\r
-import unittest\r
-from test.test_support import run_unittest\r
-\r
-from distutils.command import upload as upload_mod\r
-from distutils.command.upload import upload\r
-from distutils.core import Distribution\r
-\r
-from distutils.tests.test_config import PYPIRC, PyPIRCCommandTestCase\r
-\r
-PYPIRC_LONG_PASSWORD = """\\r
-[distutils]\r
-\r
-index-servers =\r
-    server1\r
-    server2\r
-\r
-[server1]\r
-username:me\r
-password:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r
-\r
-[server2]\r
-username:meagain\r
-password: secret\r
-realm:acme\r
-repository:http://another.pypi/\r
-"""\r
-\r
-\r
-PYPIRC_NOPASSWORD = """\\r
-[distutils]\r
-\r
-index-servers =\r
-    server1\r
-\r
-[server1]\r
-username:me\r
-"""\r
-\r
-class FakeOpen(object):\r
-\r
-    def __init__(self, url):\r
-        self.url = url\r
-        if not isinstance(url, str):\r
-            self.req = url\r
-        else:\r
-            self.req = None\r
-        self.msg = 'OK'\r
-\r
-    def getcode(self):\r
-        return 200\r
-\r
-\r
-class uploadTestCase(PyPIRCCommandTestCase):\r
-\r
-    def setUp(self):\r
-        super(uploadTestCase, self).setUp()\r
-        self.old_open = upload_mod.urlopen\r
-        upload_mod.urlopen = self._urlopen\r
-        self.last_open = None\r
-\r
-    def tearDown(self):\r
-        upload_mod.urlopen = self.old_open\r
-        super(uploadTestCase, self).tearDown()\r
-\r
-    def _urlopen(self, url):\r
-        self.last_open = FakeOpen(url)\r
-        return self.last_open\r
-\r
-    def test_finalize_options(self):\r
-\r
-        # new format\r
-        self.write_file(self.rc, PYPIRC)\r
-        dist = Distribution()\r
-        cmd = upload(dist)\r
-        cmd.finalize_options()\r
-        for attr, waited in (('username', 'me'), ('password', 'secret'),\r
-                             ('realm', 'pypi'),\r
-                             ('repository', 'http://pypi.python.org/pypi')):\r
-            self.assertEqual(getattr(cmd, attr), waited)\r
-\r
-    def test_saved_password(self):\r
-        # file with no password\r
-        self.write_file(self.rc, PYPIRC_NOPASSWORD)\r
-\r
-        # make sure it passes\r
-        dist = Distribution()\r
-        cmd = upload(dist)\r
-        cmd.finalize_options()\r
-        self.assertEqual(cmd.password, None)\r
-\r
-        # make sure we get it as well, if another command\r
-        # initialized it at the dist level\r
-        dist.password = 'xxx'\r
-        cmd = upload(dist)\r
-        cmd.finalize_options()\r
-        self.assertEqual(cmd.password, 'xxx')\r
-\r
-    def test_upload(self):\r
-        tmp = self.mkdtemp()\r
-        path = os.path.join(tmp, 'xxx')\r
-        self.write_file(path)\r
-        command, pyversion, filename = 'xxx', '2.6', path\r
-        dist_files = [(command, pyversion, filename)]\r
-        self.write_file(self.rc, PYPIRC_LONG_PASSWORD)\r
-\r
-        # lets run it\r
-        pkg_dir, dist = self.create_dist(dist_files=dist_files, author=u'dédé')\r
-        cmd = upload(dist)\r
-        cmd.ensure_finalized()\r
-        cmd.run()\r
-\r
-        # what did we send ?\r
-        self.assertIn('dédé', self.last_open.req.data)\r
-        headers = dict(self.last_open.req.headers)\r
-        self.assertEqual(headers['Content-length'], '2085')\r
-        self.assertTrue(headers['Content-type'].startswith('multipart/form-data'))\r
-        self.assertEqual(self.last_open.req.get_method(), 'POST')\r
-        self.assertEqual(self.last_open.req.get_full_url(),\r
-                         'http://pypi.python.org/pypi')\r
-        self.assertTrue('xxx' in self.last_open.req.data)\r
-        auth = self.last_open.req.headers['Authorization']\r
-        self.assertFalse('\n' in auth)\r
-\r
-def test_suite():\r
-    return unittest.makeSuite(uploadTestCase)\r
-\r
-if __name__ == "__main__":\r
-    run_unittest(test_suite())\r