Пример #1
0
    def test_token(self, monkeypatch):
        """Tests that if a token was given as a command line argument then
        configuration takes place accordingly."""
        with monkeypatch.context() as m:
            mock_store_account = MockStoreAccount()
            m.setattr(cli, "store_account", mock_store_account.store_account)

            args = MockArgs()
            args.token = "SomeToken"

            cli.configure(args)
            assert mock_store_account.kwargs == {"authentication_token": "SomeToken"}
Пример #2
0
    def test_configuration_wizard(self, monkeypatch):
        """Tests that if no token was given as a command line argument then
        configuration takes place using the configuration_wizard function."""
        with monkeypatch.context() as m:
            mock_store_account = MockStoreAccount()
            m.setattr(cli, "configuration_wizard", lambda: cli.create_config()["api"])
            m.setattr(cli, "store_account", mock_store_account.store_account)

            args = MockArgs()
            args.token = False

            cli.configure(args)
            assert mock_store_account.kwargs == EXPECTED_KWARGS