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

Define and use Stream data fixture from conftest #1115

Merged
merged 3 commits into from
Aug 8, 2021

Conversation

zee-bit
Copy link
Member

@zee-bit zee-bit commented Aug 8, 2021

What does this PR do?
This PR defines the general_stream and secret_stream dictionaries in conftest to pytest fixtures, allowing us to re-use them in tests that need stream data. The defined fixtures are currently used in tests for StreamInfo popup.

Tested?

  • Manually
  • Existing tests (adapted, if necessary)
  • New tests added (for any new behavior)
  • Passed linting & tests (each commit)

Commit flow

  • refactor: conftest: Define general_stream and secret_stream as fixtures.
  • conftest: Add rendered_description field to stream fixtures.
  • tests: popups: Use stream fixture instead of defining custom streams.

Interactions

@zulipbot zulipbot added the size: XL [Automatic label added by zulipbot] label Aug 8, 2021
This commit re-defines two dictionaries, general_stream and secret_stream
as fixtures, so that they can be re-used individually in tests that demand
a single stream fixture. This refactor will be particularly useful in the
future for testing different behaviors of StreamInfo popup.
This commit adds the missing "rendered_description" field to stream
fixtures so that they contain the full set of required fields for
StreamInfo view. This will allow the fixture to be used for testing
different behaviors of the StreamInfo popup.
@zee-bit zee-bit force-pushed the streamdata-to-fixture branch 3 times, most recently from a6c65d4 to 84316c3 Compare August 8, 2021 21:00
This commit refactors test functions within TestStreamInfo to use the
general_stream fixture from conftest, instead of defining custom stream
dictionaries inside the test body.

This will be helpful when we add typing in test_popups.py, plus we get
to re-use the defined fixtures which prevents code duplication.
The commit also filters out a few unused parameters in the test functions.
@zulipbot
Copy link
Member

zulipbot commented Aug 8, 2021

Hello @zulip/server-refactoring members, this pull request was labeled with the "area: refactoring" label, so you may want to check it out!

@neiljp
Copy link
Collaborator

neiljp commented Aug 8, 2021

@zee-bit Thanks for the reworked & extended prep from #880 - merging now 🎉

@neiljp neiljp merged commit 7d9855e into zulip:main Aug 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: refactoring area: tests size: XL [Automatic label added by zulipbot]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants