示例#1
0
def test_list_packages(stdout):
    with HTTMock(packages_mock):
        tool = packages.PackagesTool()
        server = Server('localhost')

        tool.execute(server, ['packages', 'list'])
        eq_(EXPECTED_LIST, stdout.getvalue())
示例#2
0
def test_install_package(stderr, stdout):
    with HTTMock(packages_mock):
        tool = packages.PackagesTool()
        server = Server('localhost')

        status = tool.execute(server, ['packages', 'install', 'mock_package'])
        eq_(0, status)
        eq_('Package Installed\n', stdout.getvalue())
        eq_('', stderr.getvalue())
示例#3
0
def test_upload_package(stderr, stdout):
    with HTTMock(upload_packages_mock):
        tool = packages.PackagesTool()
        server = Server('localhost')

        status = tool.execute(
            server, ['packages', 'upload', 'tests/test_data/mock_package.zip'])
        eq_(0, status)
        eq_('my_packages\tmock-package\t1.0\n', stdout.getvalue())
        eq_('', stderr.getvalue())
示例#4
0
def test_list_packages(stdout):
    with HTTMock(packages_mock):
        tool = packages.PackagesTool()
        server = Server('localhost')

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

        i = 0
        for line in EXPECTED_LIST:
            eq_(line, untab(stdout.getvalue())[i])
            i += 1
示例#5
0
def test_install_package_raw(stderr, stdout):
    with HTTMock(packages_mock):
        tool = packages.PackagesTool()
        server = Server('localhost')

        status = tool.execute(server,
                              ['packages', 'install', '--raw', 'mock_package'])
        eq_(0, status)
        eq_('{"success": true, "msg": "Package Installed"}\n',
            stdout.getvalue())
        eq_('', stderr.getvalue())
示例#6
0
def test_upload_package_raw(stderr, stdout):
    with HTTMock(upload_packages_mock):
        tool = packages.PackagesTool()
        server = Server('localhost')

        status = tool.execute(server, [
            'packages', 'upload', '--raw', 'tests/test_data/mock_package.zip'
        ])
        eq_(0, status)
        eq_('', stderr.getvalue())
        eq_(True, len(stdout.getvalue()) > 0)
示例#7
0
def test_upload_package(stderr, stdout):
    with HTTMock(upload_packages_mock):
        tool = packages.PackagesTool()
        server = Server('localhost')

        status = tool.execute(
            server, ['packages', '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())