analytics tests: Save recipient in stream object.

At the time of creating streams in test_counts.py we earlier did not saved
recipient in the stream object.

stream.recipient is used in many functions so they would throw error.

The right long-term fix here is probably to just use the standard
stream creation functions rather than having a hacky duplicate
here.
This commit is contained in:
arpit551 2020-06-08 18:36:19 +05:30 committed by Tim Abbott
parent 07fa25dcd3
commit fb2aae1c02
1 changed files with 2 additions and 0 deletions

View File

@ -77,6 +77,8 @@ class AnalyticsTestCase(TestCase):
kwargs[key] = kwargs.get(key, value)
stream = Stream.objects.create(**kwargs)
recipient = Recipient.objects.create(type_id=stream.id, type=Recipient.STREAM)
stream.recipient = recipient
stream.save(update_fields=["recipient"])
return stream, recipient
def create_huddle_with_recipient(self, **kwargs: Any) -> Tuple[Huddle, Recipient]: