예제 #1
0
def test_arch(emitter, fake_store_get_status_map, channel_map_result):
    channel_map_result.channel_map.append(
        channel_map.MappedChannel(
            channel="2.1/beta",
            architecture="s390x",
            expiration_date=None,
            revision=99,
            progressive=channel_map.Progressive(paused=None,
                                                percentage=None,
                                                current_percentage=None),
        ))
    channel_map_result.revisions.append(
        channel_map.Revision(architectures=["s390x"],
                             revision=99,
                             version="10"))
    fake_store_get_status_map.return_value = channel_map_result

    cmd = commands.StoreStatusCommand(None)

    cmd.run(argparse.Namespace(
        name="test-snap",
        arch=["s390x"],
        track=None,
    ))

    emitter.assert_message(
        "Track    Arch    Channel    Version    Revision    Progress\n"
        "2.1      s390x   stable     -          -           -\n"
        "                 candidate  -          -           -\n"
        "                 beta       10         99          -\n"
        "                 edge       ↑          ↑           -")
예제 #2
0
def test_progressive_unknown(emitter, fake_store_get_status_map,
                             channel_map_result):
    channel_map_result.channel_map[0].progressive.percentage = 10.0
    channel_map_result.channel_map[0].progressive.current_percentage = None
    fake_store_get_status_map.return_value = channel_map_result

    cmd = commands.StoreStatusCommand(None)

    cmd.run(argparse.Namespace(
        name="test-snap",
        arch=None,
        track=None,
    ))

    emitter.assert_message(
        "Track    Arch    Channel    Version    Revision    Progress\n"
        "2.1      amd64   stable     -          -           -\n"
        "                 candidate  -          -           -\n"
        "                 beta       -          -           -\n"
        "                            10         19          ?→10%\n"
        "                 edge       ↑          ↑           -\n"
        "2.0      amd64   stable     -          -           -\n"
        "                 candidate  -          -           -\n"
        "                 beta       10         18          -\n"
        "                 edge       ↑          ↑           -")
예제 #3
0
def test_following(emitter, fake_store_get_status_map, channel_map_result):
    channel_map_result.channel_map = [
        channel_map.MappedChannel(
            channel="2.1/stable",
            architecture="amd64",
            expiration_date="2020-02-03T20:58:37Z",
            revision=20,
            progressive=channel_map.Progressive(paused=None,
                                                percentage=None,
                                                current_percentage=None),
        )
    ]
    channel_map_result.revisions.append(
        channel_map.Revision(architectures=["amd64"],
                             revision=20,
                             version="10"))
    fake_store_get_status_map.return_value = channel_map_result

    cmd = commands.StoreStatusCommand(None)

    cmd.run(argparse.Namespace(
        name="test-snap",
        arch=None,
        track=None,
    ))

    emitter.assert_message(
        "Track    Arch    Channel    Version    Revision    Progress\n"
        "2.1      amd64   stable     10         20          -\n"
        "                 candidate  ↑          ↑           -\n"
        "                 beta       ↑          ↑           -\n"
        "                 edge       ↑          ↑           -"
        "")
예제 #4
0
def test_no_releases(emitter, fake_store_get_status_map, channel_map_result):
    channel_map_result.channel_map = []

    cmd = commands.StoreStatusCommand(None)

    cmd.run(argparse.Namespace(
        name="test-snap",
        arch=None,
        track=None,
    ))

    emitter.assert_message("This snap has no released revisions")
예제 #5
0
def test_track(emitter, fake_store_get_status_map):
    cmd = commands.StoreStatusCommand(None)

    cmd.run(argparse.Namespace(
        name="test-snap",
        arch=None,
        track=["2.0"],
    ))

    emitter.assert_message(
        "Track    Arch    Channel    Version    Revision    Progress\n"
        "2.0      amd64   stable     -          -           -\n"
        "                 candidate  -          -           -\n"
        "                 beta       10         18          -\n"
        "                 edge       ↑          ↑           -")
예제 #6
0
def test_progressive_branch(emitter, fake_store_get_status_map,
                            channel_map_result):
    channel_map_result.channel_map.append(
        channel_map.MappedChannel(
            channel="2.1/stable/hotfix1",
            architecture="amd64",
            expiration_date="2020-02-03T20:58:37Z",
            revision=20,
            progressive=channel_map.Progressive(paused=None,
                                                percentage=20.0,
                                                current_percentage=12.3),
        ))
    channel_map_result.revisions.append(
        channel_map.Revision(architectures=["am64"],
                             revision=20,
                             version="10hotfix"))
    channel_map_result.snap.channels.append(
        channel_map.SnapChannel(
            name="2.1/stable/hotfix1",
            track="2.1",
            risk="stable",
            branch="hotfix1",
            fallback="2.1/stable",
        ))
    fake_store_get_status_map.return_value = channel_map_result

    cmd = commands.StoreStatusCommand(None)

    cmd.run(argparse.Namespace(
        name="test-snap",
        arch=None,
        track=None,
    ))

    emitter.assert_message(
        "Track    Arch    Channel         Version    Revision    Progress    Expires at\n"
        "2.1      amd64   stable          -          -           -           -\n"
        "                 stable/hotfix1  10hotfix   20          12→20%      2020-02-03T20:58:37Z\n"
        "                 candidate       -          -           -           -\n"
        "                 beta            10         19          -           -\n"
        "                 edge            ↑          ↑           -           -\n"
        "2.0      amd64   stable          -          -           -           -\n"
        "                 candidate       -          -           -           -\n"
        "                 beta            10         18          -           -\n"
        "                 edge            ↑          ↑           -           -"
    )
예제 #7
0
def test_default(emitter):
    cmd = commands.StoreStatusCommand(None)

    cmd.run(argparse.Namespace(
        name="test-snap",
        arch=None,
        track=None,
    ))

    emitter.assert_message(
        "Track    Arch    Channel    Version    Revision    Progress\n"
        "2.1      amd64   stable     -          -           -\n"
        "                 candidate  -          -           -\n"
        "                 beta       10         19          -\n"
        "                 edge       ↑          ↑           -\n"
        "2.0      amd64   stable     -          -           -\n"
        "                 candidate  -          -           -\n"
        "                 beta       10         18          -\n"
        "                 edge       ↑          ↑           -")