Exemple #1
0
def test_register_default(emitter, fake_confirmation_prompt,
                          fake_store_register):
    fake_confirmation_prompt.return_value = True

    cmd = commands.StoreRegisterCommand(None)

    cmd.run(
        argparse.Namespace(store_id=None,
                           private=False,
                           yes=False,
                           **{"snap-name": "test-snap"}))

    assert fake_store_register.mock_calls == [
        call(ANY, "test-snap", is_private=False, store_id=None)
    ]
    emitter.assert_message("Registered 'test-snap'")
    assert fake_confirmation_prompt.mock_calls == [
        call(
            dedent("""\
        We always want to ensure that users get the software they expect
        for a particular name.

        If needed, we will rename snaps to ensure that a particular name
        reflects the software most widely expected by our community.

        For example, most people would expect 'thunderbird' to be published by
        Mozilla. They would also expect to be able to get other snaps of
        Thunderbird as '$username-thunderbird'.

        Would you say that MOST users will expect 'test-snap' to come from
        you, and be the software you intend to publish there?"""))
    ]
Exemple #2
0
def test_register_store_id(emitter, fake_store_register):
    cmd = commands.StoreRegisterCommand(None)

    cmd.run(
        argparse.Namespace(store_id="1234",
                           private=False,
                           yes=True,
                           **{"snap-name": "test-snap"}))

    assert fake_store_register.mock_calls == [
        call(ANY, "test-snap", is_private=False, store_id="1234")
    ]
    emitter.assert_message("Registered 'test-snap'")
Exemple #3
0
def test_register_private(emitter, fake_store_register):
    cmd = commands.StoreRegisterCommand(None)

    cmd.run(
        argparse.Namespace(store_id=None,
                           private=True,
                           yes=False,
                           **{"snap-name": "test-snap"}))

    assert fake_store_register.mock_calls == []
    emitter.assert_progress(
        dedent("""\
            Even though this is private snap, you should think carefully about
            the choice of name and make sure you are confident nobody else will
            have a stronger claim to that particular name. If you are unsure
            then we suggest you prefix the name with your developer identity,
            As '$username-yoyodyne-www-site-content'."""),
        permanent=True,
    )
    emitter.assert_message("Snap name 'test-snap' not registered", )