appsignal / appsignal-python

🟦 AppSignal for Python package
https://www.appsignal.com/
MIT License
6 stars 2 forks source link

Ask for the push API key again when validation fails #197

Closed unflxw closed 8 months ago

unflxw commented 8 months ago

Greet before asking questions

It's just common courtesy.

Do not use @cached_property for prompts

Using @cached_property to define these prompting functions (which are, fundamentally, not really properties at all) makes it a lot harder to reason about what happens when you invoke them. Furthermore, as far as I'm aware, there's no documented way to clear the cache for a cached property.

This change is, in the wise words of Mickey Mouse, "a surprise tool that will help us later".

Ask for the push API key again if it's invalid

If the push API key does not validate, ask for it again instead of kicking the user out of the installer.

Move the logic out of the install command and to its own function. Spice it up with some emojis (they're free!)

Handle unexpected validation errors

Handle unexpected validation errors, such as AppSignal's servers not being reachable.

Test asking again for API key

Make it so that the mock_input context manager can indicate the expectation of an unanswered prompt by using None instead of an answer.

When this happens, the expected StopIteration that indicates that a prompt was asked for which no answer was given is not raised as an error.

Delete several duplicates of mock_input and move it to a single utils.py file.

backlog-helper[bot] commented 8 months ago

Hi @unflxw,

We've found some issues with your Pull Request.


New issue guide | Backlog management | Rules | Feedback