Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reddit object creation in the test suite is messy #1766

Open
gsidebo opened this issue Jan 24, 2019 · 0 comments
Open

Reddit object creation in the test suite is messy #1766

gsidebo opened this issue Jan 24, 2019 · 0 comments
Assignees

Comments

@gsidebo
Copy link
Contributor

gsidebo commented Jan 24, 2019

We seem to have a few different implementations for creating fake reddit objects in our tests. Each one is suited to a limited set of use cases, and none of them are very friendly in terms of configuration/customization. Some examples:

  1. Dummy SimpleNamespace object with properties that can't be specifically set: https://github.com/mitodl/open-discussions/blob/master/fixtures/reddit.py#L115
  2. Simple class that takes kwargs and sets properties: https://github.com/mitodl/open-discussions/blob/master/channels/factories.py#L78 (this seems to tack on some extra properties that don't exist on reddit objects)
  3. Setting specific reddit properties on a Mock object: https://github.com/mitodl/open-discussions/blob/master/channels/api_test.py#L624

We should make some honest factory classes for these objects. The LOC impact from these different implementations is pretty severe, and the test suite is much harder to understand because of it.

@gsidebo gsidebo changed the title Mock reddit object creation for tests is messy Reddit object creation in the test suite is messy Jan 24, 2019
@rhysyngsun rhysyngsun self-assigned this Jan 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants