コード例 #1
0
ファイル: test_commands.py プロジェクト: umitanuki/pgxnclient
    def test_unload_list(self, mock_popen, mock_pgver, mock_isext):
        pop = mock_popen.return_value
        pop.returncode = 0
        mock_pgver.return_value = (9,1,0)
        mock_isext.return_value = True

        tdir = tempfile.mkdtemp()
        try:
            from pgxnclient.utils.zip import unpack
            dir = unpack(get_test_filename('foobar-0.42.1.zip'), tdir)
            shutil.copyfile(
                get_test_filename('META-manyext.json'),
                os.path.join(dir, 'META.json'))

            from pgxnclient.cli import main
            main(['unload', '--yes', dir, 'baz', 'foo'])

        finally:
            shutil.rmtree(tdir)

        self.assertEquals(mock_popen.call_count, 2)
        self.assert_('psql' in mock_popen.call_args[0][0][0])
        self.assertEquals(pop.communicate.call_args_list[0][0][0],
            'DROP EXTENSION baz;')
        self.assertEquals(pop.communicate.call_args_list[1][0][0],
            'DROP EXTENSION foo;')
コード例 #2
0
ファイル: test_commands.py プロジェクト: grzm/pgxnclient
    def test_unload_extensions_order(self):
        tdir = tempfile.mkdtemp()
        try:
            from pgxnclient.zip import unpack
            dir = unpack(get_test_filename('foobar-0.42.1.zip'), tdir)
            shutil.copyfile(
                get_test_filename('META-manyext.json'),
                os.path.join(dir, 'META.json'))

            from pgxnclient.cli import main
            main(['unload', '--yes', dir])

        finally:
            shutil.rmtree(tdir)

        self.assertEquals(self.mock_popen.call_count, 4)
        self.assert_('psql' in self.mock_popen.call_args[0][0][0])
        communicate = self.mock_popen.return_value.communicate
        self.assertEquals(communicate.call_args_list[0][0][0],
            b('DROP EXTENSION qux;'))
        self.assertEquals(communicate.call_args_list[1][0][0],
            b('DROP EXTENSION baz;'))
        self.assertEquals(communicate.call_args_list[2][0][0],
            b('DROP EXTENSION bar;'))
        self.assertEquals(communicate.call_args_list[3][0][0],
            b('DROP EXTENSION foo;'))
コード例 #3
0
ファイル: test_commands.py プロジェクト: pombreda/pgxnclient
    def test_unload_extensions_order(self):
        tdir = tempfile.mkdtemp()
        try:
            from pgxnclient.zip import unpack
            dir = unpack(get_test_filename('foobar-0.42.1.zip'), tdir)
            shutil.copyfile(get_test_filename('META-manyext.json'),
                            os.path.join(dir, 'META.json'))

            from pgxnclient.cli import main
            main(['unload', '--yes', dir])

        finally:
            shutil.rmtree(tdir)

        self.assertEquals(self.mock_popen.call_count, 4)
        self.assert_('psql' in self.mock_popen.call_args[0][0][0])
        communicate = self.mock_popen.return_value.communicate
        self.assertEquals(communicate.call_args_list[0][0][0],
                          b('DROP EXTENSION qux;'))
        self.assertEquals(communicate.call_args_list[1][0][0],
                          b('DROP EXTENSION baz;'))
        self.assertEquals(communicate.call_args_list[2][0][0],
                          b('DROP EXTENSION bar;'))
        self.assertEquals(communicate.call_args_list[3][0][0],
                          b('DROP EXTENSION foo;'))
コード例 #4
0
ファイル: test_commands.py プロジェクト: pombreda/pgxnclient
    def test_unload_missing(self):
        tdir = tempfile.mkdtemp()
        try:
            from pgxnclient.zip import unpack
            dir = unpack(get_test_filename('foobar-0.42.1.zip'), tdir)
            shutil.copyfile(get_test_filename('META-manyext.json'),
                            os.path.join(dir, 'META.json'))

            from pgxnclient.cli import main
            self.assertRaises(PgxnClientException, main,
                              ['unload', '--yes', dir, 'foo', 'ach'])

        finally:
            shutil.rmtree(tdir)

        self.assertEquals(self.mock_popen.call_count, 0)
コード例 #5
0
ファイル: test_commands.py プロジェクト: petere/pgxnclient
    def test_unload_missing(self):
        tdir = tempfile.mkdtemp()
        try:
            from pgxnclient.utils.zip import unpack

            dir = unpack(get_test_filename("foobar-0.42.1.zip"), tdir)
            shutil.copyfile(get_test_filename("META-manyext.json"), os.path.join(dir, "META.json"))

            from pgxnclient.cli import main

            self.assertRaises(PgxnClientException, main, ["unload", "--yes", dir, "foo", "ach"])

        finally:
            shutil.rmtree(tdir)

        self.assertEquals(self.mock_popen.call_count, 0)
コード例 #6
0
ファイル: test_commands.py プロジェクト: grzm/pgxnclient
def fake_get_file(url, urlmap=None):
    if urlmap: url = urlmap.get(url, url)
    fn = get_test_filename(quote(url, safe=""))
    if not os.path.exists(fn):
        raise ResourceNotFound(fn)
    f = FakeFile(fn, 'rb')
    f.url = url
    return f
コード例 #7
0
ファイル: test_commands.py プロジェクト: grzm/pgxnclient
    def test_unload_missing(self):
        tdir = tempfile.mkdtemp()
        try:
            from pgxnclient.zip import unpack
            dir = unpack(get_test_filename('foobar-0.42.1.zip'), tdir)
            shutil.copyfile(
                get_test_filename('META-manyext.json'),
                os.path.join(dir, 'META.json'))

            from pgxnclient.cli import main
            self.assertRaises(PgxnClientException, main,
                ['unload', '--yes', dir, 'foo', 'ach'])

        finally:
            shutil.rmtree(tdir)

        self.assertEquals(self.mock_popen.call_count, 0)
コード例 #8
0
ファイル: test_commands.py プロジェクト: pombreda/pgxnclient
def fake_get_file(url, urlmap=None):
    if urlmap: url = urlmap.get(url, url)
    fn = get_test_filename(quote(url, safe=""))
    if not os.path.exists(fn):
        raise ResourceNotFound(fn)
    f = FakeFile(fn, 'rb')
    f.url = url
    return f
コード例 #9
0
ファイル: test_commands.py プロジェクト: petere/pgxnclient
    def test_install_local_zip(self, mock_unpack):
        from pgxnclient.utils.zip import unpack

        mock_unpack.side_effect = unpack

        from pgxnclient.cli import main

        main(["install", "--sudo", "--", get_test_filename("foobar-0.42.1.zip")])

        self.assertEquals(self.mock_popen.call_count, 2)
        self.assertEquals(["make"], self.mock_popen.call_args_list[0][0][0][:1])
        self.assertEquals(["sudo", "make"], self.mock_popen.call_args_list[1][0][0][:2])
        make_cwd = self.mock_popen.call_args_list[1][1]["cwd"]

        self.assertEquals(mock_unpack.call_count, 1)
        zipname, tmpdir = mock_unpack.call_args[0]
        self.assertEqual(zipname, get_test_filename("foobar-0.42.1.zip"))
        self.assertEqual(make_cwd, os.path.join(tmpdir, "foobar-0.42.1"))
コード例 #10
0
ファイル: test_commands.py プロジェクト: petere/pgxnclient
    def test_unload_list(self):
        tdir = tempfile.mkdtemp()
        try:
            from pgxnclient.utils.zip import unpack

            dir = unpack(get_test_filename("foobar-0.42.1.zip"), tdir)
            shutil.copyfile(get_test_filename("META-manyext.json"), os.path.join(dir, "META.json"))

            from pgxnclient.cli import main

            main(["unload", "--yes", dir, "baz", "foo"])

        finally:
            shutil.rmtree(tdir)

        self.assertEquals(self.mock_popen.call_count, 2)
        self.assert_("psql" in self.mock_popen.call_args[0][0][0])
        communicate = self.mock_popen.return_value.communicate
        self.assertEquals(communicate.call_args_list[0][0][0], "DROP EXTENSION baz;")
        self.assertEquals(communicate.call_args_list[1][0][0], "DROP EXTENSION foo;")
コード例 #11
0
ファイル: test_commands.py プロジェクト: umitanuki/pgxnclient
    def test_install_local_zip(self, mock_get, mock_popen, mock_unpack):
        mock_get.side_effect = lambda *args: self.fail('network invoked')
        pop = mock_popen.return_value
        pop.returncode = 0
        from pgxnclient.utils.zip import unpack
        mock_unpack.side_effect = unpack

        from pgxnclient.cli import main
        main(['install', get_test_filename('foobar-0.42.1.zip')])

        self.assertEquals(mock_popen.call_count, 2)
        self.assertEquals(['make'], mock_popen.call_args_list[0][0][0][:1])
        self.assertEquals(['sudo', 'make'],
            mock_popen.call_args_list[1][0][0][:2])
        make_cwd = mock_popen.call_args_list[1][1]['cwd']

        self.assertEquals(mock_unpack.call_count, 1)
        zipname, tmpdir = mock_unpack.call_args[0]
        self.assertEqual(zipname, get_test_filename('foobar-0.42.1.zip'))
        self.assertEqual(make_cwd, os.path.join(tmpdir, 'foobar-0.42.1'))
コード例 #12
0
ファイル: test_commands.py プロジェクト: grzm/pgxnclient
    def test_install_url_file(self):
        fn = get_test_filename('foobar-0.42.1.zip')
        url = 'file://' + os.path.abspath(fn).replace("f", '%%%2x' % ord('f'))

        from pgxnclient.cli import main
        main(['install', '--sudo', '--', url])

        self.assertEquals(self.mock_popen.call_count, 2)
        self.assertCallArgs([self.make], self.mock_popen.call_args_list[0][0][0][:1])
        self.assertCallArgs(['sudo', self.make],
            self.mock_popen.call_args_list[1][0][0][:2])
コード例 #13
0
ファイル: test_commands.py プロジェクト: pombreda/pgxnclient
    def test_install_url_file(self):
        fn = get_test_filename('foobar-0.42.1.zip')
        url = 'file://' + os.path.abspath(fn).replace("f", '%%%2x' % ord('f'))

        from pgxnclient.cli import main
        main(['install', '--sudo', '--', url])

        self.assertEquals(self.mock_popen.call_count, 2)
        self.assertCallArgs([self.make],
                            self.mock_popen.call_args_list[0][0][0][:1])
        self.assertCallArgs(['sudo', self.make],
                            self.mock_popen.call_args_list[1][0][0][:2])
コード例 #14
0
ファイル: test_commands.py プロジェクト: pombreda/pgxnclient
    def test_missing_meta_dir(self):
        # issue #19
        tdir = tempfile.mkdtemp()
        try:
            from pgxnclient.zip import unpack
            dir = unpack(get_test_filename('foobar-0.42.1.zip'), tdir)
            os.unlink(os.path.join(dir, 'META.json'))

            from pgxnclient.cli import main
            self.assertRaises(PgxnClientException, main, ['load', dir])

        finally:
            shutil.rmtree(tdir)
コード例 #15
0
ファイル: test_commands.py プロジェクト: decibel/pgxnclient
    def test_missing_meta_dir(self):
        # issue #19
        tdir = tempfile.mkdtemp()
        try:
            from pgxnclient.zip import unpack
            dir = unpack(get_test_filename('foobar-0.42.1.zip'), tdir)
            os.unlink(os.path.join(dir, 'META.json'))

            from pgxnclient.cli import main
            self.assertRaises(PgxnClientException, main, ['load', dir])

        finally:
            shutil.rmtree(tdir)
コード例 #16
0
ファイル: test_commands.py プロジェクト: grzm/pgxnclient
    def test_load_local_tar(self, mock_get, mock_unpack):
        mock_get.side_effect = lambda *args: self.fail('network invoked')
        mock_unpack.side_effect = TarArchive.unpack_orig

        from pgxnclient.cli import main
        main(['load', '--yes', get_test_filename('foobar-0.42.1.tar.gz')])

        self.assertEquals(mock_unpack.call_count, 0)
        self.assertEquals(self.mock_popen.call_count, 1)
        self.assert_('psql' in self.mock_popen.call_args[0][0][0])
        communicate = self.mock_popen.return_value.communicate
        self.assertEquals(communicate.call_args[0][0],
            b('CREATE EXTENSION foobar;'))
コード例 #17
0
ファイル: test_commands.py プロジェクト: umitanuki/pgxnclient
    def test_unload_missing(self, mock_popen, mock_pgver, mock_isext):
        pop = mock_popen.return_value
        pop.returncode = 0
        mock_pgver.return_value = (9,1,0)
        mock_isext.return_value = True

        tdir = tempfile.mkdtemp()
        try:
            from pgxnclient.utils.zip import unpack
            dir = unpack(get_test_filename('foobar-0.42.1.zip'), tdir)
            shutil.copyfile(
                get_test_filename('META-manyext.json'),
                os.path.join(dir, 'META.json'))

            from pgxnclient.cli import main
            self.assertRaises(PgxnClientException, main,
                ['unload', '--yes', dir, 'foo', 'ach'])

        finally:
            shutil.rmtree(tdir)

        self.assertEquals(mock_popen.call_count, 0)
コード例 #18
0
ファイル: test_commands.py プロジェクト: pombreda/pgxnclient
    def test_load_local_tar(self, mock_get, mock_unpack):
        mock_get.side_effect = lambda *args: self.fail('network invoked')
        mock_unpack.side_effect = TarArchive.unpack_orig

        from pgxnclient.cli import main
        main(['load', '--yes', get_test_filename('foobar-0.42.1.tar.gz')])

        self.assertEquals(mock_unpack.call_count, 0)
        self.assertEquals(self.mock_popen.call_count, 1)
        self.assert_('psql' in self.mock_popen.call_args[0][0][0])
        communicate = self.mock_popen.return_value.communicate
        self.assertEquals(communicate.call_args[0][0],
                          b('CREATE EXTENSION foobar;'))
コード例 #19
0
ファイル: test_commands.py プロジェクト: petere/pgxnclient
    def test_load_local_zip(self, mock_get, mock_unpack):
        mock_get.side_effect = lambda *args: self.fail("network invoked")
        from pgxnclient.utils.zip import unpack

        mock_unpack.side_effect = unpack

        from pgxnclient.cli import main

        main(["load", "--yes", get_test_filename("foobar-0.42.1.zip")])

        self.assertEquals(mock_unpack.call_count, 0)
        self.assertEquals(self.mock_popen.call_count, 1)
        self.assert_("psql" in self.mock_popen.call_args[0][0][0])
        communicate = self.mock_popen.return_value.communicate
        self.assertEquals(communicate.call_args[0][0], "CREATE EXTENSION foobar;")
コード例 #20
0
ファイル: test_commands.py プロジェクト: grzm/pgxnclient
    def test_install_local_zip(self, mock_unpack):
        fn = get_test_filename('foobar-0.42.1.zip')
        mock_unpack.side_effect = ZipArchive(fn).unpack_orig

        from pgxnclient.cli import main
        main(['install', '--sudo', '--', fn])

        self.assertEquals(self.mock_popen.call_count, 2)
        self.assertCallArgs([self.make], self.mock_popen.call_args_list[0][0][0][:1])
        self.assertCallArgs(['sudo', self.make],
            self.mock_popen.call_args_list[1][0][0][:2])
        make_cwd = self.mock_popen.call_args_list[1][1]['cwd']

        self.assertEquals(mock_unpack.call_count, 1)
        tmpdir, = mock_unpack.call_args[0]
        self.assertEqual(make_cwd, os.path.join(tmpdir, 'foobar-0.42.1'))
コード例 #21
0
ファイル: test_commands.py プロジェクト: pombreda/pgxnclient
    def test_install_local_zip(self, mock_unpack):
        fn = get_test_filename('foobar-0.42.1.zip')
        mock_unpack.side_effect = ZipArchive(fn).unpack_orig

        from pgxnclient.cli import main
        main(['install', '--sudo', '--', fn])

        self.assertEquals(self.mock_popen.call_count, 2)
        self.assertCallArgs([self.make],
                            self.mock_popen.call_args_list[0][0][0][:1])
        self.assertCallArgs(['sudo', self.make],
                            self.mock_popen.call_args_list[1][0][0][:2])
        make_cwd = self.mock_popen.call_args_list[1][1]['cwd']

        self.assertEquals(mock_unpack.call_count, 1)
        tmpdir, = mock_unpack.call_args[0]
        self.assertEqual(make_cwd, os.path.join(tmpdir, 'foobar-0.42.1'))
コード例 #22
0
ファイル: test_commands.py プロジェクト: umitanuki/pgxnclient
    def test_load_local_zip(self, mock_get, mock_popen, mock_unpack,
            mock_pgver, mock_isext):
        mock_get.side_effect = lambda *args: self.fail('network invoked')
        pop = mock_popen.return_value
        pop.returncode = 0
        from pgxnclient.utils.zip import unpack
        mock_unpack.side_effect = unpack
        mock_pgver.return_value = (9,1,0)
        mock_isext.return_value = True

        from pgxnclient.cli import main
        main(['load', '--yes', get_test_filename('foobar-0.42.1.zip')])

        self.assertEquals(mock_unpack.call_count, 0)
        self.assertEquals(mock_popen.call_count, 1)
        self.assert_('psql' in mock_popen.call_args[0][0][0])
        self.assertEquals(pop.communicate.call_args[0][0],
            'CREATE EXTENSION foobar;')
コード例 #23
0
ファイル: test_commands.py プロジェクト: grzm/pgxnclient
    def test_load_local_dir(self, mock_get):
        mock_get.side_effect = lambda *args: self.fail('network invoked')

        tdir = tempfile.mkdtemp()
        try:
            from pgxnclient.zip import unpack
            dir = unpack(get_test_filename('foobar-0.42.1.zip'), tdir)

            from pgxnclient.cli import main
            main(['load', '--yes', dir])

        finally:
            shutil.rmtree(tdir)

        self.assertEquals(self.mock_popen.call_count, 1)
        self.assert_('psql' in self.mock_popen.call_args[0][0][0])
        communicate = self.mock_popen.return_value.communicate
        self.assertEquals(communicate.call_args[0][0],
            b('CREATE EXTENSION foobar;'))
コード例 #24
0
ファイル: test_commands.py プロジェクト: pombreda/pgxnclient
    def test_load_local_dir(self, mock_get):
        mock_get.side_effect = lambda *args: self.fail('network invoked')

        tdir = tempfile.mkdtemp()
        try:
            from pgxnclient.zip import unpack
            dir = unpack(get_test_filename('foobar-0.42.1.zip'), tdir)

            from pgxnclient.cli import main
            main(['load', '--yes', dir])

        finally:
            shutil.rmtree(tdir)

        self.assertEquals(self.mock_popen.call_count, 1)
        self.assert_('psql' in self.mock_popen.call_args[0][0][0])
        communicate = self.mock_popen.return_value.communicate
        self.assertEquals(communicate.call_args[0][0],
                          b('CREATE EXTENSION foobar;'))
コード例 #25
0
ファイル: test_commands.py プロジェクト: grzm/pgxnclient
    def test_install_local_dir(self):
        self.mock_get.side_effect = lambda *args: self.fail('network invoked')

        tdir = tempfile.mkdtemp()
        try:
            from pgxnclient.zip import unpack
            dir = unpack(get_test_filename('foobar-0.42.1.zip'), tdir)

            from pgxnclient.cli import main
            main(['install', '--sudo', '--', dir])

        finally:
            shutil.rmtree(tdir)

        self.assertEquals(self.mock_popen.call_count, 2)
        self.assertCallArgs([self.make], self.mock_popen.call_args_list[0][0][0][:1])
        self.assertCallArgs(dir, self.mock_popen.call_args_list[0][1]['cwd'])
        self.assertCallArgs(['sudo', self.make],
            self.mock_popen.call_args_list[1][0][0][:2])
        self.assertEquals(dir, self.mock_popen.call_args_list[1][1]['cwd'])
コード例 #26
0
ファイル: test_commands.py プロジェクト: petere/pgxnclient
    def test_install_local_dir(self):
        self.mock_get.side_effect = lambda *args: self.fail("network invoked")

        tdir = tempfile.mkdtemp()
        try:
            from pgxnclient.utils.zip import unpack

            dir = unpack(get_test_filename("foobar-0.42.1.zip"), tdir)

            from pgxnclient.cli import main

            main(["install", "--sudo", "--", dir])

        finally:
            shutil.rmtree(tdir)

        self.assertEquals(self.mock_popen.call_count, 2)
        self.assertEquals(["make"], self.mock_popen.call_args_list[0][0][0][:1])
        self.assertEquals(dir, self.mock_popen.call_args_list[0][1]["cwd"])
        self.assertEquals(["sudo", "make"], self.mock_popen.call_args_list[1][0][0][:2])
        self.assertEquals(dir, self.mock_popen.call_args_list[1][1]["cwd"])
コード例 #27
0
ファイル: test_commands.py プロジェクト: pombreda/pgxnclient
    def test_install_local_dir(self):
        self.mock_get.side_effect = lambda *args: self.fail('network invoked')

        tdir = tempfile.mkdtemp()
        try:
            from pgxnclient.zip import unpack
            dir = unpack(get_test_filename('foobar-0.42.1.zip'), tdir)

            from pgxnclient.cli import main
            main(['install', '--sudo', '--', dir])

        finally:
            shutil.rmtree(tdir)

        self.assertEquals(self.mock_popen.call_count, 2)
        self.assertCallArgs([self.make],
                            self.mock_popen.call_args_list[0][0][0][:1])
        self.assertCallArgs(dir, self.mock_popen.call_args_list[0][1]['cwd'])
        self.assertCallArgs(['sudo', self.make],
                            self.mock_popen.call_args_list[1][0][0][:2])
        self.assertEquals(dir, self.mock_popen.call_args_list[1][1]['cwd'])
コード例 #28
0
ファイル: test_commands.py プロジェクト: umitanuki/pgxnclient
    def test_install_local_dir(self, mock_get, mock_popen):
        mock_get.side_effect = lambda *args: self.fail('network invoked')
        pop = mock_popen.return_value
        pop.returncode = 0

        tdir = tempfile.mkdtemp()
        try:
            from pgxnclient.utils.zip import unpack
            dir = unpack(get_test_filename('foobar-0.42.1.zip'), tdir)

            from pgxnclient.cli import main
            main(['install', dir])

        finally:
            shutil.rmtree(tdir)

        self.assertEquals(mock_popen.call_count, 2)
        self.assertEquals(['make'], mock_popen.call_args_list[0][0][0][:1])
        self.assertEquals(dir, mock_popen.call_args_list[0][1]['cwd'])
        self.assertEquals(['sudo', 'make'],
            mock_popen.call_args_list[1][0][0][:2])
        self.assertEquals(dir, mock_popen.call_args_list[1][1]['cwd'])
コード例 #29
0
ファイル: test_commands.py プロジェクト: umitanuki/pgxnclient
    def test_load_local_dir(self, mock_get, mock_popen,
            mock_pgver, mock_isext):
        mock_get.side_effect = lambda *args: self.fail('network invoked')
        pop = mock_popen.return_value
        pop.returncode = 0
        mock_pgver.return_value = (9,1,0)
        mock_isext.return_value = True

        tdir = tempfile.mkdtemp()
        try:
            from pgxnclient.utils.zip import unpack
            dir = unpack(get_test_filename('foobar-0.42.1.zip'), tdir)

            from pgxnclient.cli import main
            main(['load', '--yes', dir])

        finally:
            shutil.rmtree(tdir)

        self.assertEquals(mock_popen.call_count, 1)
        self.assert_('psql' in mock_popen.call_args[0][0][0])
        self.assertEquals(pop.communicate.call_args[0][0],
            'CREATE EXTENSION foobar;')
コード例 #30
0
ファイル: test_archives.py プロジェクト: decibel/pgxnclient
 def test_can_open_noext(self):
     fn = get_test_filename('zip.ext')
     a = zip.ZipArchive(fn)
     self.assert_(a.can_open())
     a.open()
     a.close()
コード例 #31
0
 def test_can_open(self):
     fn = get_test_filename('foobar-0.42.1.zip')
     a = zip.ZipArchive(fn)
     self.assert_(a.can_open())
     a.open()
     a.close()
コード例 #32
0
ファイル: test_archives.py プロジェクト: decibel/pgxnclient
 def test_cannot_open(self):
     fn = get_test_filename('foobar-0.42.1.tar.gz')
     a = zip.ZipArchive(fn)
     self.assert_(not a.can_open())
コード例 #33
0
ファイル: test_archives.py プロジェクト: decibel/pgxnclient
 def test_can_open(self):
     fn = get_test_filename('foobar-0.42.1.tar.gz')
     a = tar.TarArchive(fn)
     self.assert_(a.can_open())
     a.open()
     a.close()
コード例 #34
0
 def test_can_open(self):
     fn = get_test_filename('foobar-0.42.1.tar.gz')
     a = tar.TarArchive(fn)
     self.assert_(a.can_open())
     a.open()
     a.close()
コード例 #35
0
ファイル: test_archives.py プロジェクト: decibel/pgxnclient
 def test_from_file_unknown(self):
     fn = get_test_filename('META-manyext.json')
     self.assertRaises(PgxnClientException(archive.from_file, fn))
コード例 #36
0
 def test_from_file_tar(self):
     fn = get_test_filename('foobar-0.42.1.tar.gz')
     a = archive.from_file(fn)
     self.assert_(isinstance(a, tar.TarArchive))
     self.assertEqual(a.filename, fn)
コード例 #37
0
 def test_from_file_zip(self):
     fn = get_test_filename('foobar-0.42.1.zip')
     a = archive.from_file(fn)
     self.assert_(isinstance(a, zip.ZipArchive))
     self.assertEqual(a.filename, fn)
コード例 #38
0
ファイル: test_archives.py プロジェクト: decibel/pgxnclient
 def test_cannot_open(self):
     fn = get_test_filename('foobar-0.42.1.zip')
     a = tar.TarArchive(fn)
     self.assert_(not a.can_open())
コード例 #39
0
ファイル: test_archives.py プロジェクト: decibel/pgxnclient
 def test_from_file_zip(self):
     fn = get_test_filename('foobar-0.42.1.zip')
     a = archive.from_file(fn)
     self.assert_(isinstance(a, zip.ZipArchive))
     self.assertEqual(a.filename, fn)
コード例 #40
0
 def test_cannot_open(self):
     fn = get_test_filename('foobar-0.42.1.zip')
     a = tar.TarArchive(fn)
     self.assert_(not a.can_open())
コード例 #41
0
 def test_can_open_noext(self):
     fn = get_test_filename('tar.ext')
     a = tar.TarArchive(fn)
     self.assert_(a.can_open())
     a.open()
     a.close()
コード例 #42
0
ファイル: test_archives.py プロジェクト: decibel/pgxnclient
 def test_from_file_tar(self):
     fn = get_test_filename('foobar-0.42.1.tar.gz')
     a = archive.from_file(fn)
     self.assert_(isinstance(a, tar.TarArchive))
     self.assertEqual(a.filename, fn)
コード例 #43
0
 def test_can_open_noext(self):
     fn = get_test_filename('zip.ext')
     a = zip.ZipArchive(fn)
     self.assert_(a.can_open())
     a.open()
     a.close()
コード例 #44
0
ファイル: test_archives.py プロジェクト: decibel/pgxnclient
 def test_can_open(self):
     fn = get_test_filename('foobar-0.42.1.zip')
     a = zip.ZipArchive(fn)
     self.assert_(a.can_open())
     a.open()
     a.close()
コード例 #45
0
ファイル: test_archives.py プロジェクト: decibel/pgxnclient
 def test_can_open_noext(self):
     fn = get_test_filename('tar.ext')
     a = tar.TarArchive(fn)
     self.assert_(a.can_open())
     a.open()
     a.close()
コード例 #46
0
 def test_from_file_unknown(self):
     fn = get_test_filename('META-manyext.json')
     self.assertRaises(PgxnClientException(archive.from_file, fn))
コード例 #47
0
 def test_cannot_open(self):
     fn = get_test_filename('foobar-0.42.1.tar.gz')
     a = zip.ZipArchive(fn)
     self.assert_(not a.can_open())