bird-house / bird-house/twitcher

Avoid using code only for testing purposes

Open
#66 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
15
Forks
5
Avg merge
4d 14h
Merged PRs (30d)
4

Description

I believe that the following code should be simplified to only do what it is supposed to do.

https://github.com/bird-house/twitcher/blob/fe51e8f8adcab59daebd4003acbda6dae2d0b5dd/twitcher/models/__init__.py#L53-L82

For testing, the `mock` module should be used to do exactly what the docstring says.
I think that creating a decorator function that does this mocking as required would be the best approach, as it would allow to do something like so:
```
@mock_db
def test_something():
...
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with twitcher/models/__init__.py at the linked lines and read the surrounding docstring and test-related behavior. Check how the current code is used by the tests, then determine the smallest change that keeps production code focused and moves database mocking into a reusable decorator. Done means the documented behavior remains covered by passing tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.