# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2016 Continuum Analytics, Inc.
#
# May be copied and distributed freely only as part of an Anaconda or
# Miniconda installation.
# -----------------------------------------------------------------------------
from click.testing import CliRunner
import pytest

from .base import VCR
from anaconda_enterprise.cli.main import group


@pytest.mark.integration
@VCR.use_cassette()
def test_upload_empty():
    runner = CliRunner()
    result = runner.invoke(group, ['login'], 'derek\nderek')
    assert result.exit_code == 0

    result = runner.invoke(
        group,
        ['upload', '--channel', 'test1'], )

    assert result.output == '''\
No packages uploaded.
'''
    assert result.exit_code == 0


@pytest.mark.integration
@VCR.use_cassette()
def test_upload_empty_with_default_channel(config):
    runner = CliRunner()
    runner.invoke(group, ['config', 'set', 'default_channel', 'test1'])
    result = runner.invoke(group, ['login'], 'derek\nderek')
    assert result.exit_code == 0

    result = runner.invoke(group, ['upload'])

    assert result.output == '''\
No packages uploaded.
'''
    assert result.exit_code == 0
