Пример #1
0
def test_list_packages(stdout):
    with HTTMock(packages_mock):
        tool = PackageTool()
        server = Server('localhost')

        tool.execute(server, ['package', 'list'])

        i = 0
        for line in EXPECTED_LIST:
            eq_(line, untab(stdout.getvalue())[i])
            i += 1
Пример #2
0
def test_uninstall_package(stderr, stdout):
    with HTTMock(packages_mock):
        tool = PackageTool()
        server = Server('localhost')

        status = tool.execute(server, ['package', 'uninstall', 'mock_package'])
        eq_(0, status)
        eq_('', stdout.getvalue())
        eq_('', stderr.getvalue())
Пример #3
0
def test_install_package_raw(stderr, stdout):
    with HTTMock(packages_mock):
        tool = PackageTool()
        server = Server('localhost')

        status = tool.execute(server,
                              ['package', 'install', '--raw', 'mock_package'])
        eq_(0, status)
        eq_('{"success": true, "msg": "Package Installed"}\n',
            stdout.getvalue())
        eq_('', stderr.getvalue())
Пример #4
0
def test_upload_package_raw(stderr, stdout):
    with HTTMock(upload_packages_mock):
        tool = PackageTool()
        server = Server('localhost')

        status = tool.execute(
            server,
            ['package', 'upload', '--raw', 'tests/test_data/mock_package.zip'])
        eq_(0, status)
        eq_('', stderr.getvalue())
        eq_(True, len(stdout.getvalue()) > 0)
Пример #5
0
def test_upload_package(stderr, stdout):
    with HTTMock(upload_packages_mock):
        tool = PackageTool()
        server = Server('localhost')

        status = tool.execute(
            server, ['package', 'upload', 'tests/test_data/mock_package.zip'])
        eq_(0, status)
        eq_([
            "my_packages", "mock-package", "1.0",
            "Tue, 29 Sep 2015 16:20:59 -0400"
        ],
            untab(stdout.getvalue())[0])
        eq_('', stderr.getvalue())