Skip to content
This repository was archived by the owner on Sep 18, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions gist/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@
import os
import pathlib
import platform
import re
import shlex
import struct
import subprocess
Expand Down Expand Up @@ -182,10 +181,6 @@ class GistEmptyTokenError(GistError):
pass


class GistInvalidTokenError(GistError):
pass


class UserError(Exception):
pass

Expand Down Expand Up @@ -286,13 +281,7 @@ def get_personal_access_token(config):
except configparser.NoOptionError:
raise GistMissingTokenError("Missing 'token' field in configuration")

token = get_value_from_command(value)

match = re.match(r"[0-9a-fA-F]+$", token)
if match is None:
raise GistInvalidTokenError("Invalid personal access token")

return token
return get_value_from_command(value)


def alternative_editor(default):
Expand Down
7 changes: 0 additions & 7 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ def test_get_personal_access_token_empty(config, token):
gist.client.get_personal_access_token(config)


@pytest.mark.parametrize("token", ["123 123", "foo"])
def test_get_personal_access_token_invalid(config, token):
config.set("gist", "token", token)
with pytest.raises(gist.client.GistInvalidTokenError):
gist.client.get_personal_access_token(config)


@pytest.mark.parametrize("token", [" 123 ", "123abcABC0987"])
def test_get_personal_access_token_valid(config, token):
config.set("gist", "token", token)
Expand Down