From d80c52473c9564b3676d8da60b095b6c7c2362b1 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Wed, 30 Sep 2020 23:00:29 +0200 Subject: [PATCH 001/253] Fix collector default values --- src/newsreader/news/collection/favicon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/newsreader/news/collection/favicon.py b/src/newsreader/news/collection/favicon.py index 639e7f6..1ca21e6 100644 --- a/src/newsreader/news/collection/favicon.py +++ b/src/newsreader/news/collection/favicon.py @@ -126,7 +126,7 @@ class FaviconCollector(Collector): feed_client, favicon_client = (FeedClient, FaviconClient) url_builder, favicon_builder = (WebsiteURLBuilder, FaviconBuilder) - def collect(self, rules=None): + def collect(self, rules=[]): streams = [] with self.feed_client(rules=rules) as client: From b183612a369d390ce329736e8d540bcb09b80689 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Wed, 30 Sep 2020 23:00:37 +0200 Subject: [PATCH 002/253] Remove old commands --- .../news/collection/management/commands/collect.py | 11 ----------- .../collection/management/commands/fetch_favicons.py | 11 ----------- 2 files changed, 22 deletions(-) delete mode 100644 src/newsreader/news/collection/management/commands/collect.py delete mode 100644 src/newsreader/news/collection/management/commands/fetch_favicons.py diff --git a/src/newsreader/news/collection/management/commands/collect.py b/src/newsreader/news/collection/management/commands/collect.py deleted file mode 100644 index 7d928f0..0000000 --- a/src/newsreader/news/collection/management/commands/collect.py +++ /dev/null @@ -1,11 +0,0 @@ -from django.core.management.base import BaseCommand - -from newsreader.news.collection.feed import FeedCollector - - -class Command(BaseCommand): - help = "Collects Atom/RSS feeds" - - def handle(self, *args, **options): - collector = FeedCollector() - collector.collect() diff --git a/src/newsreader/news/collection/management/commands/fetch_favicons.py b/src/newsreader/news/collection/management/commands/fetch_favicons.py deleted file mode 100644 index 1ee96cf..0000000 --- a/src/newsreader/news/collection/management/commands/fetch_favicons.py +++ /dev/null @@ -1,11 +0,0 @@ -from django.core.management.base import BaseCommand - -from newsreader.news.collection.favicon import FaviconCollector - - -class Command(BaseCommand): - help = "Fetch favicons for collection rules" - - def handle(self, *args, **options): - collector = FaviconCollector() - collector.collect() From ab81b06e6daa4c24d0b11d452f00778a2860d274 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Wed, 30 Sep 2020 23:32:28 +0200 Subject: [PATCH 003/253] Add fetch favicon task & split account urls --- .../accounts/components/settings-form.html | 7 +- .../accounts/views/password-change.html | 2 +- .../templates/accounts/views/reddit.html | 2 +- .../templates/accounts/views/twitter.html | 2 +- src/newsreader/accounts/urls.py | 81 ++++++++++--------- src/newsreader/accounts/views/__init__.py | 1 + src/newsreader/accounts/views/favicon.py | 26 ++++++ src/newsreader/accounts/views/integrations.py | 16 ++-- src/newsreader/news/collection/tasks.py | 30 +++++++ src/newsreader/templates/base.html | 2 +- 10 files changed, 118 insertions(+), 51 deletions(-) create mode 100644 src/newsreader/accounts/views/favicon.py diff --git a/src/newsreader/accounts/templates/accounts/components/settings-form.html b/src/newsreader/accounts/templates/accounts/components/settings-form.html index 51d4450..26bd08f 100644 --- a/src/newsreader/accounts/templates/accounts/components/settings-form.html +++ b/src/newsreader/accounts/templates/accounts/components/settings-form.html @@ -7,7 +7,12 @@ {% trans "Change password" %} - + + + {% trans "Fetch favicons" %} + + + {% trans "Third party integrations" %} diff --git a/src/newsreader/accounts/templates/accounts/views/password-change.html b/src/newsreader/accounts/templates/accounts/views/password-change.html index fb8a98b..5e7b103 100644 --- a/src/newsreader/accounts/templates/accounts/views/password-change.html +++ b/src/newsreader/accounts/templates/accounts/views/password-change.html @@ -2,7 +2,7 @@ {% block content %}
- {% url 'accounts:settings' as cancel_url %} + {% url 'accounts:settings:settings' as cancel_url %} {% include "components/form/form.html" with form=form title="Change password" confirm_text="Change password" cancel_url=cancel_url %}
{% endblock %} diff --git a/src/newsreader/accounts/templates/accounts/views/reddit.html b/src/newsreader/accounts/templates/accounts/views/reddit.html index 5d4f539..353ca72 100644 --- a/src/newsreader/accounts/templates/accounts/views/reddit.html +++ b/src/newsreader/accounts/templates/accounts/views/reddit.html @@ -13,7 +13,7 @@ {% endif %}

- {% trans "Return to integrations page" %} + {% trans "Return to integrations page" %}

diff --git a/src/newsreader/accounts/templates/accounts/views/twitter.html b/src/newsreader/accounts/templates/accounts/views/twitter.html index e2c51aa..6df1a97 100644 --- a/src/newsreader/accounts/templates/accounts/views/twitter.html +++ b/src/newsreader/accounts/templates/accounts/views/twitter.html @@ -13,7 +13,7 @@ {% endif %}

- {% trans "Return to integrations page" %} + {% trans "Return to integrations page" %}

diff --git a/src/newsreader/accounts/urls.py b/src/newsreader/accounts/urls.py index 3cdd1b1..188c236 100644 --- a/src/newsreader/accounts/urls.py +++ b/src/newsreader/accounts/urls.py @@ -1,10 +1,11 @@ from django.contrib.auth.decorators import login_required -from django.urls import path +from django.urls import include, path from newsreader.accounts.views import ( ActivationCompleteView, ActivationResendView, ActivationView, + FaviconRedirectView, IntegrationsView, LoginView, LogoutView, @@ -26,6 +27,46 @@ from newsreader.accounts.views import ( ) +settings_patterns = [ + # Integrations + path( + "integrations/reddit/callback/", + login_required(RedditTemplateView.as_view()), + name="reddit-template", + ), + path( + "integrations/reddit/refresh/", + login_required(RedditTokenRedirectView.as_view()), + name="reddit-refresh", + ), + path( + "integrations/reddit/revoke/", + login_required(RedditRevokeRedirectView.as_view()), + name="reddit-revoke", + ), + path( + "integrations/twitter/auth/", + login_required(TwitterAuthRedirectView.as_view()), + name="twitter-auth", + ), + path( + "integrations/twitter/callback/", + login_required(TwitterTemplateView.as_view()), + name="twitter-template", + ), + path( + "integrations/twitter/revoke/", + login_required(TwitterRevokeRedirectView.as_view()), + name="twitter-revoke", + ), + path( + "integrations/", login_required(IntegrationsView.as_view()), name="integrations" + ), + # Misc + path("favicon/", login_required(FaviconRedirectView.as_view()), name="favicon"), + path("", login_required(SettingsView.as_view()), name="settings"), +] + urlpatterns = [ # Auth path("login/", LoginView.as_view(), name="login"), @@ -70,42 +111,6 @@ urlpatterns = [ login_required(PasswordChangeView.as_view()), name="password-change", ), - # Integrations - path( - "settings/integrations/reddit/callback/", - login_required(RedditTemplateView.as_view()), - name="reddit-template", - ), - path( - "settings/integrations/reddit/refresh/", - login_required(RedditTokenRedirectView.as_view()), - name="reddit-refresh", - ), - path( - "settings/integrations/reddit/revoke/", - login_required(RedditRevokeRedirectView.as_view()), - name="reddit-revoke", - ), - path( - "settings/integrations/twitter/auth/", - login_required(TwitterAuthRedirectView.as_view()), - name="twitter-auth", - ), - path( - "settings/integrations/twitter/callback/", - login_required(TwitterTemplateView.as_view()), - name="twitter-template", - ), - path( - "settings/integrations/twitter/revoke/", - login_required(TwitterRevokeRedirectView.as_view()), - name="twitter-revoke", - ), - path( - "settings/integrations", - login_required(IntegrationsView.as_view()), - name="integrations", - ), # Settings - path("settings/", login_required(SettingsView.as_view()), name="settings"), + path("settings/", include((settings_patterns, "settings"))), ] diff --git a/src/newsreader/accounts/views/__init__.py b/src/newsreader/accounts/views/__init__.py index 81dd1fc..3be2b81 100644 --- a/src/newsreader/accounts/views/__init__.py +++ b/src/newsreader/accounts/views/__init__.py @@ -1,4 +1,5 @@ from newsreader.accounts.views.auth import LoginView, LogoutView +from newsreader.accounts.views.favicon import FaviconRedirectView from newsreader.accounts.views.integrations import ( IntegrationsView, RedditRevokeRedirectView, diff --git a/src/newsreader/accounts/views/favicon.py b/src/newsreader/accounts/views/favicon.py new file mode 100644 index 0000000..1f99495 --- /dev/null +++ b/src/newsreader/accounts/views/favicon.py @@ -0,0 +1,26 @@ +from django.contrib import messages +from django.core.cache import cache +from django.urls import reverse_lazy +from django.utils.translation import gettext as _ +from django.views.generic import RedirectView + +from newsreader.news.collection.tasks import FaviconTask + + +class FaviconRedirectView(RedirectView): + url = reverse_lazy("accounts:settings:integrations") + + def get(self, request, *args, **kwargs): + response = super().get(request, *args, **kwargs) + + user = request.user + task_active = cache.get(f"{user.email}-favicon-task") + + if not task_active: + FaviconTask.delay(user.pk) + messages.success(request, _("Favicons are being fetched")) + cache.set(f"{user.email}-favicon-task", 1, 18000) # 5 hours + return response + + messages.error(request, _("Limit reached, try again later")) + return response diff --git a/src/newsreader/accounts/views/integrations.py b/src/newsreader/accounts/views/integrations.py index 62d71fc..e6ed605 100644 --- a/src/newsreader/accounts/views/integrations.py +++ b/src/newsreader/accounts/views/integrations.py @@ -53,7 +53,7 @@ class IntegrationsView(TemplateView): and not user.reddit_access_token and not reddit_task_active ): - reddit_refresh_url = reverse_lazy("accounts:reddit-refresh") + reddit_refresh_url = reverse_lazy("accounts:settings:reddit-refresh") if not user.reddit_refresh_token: reddit_authorization_url = get_reddit_authorization_url(user) @@ -62,7 +62,7 @@ class IntegrationsView(TemplateView): "reddit_authorization_url": reddit_authorization_url, "reddit_refresh_url": reddit_refresh_url, "reddit_revoke_url": ( - reverse_lazy("accounts:reddit-revoke") + reverse_lazy("accounts:settings:reddit-revoke") if not reddit_authorization_url else None ), @@ -72,10 +72,10 @@ class IntegrationsView(TemplateView): twitter_revoke_url = None if self.request.user.has_twitter_auth: - twitter_revoke_url = reverse_lazy("accounts:twitter-revoke") + twitter_revoke_url = reverse_lazy("accounts:settings:twitter-revoke") return { - "twitter_auth_url": reverse_lazy("accounts:twitter-auth"), + "twitter_auth_url": reverse_lazy("accounts:settings:twitter-auth"), "twitter_revoke_url": twitter_revoke_url, } @@ -130,7 +130,7 @@ class RedditTemplateView(TemplateView): class RedditTokenRedirectView(RedirectView): - url = reverse_lazy("accounts:integrations") + url = reverse_lazy("accounts:settings:integrations") def get(self, request, *args, **kwargs): response = super().get(request, *args, **kwargs) @@ -149,7 +149,7 @@ class RedditTokenRedirectView(RedirectView): class RedditRevokeRedirectView(RedirectView): - url = reverse_lazy("accounts:integrations") + url = reverse_lazy("accounts:settings:integrations") def get(self, request, *args, **kwargs): response = super().get(request, *args, **kwargs) @@ -181,7 +181,7 @@ class RedditRevokeRedirectView(RedirectView): class TwitterRevokeRedirectView(RedirectView): - url = reverse_lazy("accounts:integrations") + url = reverse_lazy("accounts:settings:integrations") def get(self, request, *args, **kwargs): if not request.user.has_twitter_auth: @@ -212,7 +212,7 @@ class TwitterRevokeRedirectView(RedirectView): class TwitterAuthRedirectView(RedirectView): - url = reverse_lazy("accounts:integrations") + url = reverse_lazy("accounts:settings:integrations") def get(self, request, *args, **kwargs): oauth = OAuth( diff --git a/src/newsreader/news/collection/tasks.py b/src/newsreader/news/collection/tasks.py index 926b05b..752217a 100644 --- a/src/newsreader/news/collection/tasks.py +++ b/src/newsreader/news/collection/tasks.py @@ -147,7 +147,37 @@ class TwitterTimelineTask(app.Task): raise Reject(reason="Task already running", requeue=False) +class FaviconTask(app.Task): + name = "FaviconTask" + ignore_result = True + + def run(self, user_pk): + from newsreader.news.collection.favicon import FaviconCollector + + try: + user = User.objects.get(pk=user_pk) + except ObjectDoesNotExist: + message = f"User {user_pk} does not exist" + logger.exception(message) + + raise Reject(reason=message, requeue=False) + + with MemCacheLock("f{user.email}-favicon-task", self.app.oid) as acquired: + if acquired: + logger.info(f"Running favicon task for user {user_pk}") + + rules = user.rules.enabled() + + collector = FaviconCollector() + collector.collect(rules=rules) + else: + logger.warning(f"Cancelling task due to existing lock") + + raise Reject(reason="Task already running", requeue=False) + + FeedTask = app.register_task(FeedTask()) +FaviconTask = app.register_task(FaviconTask()) RedditTask = app.register_task(RedditTask()) RedditTokenTask = app.register_task(RedditTokenTask()) TwitterTimelineTask = app.register_task(TwitterTimelineTask()) diff --git a/src/newsreader/templates/base.html b/src/newsreader/templates/base.html index 3f677c0..ef5c190 100644 --- a/src/newsreader/templates/base.html +++ b/src/newsreader/templates/base.html @@ -17,7 +17,7 @@ - + {% if request.user.is_superuser %} {% endif %} From 0f30b61445424b6ca37015494ecdb8a85300a848 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Sat, 3 Oct 2020 21:33:12 +0200 Subject: [PATCH 004/253] Only run task for feed type rules & redirect to settings --- src/newsreader/accounts/views/favicon.py | 2 +- src/newsreader/news/collection/tasks.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/newsreader/accounts/views/favicon.py b/src/newsreader/accounts/views/favicon.py index 1f99495..b1084d6 100644 --- a/src/newsreader/accounts/views/favicon.py +++ b/src/newsreader/accounts/views/favicon.py @@ -8,7 +8,7 @@ from newsreader.news.collection.tasks import FaviconTask class FaviconRedirectView(RedirectView): - url = reverse_lazy("accounts:settings:integrations") + url = reverse_lazy("accounts:settings:settings") def get(self, request, *args, **kwargs): response = super().get(request, *args, **kwargs) diff --git a/src/newsreader/news/collection/tasks.py b/src/newsreader/news/collection/tasks.py index 752217a..b37adf2 100644 --- a/src/newsreader/news/collection/tasks.py +++ b/src/newsreader/news/collection/tasks.py @@ -166,7 +166,7 @@ class FaviconTask(app.Task): if acquired: logger.info(f"Running favicon task for user {user_pk}") - rules = user.rules.enabled() + rules = user.rules.enabled().filter(type=RuleTypeChoices.feed) collector = FaviconCollector() collector.collect(rules=rules) From b2927151ef7d2835a5ab5d8d342698cf8dbe0be6 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Sat, 3 Oct 2020 21:39:29 +0200 Subject: [PATCH 005/253] Disable fetch button during timeout period --- .../accounts/components/settings-form.html | 16 +++++++++++----- src/newsreader/accounts/views/settings.py | 9 +++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/newsreader/accounts/templates/accounts/components/settings-form.html b/src/newsreader/accounts/templates/accounts/components/settings-form.html index 26bd08f..f5e7065 100644 --- a/src/newsreader/accounts/templates/accounts/components/settings-form.html +++ b/src/newsreader/accounts/templates/accounts/components/settings-form.html @@ -4,19 +4,25 @@ {% block actions %}
+ {% include "components/form/confirm-button.html" %} + {% trans "Change password" %} - - {% trans "Fetch favicons" %} - + {% if favicon_task_allowed %} + + {% trans "Fetch favicons" %} + + {% else %} + + {% endif %} {% trans "Third party integrations" %} - - {% include "components/form/confirm-button.html" %}
{% endblock actions %} diff --git a/src/newsreader/accounts/views/settings.py b/src/newsreader/accounts/views/settings.py index 1603252..eb0b215 100644 --- a/src/newsreader/accounts/views/settings.py +++ b/src/newsreader/accounts/views/settings.py @@ -1,3 +1,4 @@ +from django.core.cache import cache from django.urls import reverse_lazy from django.views.generic.edit import FormView, ModelFormMixin @@ -19,6 +20,14 @@ class SettingsView(ModelFormMixin, FormView): self.object = self.get_object() return super().get(request, *args, **kwargs) + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + + return { + **context, + "favicon_task_allowed": not cache.get(f"{self.request.user}-favicon-task"), + } + def get_object(self, **kwargs): return self.request.user From f394d185a1d1fef83d6e5ba0344051c3da86f6ae Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Tue, 6 Oct 2020 20:20:23 +0200 Subject: [PATCH 006/253] Add tests for redirect view & update url --- .../accounts/views/password-change.html | 2 +- src/newsreader/accounts/tests/test_favicon.py | 37 +++++++++++++++++++ src/newsreader/accounts/urls.py | 2 +- src/newsreader/accounts/views/favicon.py | 2 +- src/newsreader/templates/base.html | 2 +- 5 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 src/newsreader/accounts/tests/test_favicon.py diff --git a/src/newsreader/accounts/templates/accounts/views/password-change.html b/src/newsreader/accounts/templates/accounts/views/password-change.html index 5e7b103..d6eb918 100644 --- a/src/newsreader/accounts/templates/accounts/views/password-change.html +++ b/src/newsreader/accounts/templates/accounts/views/password-change.html @@ -2,7 +2,7 @@ {% block content %}
- {% url 'accounts:settings:settings' as cancel_url %} + {% url 'accounts:settings:home' as cancel_url %} {% include "components/form/form.html" with form=form title="Change password" confirm_text="Change password" cancel_url=cancel_url %}
{% endblock %} diff --git a/src/newsreader/accounts/tests/test_favicon.py b/src/newsreader/accounts/tests/test_favicon.py new file mode 100644 index 0000000..d3eb56b --- /dev/null +++ b/src/newsreader/accounts/tests/test_favicon.py @@ -0,0 +1,37 @@ +from unittest.mock import patch + +from django.core.cache import cache +from django.test import TestCase +from django.urls import reverse + +from newsreader.accounts.tests.factories import UserFactory + + +class FaviconRedirectViewTestCase(TestCase): + def setUp(self): + self.user = UserFactory(email="test@test.nl", password="test") + self.client.force_login(self.user) + + self.patch = patch("newsreader.accounts.views.favicon.FaviconTask") + self.mocked_task = self.patch.start() + + def tearDown(self): + cache.clear() + + def test_simple(self): + response = self.client.get(reverse("accounts:settings:favicon")) + + self.assertRedirects(response, reverse("accounts:settings:home")) + + self.mocked_task.delay.assert_called_once_with(self.user.pk) + + self.assertEqual(1, cache.get(f"{self.user.email}-favicon-task")) + + def test_not_active(self): + cache.set(f"{self.user.email}-favicon-task", 1) + + response = self.client.get(reverse("accounts:settings:favicon")) + + self.assertRedirects(response, reverse("accounts:settings:home")) + + self.mocked_task.delay.assert_not_called() diff --git a/src/newsreader/accounts/urls.py b/src/newsreader/accounts/urls.py index 188c236..0eaee5c 100644 --- a/src/newsreader/accounts/urls.py +++ b/src/newsreader/accounts/urls.py @@ -64,7 +64,7 @@ settings_patterns = [ ), # Misc path("favicon/", login_required(FaviconRedirectView.as_view()), name="favicon"), - path("", login_required(SettingsView.as_view()), name="settings"), + path("", login_required(SettingsView.as_view()), name="home"), ] urlpatterns = [ diff --git a/src/newsreader/accounts/views/favicon.py b/src/newsreader/accounts/views/favicon.py index b1084d6..1b85399 100644 --- a/src/newsreader/accounts/views/favicon.py +++ b/src/newsreader/accounts/views/favicon.py @@ -8,7 +8,7 @@ from newsreader.news.collection.tasks import FaviconTask class FaviconRedirectView(RedirectView): - url = reverse_lazy("accounts:settings:settings") + url = reverse_lazy("accounts:settings:home") def get(self, request, *args, **kwargs): response = super().get(request, *args, **kwargs) diff --git a/src/newsreader/templates/base.html b/src/newsreader/templates/base.html index ef5c190..efaf9f2 100644 --- a/src/newsreader/templates/base.html +++ b/src/newsreader/templates/base.html @@ -17,7 +17,7 @@ - + {% if request.user.is_superuser %} {% endif %} From b65c3b9fb840cf72e63661f4aa7e14abe8cd2ca7 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Tue, 6 Oct 2020 20:33:19 +0200 Subject: [PATCH 007/253] Use default favicons for twitter/subreddit rules --- src/newsreader/news/collection/tasks.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/newsreader/news/collection/tasks.py b/src/newsreader/news/collection/tasks.py index b37adf2..b82bf66 100644 --- a/src/newsreader/news/collection/tasks.py +++ b/src/newsreader/news/collection/tasks.py @@ -170,6 +170,18 @@ class FaviconTask(app.Task): collector = FaviconCollector() collector.collect(rules=rules) + + third_party_rules = user.rules.enabled().exclude( + type=RuleTypeChoices.feed + ) + + for rule in third_party_rules: + if rule.type == RuleTypeChoices.subreddit: + rule.favicon = "https://www.reddit.com/favicon.ico" + rule.save() + elif rule.type == RuleTypeChoices.twitter_timeline: + rule.favicon = "https://abs.twimg.com/favicons/favicon.ico" + rule.save() else: logger.warning(f"Cancelling task due to existing lock") From 379e741f6d6a8595f5f06cff5c871d3c06822670 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Tue, 6 Oct 2020 20:44:36 +0200 Subject: [PATCH 008/253] Update urls after urlconf change --- .../accounts/tests/test_integrations.py | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/newsreader/accounts/tests/test_integrations.py b/src/newsreader/accounts/tests/test_integrations.py index cdc9546..ffeea42 100644 --- a/src/newsreader/accounts/tests/test_integrations.py +++ b/src/newsreader/accounts/tests/test_integrations.py @@ -22,7 +22,7 @@ class IntegrationsViewTestCase(TestCase): self.user = UserFactory(email="test@test.nl", password="test") self.client.force_login(self.user) - self.url = reverse("accounts:integrations") + self.url = reverse("accounts:settings:integrations") class RedditIntegrationsTestCase(IntegrationsViewTestCase): @@ -69,7 +69,7 @@ class RedditTemplateViewTestCase(TestCase): self.user = UserFactory(email="test@test.nl", password="test") self.client.force_login(self.user) - self.base_url = reverse("accounts:reddit-template") + self.base_url = reverse("accounts:settings:reddit-template") self.state = str(uuid4()) self.patch = patch("newsreader.news.collection.reddit.post") @@ -190,9 +190,9 @@ class RedditTokenRedirectViewTestCase(TestCase): cache.clear() def test_simple(self): - response = self.client.get(reverse("accounts:reddit-refresh")) + response = self.client.get(reverse("accounts:settings:reddit-refresh")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.mocked_task.delay.assert_called_once_with(self.user.pk) @@ -201,9 +201,9 @@ class RedditTokenRedirectViewTestCase(TestCase): def test_not_active(self): cache.set(f"{self.user.email}-reddit-refresh", 1) - response = self.client.get(reverse("accounts:reddit-refresh")) + response = self.client.get(reverse("accounts:settings:reddit-refresh")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.mocked_task.delay.assert_not_called() @@ -223,9 +223,9 @@ class RedditRevokeRedirectViewTestCase(TestCase): self.mocked_revoke.return_value = True - response = self.client.get(reverse("accounts:reddit-revoke")) + response = self.client.get(reverse("accounts:settings:reddit-revoke")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.mocked_revoke.assert_called_once_with(self.user) @@ -238,9 +238,9 @@ class RedditRevokeRedirectViewTestCase(TestCase): self.user.reddit_refresh_token = None self.user.save() - response = self.client.get(reverse("accounts:reddit-revoke")) + response = self.client.get(reverse("accounts:settings:reddit-revoke")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.mocked_revoke.assert_not_called() @@ -251,9 +251,9 @@ class RedditRevokeRedirectViewTestCase(TestCase): self.mocked_revoke.return_value = False - response = self.client.get(reverse("accounts:reddit-revoke")) + response = self.client.get(reverse("accounts:settings:reddit-revoke")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settigns:integrations")) self.user.refresh_from_db() @@ -267,9 +267,9 @@ class RedditRevokeRedirectViewTestCase(TestCase): self.mocked_revoke.side_effect = StreamException - response = self.client.get(reverse("accounts:reddit-revoke")) + response = self.client.get(reverse("accounts:settings:reddit-revoke")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.user.refresh_from_db() @@ -293,9 +293,9 @@ class TwitterRevokeRedirectView(TestCase): self.user.twitter_oauth_token_secret = "jadajadajada" self.user.save() - response = self.client.get(reverse("accounts:twitter-revoke")) + response = self.client.get(reverse("accounts:settings:twitter-revoke")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.user.refresh_from_db() @@ -307,9 +307,9 @@ class TwitterRevokeRedirectView(TestCase): self.user.twitter_oauth_token_secret = None self.user.save() - response = self.client.get(reverse("accounts:twitter-revoke")) + response = self.client.get(reverse("accounts:settings:twitter-revoke")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.mocked_post.assert_not_called() @@ -320,9 +320,9 @@ class TwitterRevokeRedirectView(TestCase): self.mocked_post.side_effect = StreamException - response = self.client.get(reverse("accounts:twitter-revoke")) + response = self.client.get(reverse("accounts:settings:twitter-revoke")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.user.refresh_from_db() @@ -346,7 +346,7 @@ class TwitterAuthRedirectViewTestCase(TestCase): text="oauth_token=foo&oauth_token_secret=bar" ) - response = self.client.get(reverse("accounts:twitter-auth")) + response = self.client.get(reverse("accounts:settings:twitter-auth")) self.assertRedirects( response, @@ -363,9 +363,9 @@ class TwitterAuthRedirectViewTestCase(TestCase): def test_stream_exception(self): self.mocked_post.side_effect = StreamException - response = self.client.get(reverse("accounts:twitter-auth")) + response = self.client.get(reverse("accounts:settings:twitter-auth")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) cached_token = cache.get(f"twitter-{self.user.email}-token") cached_secret = cache.get(f"twitter-{self.user.email}-secret") @@ -376,9 +376,9 @@ class TwitterAuthRedirectViewTestCase(TestCase): def test_unexpected_contents(self): self.mocked_post.return_value = Mock(text="foo=bar&oauth_token_secret=bar") - response = self.client.get(reverse("accounts:twitter-auth")) + response = self.client.get(reverse("accounts:settings:twitter-auth")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) cached_token = cache.get(f"twitter-{self.user.email}-token") cached_secret = cache.get(f"twitter-{self.user.email}-secret") @@ -413,7 +413,7 @@ class TwitterTemplateViewTestCase(TestCase): ) response = self.client.get( - f"{reverse('accounts:twitter-template')}?{urlencode(params)}" + f"{reverse('accounts:settings:twitter-template')}?{urlencode(params)}" ) self.assertContains(response, _("Twitter account is linked")) @@ -430,7 +430,7 @@ class TwitterTemplateViewTestCase(TestCase): params = {"denied": "true", "oauth_token": "foo", "oauth_verifier": "barfoo"} response = self.client.get( - f"{reverse('accounts:twitter-template')}?{urlencode(params)}" + f"{reverse('accounts:settings:twitter-template')}?{urlencode(params)}" ) self.assertContains(response, _("Twitter authorization failed")) @@ -453,7 +453,7 @@ class TwitterTemplateViewTestCase(TestCase): params = {"denied": "", "oauth_token": "boo", "oauth_verifier": "barfoo"} response = self.client.get( - f"{reverse('accounts:twitter-template')}?{urlencode(params)}" + f"{reverse('accounts:settings:twitter-template')}?{urlencode(params)}" ) self.assertContains(response, _("OAuth tokens failed to match")) @@ -471,7 +471,7 @@ class TwitterTemplateViewTestCase(TestCase): params = {"denied": "", "oauth_token": "foo", "oauth_verifier": "barfoo"} response = self.client.get( - f"{reverse('accounts:twitter-template')}?{urlencode(params)}" + f"{reverse('accounts:settings:twitter-template')}?{urlencode(params)}" ) self.assertContains(response, _("No matching tokens found for this user")) @@ -495,7 +495,7 @@ class TwitterTemplateViewTestCase(TestCase): self.mocked_post.side_effect = StreamException response = self.client.get( - f"{reverse('accounts:twitter-template')}?{urlencode(params)}" + f"{reverse('accounts:settings:twitter-template')}?{urlencode(params)}" ) self.assertContains(response, _("Failed requesting access token")) @@ -523,7 +523,7 @@ class TwitterTemplateViewTestCase(TestCase): ) response = self.client.get( - f"{reverse('accounts:twitter-template')}?{urlencode(params)}" + f"{reverse('accounts:settings:twitter-template')}?{urlencode(params)}" ) self.assertContains(response, _("No credentials found in Twitter response")) From deb0d9bc63bc1cc431a771dfc7f0510a3dfffc2d Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Tue, 6 Oct 2020 20:49:56 +0200 Subject: [PATCH 009/253] Fix remaining tests --- src/newsreader/accounts/tests/test_integrations.py | 2 +- src/newsreader/accounts/tests/test_settings.py | 6 +++--- src/newsreader/accounts/views/settings.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/newsreader/accounts/tests/test_integrations.py b/src/newsreader/accounts/tests/test_integrations.py index ffeea42..fbee223 100644 --- a/src/newsreader/accounts/tests/test_integrations.py +++ b/src/newsreader/accounts/tests/test_integrations.py @@ -253,7 +253,7 @@ class RedditRevokeRedirectViewTestCase(TestCase): response = self.client.get(reverse("accounts:settings:reddit-revoke")) - self.assertRedirects(response, reverse("accounts:settigns:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.user.refresh_from_db() diff --git a/src/newsreader/accounts/tests/test_settings.py b/src/newsreader/accounts/tests/test_settings.py index 42db736..5a12637 100644 --- a/src/newsreader/accounts/tests/test_settings.py +++ b/src/newsreader/accounts/tests/test_settings.py @@ -10,7 +10,7 @@ class SettingsViewTestCase(TestCase): self.user = UserFactory(email="test@test.nl", password="test") self.client.force_login(self.user) - self.url = reverse("accounts:settings") + self.url = reverse("accounts:settings:home") def test_simple(self): response = self.client.get(self.url) @@ -19,13 +19,13 @@ class SettingsViewTestCase(TestCase): def test_user_credential_change(self): response = self.client.post( - reverse("accounts:settings"), + reverse("accounts:settings:home"), {"first_name": "First name", "last_name": "Last name"}, ) user = User.objects.get() - self.assertRedirects(response, reverse("accounts:settings")) + self.assertRedirects(response, reverse("accounts:settings:home")) self.assertEquals(user.first_name, "First name") self.assertEquals(user.last_name, "Last name") diff --git a/src/newsreader/accounts/views/settings.py b/src/newsreader/accounts/views/settings.py index eb0b215..aac24fb 100644 --- a/src/newsreader/accounts/views/settings.py +++ b/src/newsreader/accounts/views/settings.py @@ -12,7 +12,7 @@ from newsreader.news.collection.reddit import ( class SettingsView(ModelFormMixin, FormView): template_name = "accounts/views/settings.html" - success_url = reverse_lazy("accounts:settings") + success_url = reverse_lazy("accounts:settings:home") form_class = UserSettingsForm model = User From 48388a47f6d4a596afbb2281a78efddcc879304e Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Tue, 6 Oct 2020 22:06:19 +0200 Subject: [PATCH 010/253] Add user runnable favicon task --- .../accounts/components/settings-form.html | 17 +++- .../accounts/views/password-change.html | 2 +- .../templates/accounts/views/reddit.html | 2 +- .../templates/accounts/views/twitter.html | 2 +- src/newsreader/accounts/tests/test_favicon.py | 37 +++++++++ .../accounts/tests/test_integrations.py | 62 +++++++------- .../accounts/tests/test_settings.py | 4 +- src/newsreader/accounts/urls.py | 81 ++++++++++--------- src/newsreader/accounts/views/__init__.py | 1 + src/newsreader/accounts/views/favicon.py | 26 ++++++ src/newsreader/accounts/views/integrations.py | 16 ++-- src/newsreader/accounts/views/settings.py | 9 +++ src/newsreader/news/collection/favicon.py | 2 +- .../collection/management/commands/collect.py | 11 --- .../management/commands/fetch_favicons.py | 11 --- src/newsreader/news/collection/tasks.py | 42 ++++++++++ src/newsreader/templates/base.html | 2 +- 17 files changed, 218 insertions(+), 109 deletions(-) create mode 100644 src/newsreader/accounts/tests/test_favicon.py create mode 100644 src/newsreader/accounts/views/favicon.py delete mode 100644 src/newsreader/news/collection/management/commands/collect.py delete mode 100644 src/newsreader/news/collection/management/commands/fetch_favicons.py diff --git a/src/newsreader/accounts/templates/accounts/components/settings-form.html b/src/newsreader/accounts/templates/accounts/components/settings-form.html index 51d4450..f5e7065 100644 --- a/src/newsreader/accounts/templates/accounts/components/settings-form.html +++ b/src/newsreader/accounts/templates/accounts/components/settings-form.html @@ -4,14 +4,25 @@ {% block actions %}
+ {% include "components/form/confirm-button.html" %} + {% trans "Change password" %} - + + {% if favicon_task_allowed %} + + {% trans "Fetch favicons" %} + + {% else %} + + {% endif %} + + {% trans "Third party integrations" %} - - {% include "components/form/confirm-button.html" %}
{% endblock actions %} diff --git a/src/newsreader/accounts/templates/accounts/views/password-change.html b/src/newsreader/accounts/templates/accounts/views/password-change.html index fb8a98b..d6eb918 100644 --- a/src/newsreader/accounts/templates/accounts/views/password-change.html +++ b/src/newsreader/accounts/templates/accounts/views/password-change.html @@ -2,7 +2,7 @@ {% block content %}
- {% url 'accounts:settings' as cancel_url %} + {% url 'accounts:settings:home' as cancel_url %} {% include "components/form/form.html" with form=form title="Change password" confirm_text="Change password" cancel_url=cancel_url %}
{% endblock %} diff --git a/src/newsreader/accounts/templates/accounts/views/reddit.html b/src/newsreader/accounts/templates/accounts/views/reddit.html index 5d4f539..353ca72 100644 --- a/src/newsreader/accounts/templates/accounts/views/reddit.html +++ b/src/newsreader/accounts/templates/accounts/views/reddit.html @@ -13,7 +13,7 @@ {% endif %}

- {% trans "Return to integrations page" %} + {% trans "Return to integrations page" %}

diff --git a/src/newsreader/accounts/templates/accounts/views/twitter.html b/src/newsreader/accounts/templates/accounts/views/twitter.html index e2c51aa..6df1a97 100644 --- a/src/newsreader/accounts/templates/accounts/views/twitter.html +++ b/src/newsreader/accounts/templates/accounts/views/twitter.html @@ -13,7 +13,7 @@ {% endif %}

- {% trans "Return to integrations page" %} + {% trans "Return to integrations page" %}

diff --git a/src/newsreader/accounts/tests/test_favicon.py b/src/newsreader/accounts/tests/test_favicon.py new file mode 100644 index 0000000..d3eb56b --- /dev/null +++ b/src/newsreader/accounts/tests/test_favicon.py @@ -0,0 +1,37 @@ +from unittest.mock import patch + +from django.core.cache import cache +from django.test import TestCase +from django.urls import reverse + +from newsreader.accounts.tests.factories import UserFactory + + +class FaviconRedirectViewTestCase(TestCase): + def setUp(self): + self.user = UserFactory(email="test@test.nl", password="test") + self.client.force_login(self.user) + + self.patch = patch("newsreader.accounts.views.favicon.FaviconTask") + self.mocked_task = self.patch.start() + + def tearDown(self): + cache.clear() + + def test_simple(self): + response = self.client.get(reverse("accounts:settings:favicon")) + + self.assertRedirects(response, reverse("accounts:settings:home")) + + self.mocked_task.delay.assert_called_once_with(self.user.pk) + + self.assertEqual(1, cache.get(f"{self.user.email}-favicon-task")) + + def test_not_active(self): + cache.set(f"{self.user.email}-favicon-task", 1) + + response = self.client.get(reverse("accounts:settings:favicon")) + + self.assertRedirects(response, reverse("accounts:settings:home")) + + self.mocked_task.delay.assert_not_called() diff --git a/src/newsreader/accounts/tests/test_integrations.py b/src/newsreader/accounts/tests/test_integrations.py index cdc9546..fbee223 100644 --- a/src/newsreader/accounts/tests/test_integrations.py +++ b/src/newsreader/accounts/tests/test_integrations.py @@ -22,7 +22,7 @@ class IntegrationsViewTestCase(TestCase): self.user = UserFactory(email="test@test.nl", password="test") self.client.force_login(self.user) - self.url = reverse("accounts:integrations") + self.url = reverse("accounts:settings:integrations") class RedditIntegrationsTestCase(IntegrationsViewTestCase): @@ -69,7 +69,7 @@ class RedditTemplateViewTestCase(TestCase): self.user = UserFactory(email="test@test.nl", password="test") self.client.force_login(self.user) - self.base_url = reverse("accounts:reddit-template") + self.base_url = reverse("accounts:settings:reddit-template") self.state = str(uuid4()) self.patch = patch("newsreader.news.collection.reddit.post") @@ -190,9 +190,9 @@ class RedditTokenRedirectViewTestCase(TestCase): cache.clear() def test_simple(self): - response = self.client.get(reverse("accounts:reddit-refresh")) + response = self.client.get(reverse("accounts:settings:reddit-refresh")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.mocked_task.delay.assert_called_once_with(self.user.pk) @@ -201,9 +201,9 @@ class RedditTokenRedirectViewTestCase(TestCase): def test_not_active(self): cache.set(f"{self.user.email}-reddit-refresh", 1) - response = self.client.get(reverse("accounts:reddit-refresh")) + response = self.client.get(reverse("accounts:settings:reddit-refresh")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.mocked_task.delay.assert_not_called() @@ -223,9 +223,9 @@ class RedditRevokeRedirectViewTestCase(TestCase): self.mocked_revoke.return_value = True - response = self.client.get(reverse("accounts:reddit-revoke")) + response = self.client.get(reverse("accounts:settings:reddit-revoke")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.mocked_revoke.assert_called_once_with(self.user) @@ -238,9 +238,9 @@ class RedditRevokeRedirectViewTestCase(TestCase): self.user.reddit_refresh_token = None self.user.save() - response = self.client.get(reverse("accounts:reddit-revoke")) + response = self.client.get(reverse("accounts:settings:reddit-revoke")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.mocked_revoke.assert_not_called() @@ -251,9 +251,9 @@ class RedditRevokeRedirectViewTestCase(TestCase): self.mocked_revoke.return_value = False - response = self.client.get(reverse("accounts:reddit-revoke")) + response = self.client.get(reverse("accounts:settings:reddit-revoke")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.user.refresh_from_db() @@ -267,9 +267,9 @@ class RedditRevokeRedirectViewTestCase(TestCase): self.mocked_revoke.side_effect = StreamException - response = self.client.get(reverse("accounts:reddit-revoke")) + response = self.client.get(reverse("accounts:settings:reddit-revoke")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.user.refresh_from_db() @@ -293,9 +293,9 @@ class TwitterRevokeRedirectView(TestCase): self.user.twitter_oauth_token_secret = "jadajadajada" self.user.save() - response = self.client.get(reverse("accounts:twitter-revoke")) + response = self.client.get(reverse("accounts:settings:twitter-revoke")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.user.refresh_from_db() @@ -307,9 +307,9 @@ class TwitterRevokeRedirectView(TestCase): self.user.twitter_oauth_token_secret = None self.user.save() - response = self.client.get(reverse("accounts:twitter-revoke")) + response = self.client.get(reverse("accounts:settings:twitter-revoke")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.mocked_post.assert_not_called() @@ -320,9 +320,9 @@ class TwitterRevokeRedirectView(TestCase): self.mocked_post.side_effect = StreamException - response = self.client.get(reverse("accounts:twitter-revoke")) + response = self.client.get(reverse("accounts:settings:twitter-revoke")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.user.refresh_from_db() @@ -346,7 +346,7 @@ class TwitterAuthRedirectViewTestCase(TestCase): text="oauth_token=foo&oauth_token_secret=bar" ) - response = self.client.get(reverse("accounts:twitter-auth")) + response = self.client.get(reverse("accounts:settings:twitter-auth")) self.assertRedirects( response, @@ -363,9 +363,9 @@ class TwitterAuthRedirectViewTestCase(TestCase): def test_stream_exception(self): self.mocked_post.side_effect = StreamException - response = self.client.get(reverse("accounts:twitter-auth")) + response = self.client.get(reverse("accounts:settings:twitter-auth")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) cached_token = cache.get(f"twitter-{self.user.email}-token") cached_secret = cache.get(f"twitter-{self.user.email}-secret") @@ -376,9 +376,9 @@ class TwitterAuthRedirectViewTestCase(TestCase): def test_unexpected_contents(self): self.mocked_post.return_value = Mock(text="foo=bar&oauth_token_secret=bar") - response = self.client.get(reverse("accounts:twitter-auth")) + response = self.client.get(reverse("accounts:settings:twitter-auth")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) cached_token = cache.get(f"twitter-{self.user.email}-token") cached_secret = cache.get(f"twitter-{self.user.email}-secret") @@ -413,7 +413,7 @@ class TwitterTemplateViewTestCase(TestCase): ) response = self.client.get( - f"{reverse('accounts:twitter-template')}?{urlencode(params)}" + f"{reverse('accounts:settings:twitter-template')}?{urlencode(params)}" ) self.assertContains(response, _("Twitter account is linked")) @@ -430,7 +430,7 @@ class TwitterTemplateViewTestCase(TestCase): params = {"denied": "true", "oauth_token": "foo", "oauth_verifier": "barfoo"} response = self.client.get( - f"{reverse('accounts:twitter-template')}?{urlencode(params)}" + f"{reverse('accounts:settings:twitter-template')}?{urlencode(params)}" ) self.assertContains(response, _("Twitter authorization failed")) @@ -453,7 +453,7 @@ class TwitterTemplateViewTestCase(TestCase): params = {"denied": "", "oauth_token": "boo", "oauth_verifier": "barfoo"} response = self.client.get( - f"{reverse('accounts:twitter-template')}?{urlencode(params)}" + f"{reverse('accounts:settings:twitter-template')}?{urlencode(params)}" ) self.assertContains(response, _("OAuth tokens failed to match")) @@ -471,7 +471,7 @@ class TwitterTemplateViewTestCase(TestCase): params = {"denied": "", "oauth_token": "foo", "oauth_verifier": "barfoo"} response = self.client.get( - f"{reverse('accounts:twitter-template')}?{urlencode(params)}" + f"{reverse('accounts:settings:twitter-template')}?{urlencode(params)}" ) self.assertContains(response, _("No matching tokens found for this user")) @@ -495,7 +495,7 @@ class TwitterTemplateViewTestCase(TestCase): self.mocked_post.side_effect = StreamException response = self.client.get( - f"{reverse('accounts:twitter-template')}?{urlencode(params)}" + f"{reverse('accounts:settings:twitter-template')}?{urlencode(params)}" ) self.assertContains(response, _("Failed requesting access token")) @@ -523,7 +523,7 @@ class TwitterTemplateViewTestCase(TestCase): ) response = self.client.get( - f"{reverse('accounts:twitter-template')}?{urlencode(params)}" + f"{reverse('accounts:settings:twitter-template')}?{urlencode(params)}" ) self.assertContains(response, _("No credentials found in Twitter response")) diff --git a/src/newsreader/accounts/tests/test_settings.py b/src/newsreader/accounts/tests/test_settings.py index 42db736..df09289 100644 --- a/src/newsreader/accounts/tests/test_settings.py +++ b/src/newsreader/accounts/tests/test_settings.py @@ -10,7 +10,7 @@ class SettingsViewTestCase(TestCase): self.user = UserFactory(email="test@test.nl", password="test") self.client.force_login(self.user) - self.url = reverse("accounts:settings") + self.url = reverse("accounts:settings:home") def test_simple(self): response = self.client.get(self.url) @@ -25,7 +25,7 @@ class SettingsViewTestCase(TestCase): user = User.objects.get() - self.assertRedirects(response, reverse("accounts:settings")) + self.assertRedirects(response, reverse("accounts:settings:home")) self.assertEquals(user.first_name, "First name") self.assertEquals(user.last_name, "Last name") diff --git a/src/newsreader/accounts/urls.py b/src/newsreader/accounts/urls.py index 3cdd1b1..0eaee5c 100644 --- a/src/newsreader/accounts/urls.py +++ b/src/newsreader/accounts/urls.py @@ -1,10 +1,11 @@ from django.contrib.auth.decorators import login_required -from django.urls import path +from django.urls import include, path from newsreader.accounts.views import ( ActivationCompleteView, ActivationResendView, ActivationView, + FaviconRedirectView, IntegrationsView, LoginView, LogoutView, @@ -26,6 +27,46 @@ from newsreader.accounts.views import ( ) +settings_patterns = [ + # Integrations + path( + "integrations/reddit/callback/", + login_required(RedditTemplateView.as_view()), + name="reddit-template", + ), + path( + "integrations/reddit/refresh/", + login_required(RedditTokenRedirectView.as_view()), + name="reddit-refresh", + ), + path( + "integrations/reddit/revoke/", + login_required(RedditRevokeRedirectView.as_view()), + name="reddit-revoke", + ), + path( + "integrations/twitter/auth/", + login_required(TwitterAuthRedirectView.as_view()), + name="twitter-auth", + ), + path( + "integrations/twitter/callback/", + login_required(TwitterTemplateView.as_view()), + name="twitter-template", + ), + path( + "integrations/twitter/revoke/", + login_required(TwitterRevokeRedirectView.as_view()), + name="twitter-revoke", + ), + path( + "integrations/", login_required(IntegrationsView.as_view()), name="integrations" + ), + # Misc + path("favicon/", login_required(FaviconRedirectView.as_view()), name="favicon"), + path("", login_required(SettingsView.as_view()), name="home"), +] + urlpatterns = [ # Auth path("login/", LoginView.as_view(), name="login"), @@ -70,42 +111,6 @@ urlpatterns = [ login_required(PasswordChangeView.as_view()), name="password-change", ), - # Integrations - path( - "settings/integrations/reddit/callback/", - login_required(RedditTemplateView.as_view()), - name="reddit-template", - ), - path( - "settings/integrations/reddit/refresh/", - login_required(RedditTokenRedirectView.as_view()), - name="reddit-refresh", - ), - path( - "settings/integrations/reddit/revoke/", - login_required(RedditRevokeRedirectView.as_view()), - name="reddit-revoke", - ), - path( - "settings/integrations/twitter/auth/", - login_required(TwitterAuthRedirectView.as_view()), - name="twitter-auth", - ), - path( - "settings/integrations/twitter/callback/", - login_required(TwitterTemplateView.as_view()), - name="twitter-template", - ), - path( - "settings/integrations/twitter/revoke/", - login_required(TwitterRevokeRedirectView.as_view()), - name="twitter-revoke", - ), - path( - "settings/integrations", - login_required(IntegrationsView.as_view()), - name="integrations", - ), # Settings - path("settings/", login_required(SettingsView.as_view()), name="settings"), + path("settings/", include((settings_patterns, "settings"))), ] diff --git a/src/newsreader/accounts/views/__init__.py b/src/newsreader/accounts/views/__init__.py index 81dd1fc..3be2b81 100644 --- a/src/newsreader/accounts/views/__init__.py +++ b/src/newsreader/accounts/views/__init__.py @@ -1,4 +1,5 @@ from newsreader.accounts.views.auth import LoginView, LogoutView +from newsreader.accounts.views.favicon import FaviconRedirectView from newsreader.accounts.views.integrations import ( IntegrationsView, RedditRevokeRedirectView, diff --git a/src/newsreader/accounts/views/favicon.py b/src/newsreader/accounts/views/favicon.py new file mode 100644 index 0000000..1b85399 --- /dev/null +++ b/src/newsreader/accounts/views/favicon.py @@ -0,0 +1,26 @@ +from django.contrib import messages +from django.core.cache import cache +from django.urls import reverse_lazy +from django.utils.translation import gettext as _ +from django.views.generic import RedirectView + +from newsreader.news.collection.tasks import FaviconTask + + +class FaviconRedirectView(RedirectView): + url = reverse_lazy("accounts:settings:home") + + def get(self, request, *args, **kwargs): + response = super().get(request, *args, **kwargs) + + user = request.user + task_active = cache.get(f"{user.email}-favicon-task") + + if not task_active: + FaviconTask.delay(user.pk) + messages.success(request, _("Favicons are being fetched")) + cache.set(f"{user.email}-favicon-task", 1, 18000) # 5 hours + return response + + messages.error(request, _("Limit reached, try again later")) + return response diff --git a/src/newsreader/accounts/views/integrations.py b/src/newsreader/accounts/views/integrations.py index 62d71fc..e6ed605 100644 --- a/src/newsreader/accounts/views/integrations.py +++ b/src/newsreader/accounts/views/integrations.py @@ -53,7 +53,7 @@ class IntegrationsView(TemplateView): and not user.reddit_access_token and not reddit_task_active ): - reddit_refresh_url = reverse_lazy("accounts:reddit-refresh") + reddit_refresh_url = reverse_lazy("accounts:settings:reddit-refresh") if not user.reddit_refresh_token: reddit_authorization_url = get_reddit_authorization_url(user) @@ -62,7 +62,7 @@ class IntegrationsView(TemplateView): "reddit_authorization_url": reddit_authorization_url, "reddit_refresh_url": reddit_refresh_url, "reddit_revoke_url": ( - reverse_lazy("accounts:reddit-revoke") + reverse_lazy("accounts:settings:reddit-revoke") if not reddit_authorization_url else None ), @@ -72,10 +72,10 @@ class IntegrationsView(TemplateView): twitter_revoke_url = None if self.request.user.has_twitter_auth: - twitter_revoke_url = reverse_lazy("accounts:twitter-revoke") + twitter_revoke_url = reverse_lazy("accounts:settings:twitter-revoke") return { - "twitter_auth_url": reverse_lazy("accounts:twitter-auth"), + "twitter_auth_url": reverse_lazy("accounts:settings:twitter-auth"), "twitter_revoke_url": twitter_revoke_url, } @@ -130,7 +130,7 @@ class RedditTemplateView(TemplateView): class RedditTokenRedirectView(RedirectView): - url = reverse_lazy("accounts:integrations") + url = reverse_lazy("accounts:settings:integrations") def get(self, request, *args, **kwargs): response = super().get(request, *args, **kwargs) @@ -149,7 +149,7 @@ class RedditTokenRedirectView(RedirectView): class RedditRevokeRedirectView(RedirectView): - url = reverse_lazy("accounts:integrations") + url = reverse_lazy("accounts:settings:integrations") def get(self, request, *args, **kwargs): response = super().get(request, *args, **kwargs) @@ -181,7 +181,7 @@ class RedditRevokeRedirectView(RedirectView): class TwitterRevokeRedirectView(RedirectView): - url = reverse_lazy("accounts:integrations") + url = reverse_lazy("accounts:settings:integrations") def get(self, request, *args, **kwargs): if not request.user.has_twitter_auth: @@ -212,7 +212,7 @@ class TwitterRevokeRedirectView(RedirectView): class TwitterAuthRedirectView(RedirectView): - url = reverse_lazy("accounts:integrations") + url = reverse_lazy("accounts:settings:integrations") def get(self, request, *args, **kwargs): oauth = OAuth( diff --git a/src/newsreader/accounts/views/settings.py b/src/newsreader/accounts/views/settings.py index 1603252..eb0b215 100644 --- a/src/newsreader/accounts/views/settings.py +++ b/src/newsreader/accounts/views/settings.py @@ -1,3 +1,4 @@ +from django.core.cache import cache from django.urls import reverse_lazy from django.views.generic.edit import FormView, ModelFormMixin @@ -19,6 +20,14 @@ class SettingsView(ModelFormMixin, FormView): self.object = self.get_object() return super().get(request, *args, **kwargs) + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + + return { + **context, + "favicon_task_allowed": not cache.get(f"{self.request.user}-favicon-task"), + } + def get_object(self, **kwargs): return self.request.user diff --git a/src/newsreader/news/collection/favicon.py b/src/newsreader/news/collection/favicon.py index 639e7f6..1ca21e6 100644 --- a/src/newsreader/news/collection/favicon.py +++ b/src/newsreader/news/collection/favicon.py @@ -126,7 +126,7 @@ class FaviconCollector(Collector): feed_client, favicon_client = (FeedClient, FaviconClient) url_builder, favicon_builder = (WebsiteURLBuilder, FaviconBuilder) - def collect(self, rules=None): + def collect(self, rules=[]): streams = [] with self.feed_client(rules=rules) as client: diff --git a/src/newsreader/news/collection/management/commands/collect.py b/src/newsreader/news/collection/management/commands/collect.py deleted file mode 100644 index 7d928f0..0000000 --- a/src/newsreader/news/collection/management/commands/collect.py +++ /dev/null @@ -1,11 +0,0 @@ -from django.core.management.base import BaseCommand - -from newsreader.news.collection.feed import FeedCollector - - -class Command(BaseCommand): - help = "Collects Atom/RSS feeds" - - def handle(self, *args, **options): - collector = FeedCollector() - collector.collect() diff --git a/src/newsreader/news/collection/management/commands/fetch_favicons.py b/src/newsreader/news/collection/management/commands/fetch_favicons.py deleted file mode 100644 index 1ee96cf..0000000 --- a/src/newsreader/news/collection/management/commands/fetch_favicons.py +++ /dev/null @@ -1,11 +0,0 @@ -from django.core.management.base import BaseCommand - -from newsreader.news.collection.favicon import FaviconCollector - - -class Command(BaseCommand): - help = "Fetch favicons for collection rules" - - def handle(self, *args, **options): - collector = FaviconCollector() - collector.collect() diff --git a/src/newsreader/news/collection/tasks.py b/src/newsreader/news/collection/tasks.py index 926b05b..b82bf66 100644 --- a/src/newsreader/news/collection/tasks.py +++ b/src/newsreader/news/collection/tasks.py @@ -147,7 +147,49 @@ class TwitterTimelineTask(app.Task): raise Reject(reason="Task already running", requeue=False) +class FaviconTask(app.Task): + name = "FaviconTask" + ignore_result = True + + def run(self, user_pk): + from newsreader.news.collection.favicon import FaviconCollector + + try: + user = User.objects.get(pk=user_pk) + except ObjectDoesNotExist: + message = f"User {user_pk} does not exist" + logger.exception(message) + + raise Reject(reason=message, requeue=False) + + with MemCacheLock("f{user.email}-favicon-task", self.app.oid) as acquired: + if acquired: + logger.info(f"Running favicon task for user {user_pk}") + + rules = user.rules.enabled().filter(type=RuleTypeChoices.feed) + + collector = FaviconCollector() + collector.collect(rules=rules) + + third_party_rules = user.rules.enabled().exclude( + type=RuleTypeChoices.feed + ) + + for rule in third_party_rules: + if rule.type == RuleTypeChoices.subreddit: + rule.favicon = "https://www.reddit.com/favicon.ico" + rule.save() + elif rule.type == RuleTypeChoices.twitter_timeline: + rule.favicon = "https://abs.twimg.com/favicons/favicon.ico" + rule.save() + else: + logger.warning(f"Cancelling task due to existing lock") + + raise Reject(reason="Task already running", requeue=False) + + FeedTask = app.register_task(FeedTask()) +FaviconTask = app.register_task(FaviconTask()) RedditTask = app.register_task(RedditTask()) RedditTokenTask = app.register_task(RedditTokenTask()) TwitterTimelineTask = app.register_task(TwitterTimelineTask()) diff --git a/src/newsreader/templates/base.html b/src/newsreader/templates/base.html index 3f677c0..efaf9f2 100644 --- a/src/newsreader/templates/base.html +++ b/src/newsreader/templates/base.html @@ -17,7 +17,7 @@ - + {% if request.user.is_superuser %} {% endif %} From f12639987fc01ead2ec462a36061f465eed8e116 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Tue, 6 Oct 2020 22:34:24 +0200 Subject: [PATCH 011/253] Update messages styling --- src/newsreader/js/components/Messages.js | 2 +- .../scss/components/messages/_messages.scss | 31 ++++++++++++++++--- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/newsreader/js/components/Messages.js b/src/newsreader/js/components/Messages.js index 843677c..150b003 100644 --- a/src/newsreader/js/components/Messages.js +++ b/src/newsreader/js/components/Messages.js @@ -22,7 +22,7 @@ class Messages extends React.Component { ); }); - return
    {messages}
; + return
    {messages}
; } } diff --git a/src/newsreader/scss/components/messages/_messages.scss b/src/newsreader/scss/components/messages/_messages.scss index 74d88b5..b1ba9d0 100644 --- a/src/newsreader/scss/components/messages/_messages.scss +++ b/src/newsreader/scss/components/messages/_messages.scss @@ -3,12 +3,10 @@ flex-direction: column; align-items: center; - position: fixed; - top: 0; width: 100%; margin: 5px 0 20px 0; - color: $white; + color: $font-color; &__item { width: 80%; @@ -17,7 +15,7 @@ padding: 20px 15px; margin: 5px 0; - background-color: $blue; + background-color: $transparant-blue; &--error { background-color: $transparant-red; @@ -27,7 +25,6 @@ background-color: $transparant-orange; } - // TODO check this color &--success { background-color: $transparant-green; } @@ -39,4 +36,28 @@ --ggs: 2; } } + + &--fixed { + position: fixed; + top: 0; + } + + &--fixed &__item { + color: $white; + background-color: $blue; + } + + &--fixed &__item--error { + color: $white; + background-color: $red; + } + + &--fixed &__item--warning { + background-color: $orange; + } + + &--fixed &__item--success { + color: $white; + background-color: $green; + } } From 593b06006ced387c9cf0fefb8b720622d7f5c981 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Tue, 6 Oct 2020 22:37:14 +0200 Subject: [PATCH 012/253] Fix broken view --- src/newsreader/accounts/views/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/newsreader/accounts/views/settings.py b/src/newsreader/accounts/views/settings.py index eb0b215..aac24fb 100644 --- a/src/newsreader/accounts/views/settings.py +++ b/src/newsreader/accounts/views/settings.py @@ -12,7 +12,7 @@ from newsreader.news.collection.reddit import ( class SettingsView(ModelFormMixin, FormView): template_name = "accounts/views/settings.html" - success_url = reverse_lazy("accounts:settings") + success_url = reverse_lazy("accounts:settings:home") form_class = UserSettingsForm model = User From 1c3a33c1d8a4ec2c7d40633cc19acafa7d319967 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Tue, 6 Oct 2020 22:46:33 +0200 Subject: [PATCH 013/253] Fix failing test --- src/newsreader/accounts/tests/test_settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/newsreader/accounts/tests/test_settings.py b/src/newsreader/accounts/tests/test_settings.py index df09289..5a12637 100644 --- a/src/newsreader/accounts/tests/test_settings.py +++ b/src/newsreader/accounts/tests/test_settings.py @@ -19,7 +19,7 @@ class SettingsViewTestCase(TestCase): def test_user_credential_change(self): response = self.client.post( - reverse("accounts:settings"), + reverse("accounts:settings:home"), {"first_name": "First name", "last_name": "Last name"}, ) From b6921a20e732cc4165023b044e091b06ae24602d Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Tue, 6 Oct 2020 22:51:23 +0200 Subject: [PATCH 014/253] 0.3.2 - Add user runnable favicon task - Update messages styling --- .../accounts/components/settings-form.html | 17 +++- .../accounts/views/password-change.html | 2 +- .../templates/accounts/views/reddit.html | 2 +- .../templates/accounts/views/twitter.html | 2 +- src/newsreader/accounts/tests/test_favicon.py | 37 +++++++++ .../accounts/tests/test_integrations.py | 62 +++++++------- .../accounts/tests/test_settings.py | 6 +- src/newsreader/accounts/urls.py | 81 ++++++++++--------- src/newsreader/accounts/views/__init__.py | 1 + src/newsreader/accounts/views/favicon.py | 26 ++++++ src/newsreader/accounts/views/integrations.py | 16 ++-- src/newsreader/accounts/views/settings.py | 11 ++- src/newsreader/js/components/Messages.js | 2 +- src/newsreader/news/collection/favicon.py | 2 +- .../collection/management/commands/collect.py | 11 --- .../management/commands/fetch_favicons.py | 11 --- src/newsreader/news/collection/tasks.py | 42 ++++++++++ .../scss/components/messages/_messages.scss | 31 +++++-- src/newsreader/templates/base.html | 2 +- 19 files changed, 247 insertions(+), 117 deletions(-) create mode 100644 src/newsreader/accounts/tests/test_favicon.py create mode 100644 src/newsreader/accounts/views/favicon.py delete mode 100644 src/newsreader/news/collection/management/commands/collect.py delete mode 100644 src/newsreader/news/collection/management/commands/fetch_favicons.py diff --git a/src/newsreader/accounts/templates/accounts/components/settings-form.html b/src/newsreader/accounts/templates/accounts/components/settings-form.html index 51d4450..f5e7065 100644 --- a/src/newsreader/accounts/templates/accounts/components/settings-form.html +++ b/src/newsreader/accounts/templates/accounts/components/settings-form.html @@ -4,14 +4,25 @@ {% block actions %}
+ {% include "components/form/confirm-button.html" %} + {% trans "Change password" %} - + + {% if favicon_task_allowed %} + + {% trans "Fetch favicons" %} + + {% else %} + + {% endif %} + + {% trans "Third party integrations" %} - - {% include "components/form/confirm-button.html" %}
{% endblock actions %} diff --git a/src/newsreader/accounts/templates/accounts/views/password-change.html b/src/newsreader/accounts/templates/accounts/views/password-change.html index fb8a98b..d6eb918 100644 --- a/src/newsreader/accounts/templates/accounts/views/password-change.html +++ b/src/newsreader/accounts/templates/accounts/views/password-change.html @@ -2,7 +2,7 @@ {% block content %}
- {% url 'accounts:settings' as cancel_url %} + {% url 'accounts:settings:home' as cancel_url %} {% include "components/form/form.html" with form=form title="Change password" confirm_text="Change password" cancel_url=cancel_url %}
{% endblock %} diff --git a/src/newsreader/accounts/templates/accounts/views/reddit.html b/src/newsreader/accounts/templates/accounts/views/reddit.html index 5d4f539..353ca72 100644 --- a/src/newsreader/accounts/templates/accounts/views/reddit.html +++ b/src/newsreader/accounts/templates/accounts/views/reddit.html @@ -13,7 +13,7 @@ {% endif %}

- {% trans "Return to integrations page" %} + {% trans "Return to integrations page" %}

diff --git a/src/newsreader/accounts/templates/accounts/views/twitter.html b/src/newsreader/accounts/templates/accounts/views/twitter.html index e2c51aa..6df1a97 100644 --- a/src/newsreader/accounts/templates/accounts/views/twitter.html +++ b/src/newsreader/accounts/templates/accounts/views/twitter.html @@ -13,7 +13,7 @@ {% endif %}

- {% trans "Return to integrations page" %} + {% trans "Return to integrations page" %}

diff --git a/src/newsreader/accounts/tests/test_favicon.py b/src/newsreader/accounts/tests/test_favicon.py new file mode 100644 index 0000000..d3eb56b --- /dev/null +++ b/src/newsreader/accounts/tests/test_favicon.py @@ -0,0 +1,37 @@ +from unittest.mock import patch + +from django.core.cache import cache +from django.test import TestCase +from django.urls import reverse + +from newsreader.accounts.tests.factories import UserFactory + + +class FaviconRedirectViewTestCase(TestCase): + def setUp(self): + self.user = UserFactory(email="test@test.nl", password="test") + self.client.force_login(self.user) + + self.patch = patch("newsreader.accounts.views.favicon.FaviconTask") + self.mocked_task = self.patch.start() + + def tearDown(self): + cache.clear() + + def test_simple(self): + response = self.client.get(reverse("accounts:settings:favicon")) + + self.assertRedirects(response, reverse("accounts:settings:home")) + + self.mocked_task.delay.assert_called_once_with(self.user.pk) + + self.assertEqual(1, cache.get(f"{self.user.email}-favicon-task")) + + def test_not_active(self): + cache.set(f"{self.user.email}-favicon-task", 1) + + response = self.client.get(reverse("accounts:settings:favicon")) + + self.assertRedirects(response, reverse("accounts:settings:home")) + + self.mocked_task.delay.assert_not_called() diff --git a/src/newsreader/accounts/tests/test_integrations.py b/src/newsreader/accounts/tests/test_integrations.py index cdc9546..fbee223 100644 --- a/src/newsreader/accounts/tests/test_integrations.py +++ b/src/newsreader/accounts/tests/test_integrations.py @@ -22,7 +22,7 @@ class IntegrationsViewTestCase(TestCase): self.user = UserFactory(email="test@test.nl", password="test") self.client.force_login(self.user) - self.url = reverse("accounts:integrations") + self.url = reverse("accounts:settings:integrations") class RedditIntegrationsTestCase(IntegrationsViewTestCase): @@ -69,7 +69,7 @@ class RedditTemplateViewTestCase(TestCase): self.user = UserFactory(email="test@test.nl", password="test") self.client.force_login(self.user) - self.base_url = reverse("accounts:reddit-template") + self.base_url = reverse("accounts:settings:reddit-template") self.state = str(uuid4()) self.patch = patch("newsreader.news.collection.reddit.post") @@ -190,9 +190,9 @@ class RedditTokenRedirectViewTestCase(TestCase): cache.clear() def test_simple(self): - response = self.client.get(reverse("accounts:reddit-refresh")) + response = self.client.get(reverse("accounts:settings:reddit-refresh")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.mocked_task.delay.assert_called_once_with(self.user.pk) @@ -201,9 +201,9 @@ class RedditTokenRedirectViewTestCase(TestCase): def test_not_active(self): cache.set(f"{self.user.email}-reddit-refresh", 1) - response = self.client.get(reverse("accounts:reddit-refresh")) + response = self.client.get(reverse("accounts:settings:reddit-refresh")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.mocked_task.delay.assert_not_called() @@ -223,9 +223,9 @@ class RedditRevokeRedirectViewTestCase(TestCase): self.mocked_revoke.return_value = True - response = self.client.get(reverse("accounts:reddit-revoke")) + response = self.client.get(reverse("accounts:settings:reddit-revoke")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.mocked_revoke.assert_called_once_with(self.user) @@ -238,9 +238,9 @@ class RedditRevokeRedirectViewTestCase(TestCase): self.user.reddit_refresh_token = None self.user.save() - response = self.client.get(reverse("accounts:reddit-revoke")) + response = self.client.get(reverse("accounts:settings:reddit-revoke")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.mocked_revoke.assert_not_called() @@ -251,9 +251,9 @@ class RedditRevokeRedirectViewTestCase(TestCase): self.mocked_revoke.return_value = False - response = self.client.get(reverse("accounts:reddit-revoke")) + response = self.client.get(reverse("accounts:settings:reddit-revoke")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.user.refresh_from_db() @@ -267,9 +267,9 @@ class RedditRevokeRedirectViewTestCase(TestCase): self.mocked_revoke.side_effect = StreamException - response = self.client.get(reverse("accounts:reddit-revoke")) + response = self.client.get(reverse("accounts:settings:reddit-revoke")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.user.refresh_from_db() @@ -293,9 +293,9 @@ class TwitterRevokeRedirectView(TestCase): self.user.twitter_oauth_token_secret = "jadajadajada" self.user.save() - response = self.client.get(reverse("accounts:twitter-revoke")) + response = self.client.get(reverse("accounts:settings:twitter-revoke")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.user.refresh_from_db() @@ -307,9 +307,9 @@ class TwitterRevokeRedirectView(TestCase): self.user.twitter_oauth_token_secret = None self.user.save() - response = self.client.get(reverse("accounts:twitter-revoke")) + response = self.client.get(reverse("accounts:settings:twitter-revoke")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.mocked_post.assert_not_called() @@ -320,9 +320,9 @@ class TwitterRevokeRedirectView(TestCase): self.mocked_post.side_effect = StreamException - response = self.client.get(reverse("accounts:twitter-revoke")) + response = self.client.get(reverse("accounts:settings:twitter-revoke")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) self.user.refresh_from_db() @@ -346,7 +346,7 @@ class TwitterAuthRedirectViewTestCase(TestCase): text="oauth_token=foo&oauth_token_secret=bar" ) - response = self.client.get(reverse("accounts:twitter-auth")) + response = self.client.get(reverse("accounts:settings:twitter-auth")) self.assertRedirects( response, @@ -363,9 +363,9 @@ class TwitterAuthRedirectViewTestCase(TestCase): def test_stream_exception(self): self.mocked_post.side_effect = StreamException - response = self.client.get(reverse("accounts:twitter-auth")) + response = self.client.get(reverse("accounts:settings:twitter-auth")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) cached_token = cache.get(f"twitter-{self.user.email}-token") cached_secret = cache.get(f"twitter-{self.user.email}-secret") @@ -376,9 +376,9 @@ class TwitterAuthRedirectViewTestCase(TestCase): def test_unexpected_contents(self): self.mocked_post.return_value = Mock(text="foo=bar&oauth_token_secret=bar") - response = self.client.get(reverse("accounts:twitter-auth")) + response = self.client.get(reverse("accounts:settings:twitter-auth")) - self.assertRedirects(response, reverse("accounts:integrations")) + self.assertRedirects(response, reverse("accounts:settings:integrations")) cached_token = cache.get(f"twitter-{self.user.email}-token") cached_secret = cache.get(f"twitter-{self.user.email}-secret") @@ -413,7 +413,7 @@ class TwitterTemplateViewTestCase(TestCase): ) response = self.client.get( - f"{reverse('accounts:twitter-template')}?{urlencode(params)}" + f"{reverse('accounts:settings:twitter-template')}?{urlencode(params)}" ) self.assertContains(response, _("Twitter account is linked")) @@ -430,7 +430,7 @@ class TwitterTemplateViewTestCase(TestCase): params = {"denied": "true", "oauth_token": "foo", "oauth_verifier": "barfoo"} response = self.client.get( - f"{reverse('accounts:twitter-template')}?{urlencode(params)}" + f"{reverse('accounts:settings:twitter-template')}?{urlencode(params)}" ) self.assertContains(response, _("Twitter authorization failed")) @@ -453,7 +453,7 @@ class TwitterTemplateViewTestCase(TestCase): params = {"denied": "", "oauth_token": "boo", "oauth_verifier": "barfoo"} response = self.client.get( - f"{reverse('accounts:twitter-template')}?{urlencode(params)}" + f"{reverse('accounts:settings:twitter-template')}?{urlencode(params)}" ) self.assertContains(response, _("OAuth tokens failed to match")) @@ -471,7 +471,7 @@ class TwitterTemplateViewTestCase(TestCase): params = {"denied": "", "oauth_token": "foo", "oauth_verifier": "barfoo"} response = self.client.get( - f"{reverse('accounts:twitter-template')}?{urlencode(params)}" + f"{reverse('accounts:settings:twitter-template')}?{urlencode(params)}" ) self.assertContains(response, _("No matching tokens found for this user")) @@ -495,7 +495,7 @@ class TwitterTemplateViewTestCase(TestCase): self.mocked_post.side_effect = StreamException response = self.client.get( - f"{reverse('accounts:twitter-template')}?{urlencode(params)}" + f"{reverse('accounts:settings:twitter-template')}?{urlencode(params)}" ) self.assertContains(response, _("Failed requesting access token")) @@ -523,7 +523,7 @@ class TwitterTemplateViewTestCase(TestCase): ) response = self.client.get( - f"{reverse('accounts:twitter-template')}?{urlencode(params)}" + f"{reverse('accounts:settings:twitter-template')}?{urlencode(params)}" ) self.assertContains(response, _("No credentials found in Twitter response")) diff --git a/src/newsreader/accounts/tests/test_settings.py b/src/newsreader/accounts/tests/test_settings.py index 42db736..5a12637 100644 --- a/src/newsreader/accounts/tests/test_settings.py +++ b/src/newsreader/accounts/tests/test_settings.py @@ -10,7 +10,7 @@ class SettingsViewTestCase(TestCase): self.user = UserFactory(email="test@test.nl", password="test") self.client.force_login(self.user) - self.url = reverse("accounts:settings") + self.url = reverse("accounts:settings:home") def test_simple(self): response = self.client.get(self.url) @@ -19,13 +19,13 @@ class SettingsViewTestCase(TestCase): def test_user_credential_change(self): response = self.client.post( - reverse("accounts:settings"), + reverse("accounts:settings:home"), {"first_name": "First name", "last_name": "Last name"}, ) user = User.objects.get() - self.assertRedirects(response, reverse("accounts:settings")) + self.assertRedirects(response, reverse("accounts:settings:home")) self.assertEquals(user.first_name, "First name") self.assertEquals(user.last_name, "Last name") diff --git a/src/newsreader/accounts/urls.py b/src/newsreader/accounts/urls.py index 3cdd1b1..0eaee5c 100644 --- a/src/newsreader/accounts/urls.py +++ b/src/newsreader/accounts/urls.py @@ -1,10 +1,11 @@ from django.contrib.auth.decorators import login_required -from django.urls import path +from django.urls import include, path from newsreader.accounts.views import ( ActivationCompleteView, ActivationResendView, ActivationView, + FaviconRedirectView, IntegrationsView, LoginView, LogoutView, @@ -26,6 +27,46 @@ from newsreader.accounts.views import ( ) +settings_patterns = [ + # Integrations + path( + "integrations/reddit/callback/", + login_required(RedditTemplateView.as_view()), + name="reddit-template", + ), + path( + "integrations/reddit/refresh/", + login_required(RedditTokenRedirectView.as_view()), + name="reddit-refresh", + ), + path( + "integrations/reddit/revoke/", + login_required(RedditRevokeRedirectView.as_view()), + name="reddit-revoke", + ), + path( + "integrations/twitter/auth/", + login_required(TwitterAuthRedirectView.as_view()), + name="twitter-auth", + ), + path( + "integrations/twitter/callback/", + login_required(TwitterTemplateView.as_view()), + name="twitter-template", + ), + path( + "integrations/twitter/revoke/", + login_required(TwitterRevokeRedirectView.as_view()), + name="twitter-revoke", + ), + path( + "integrations/", login_required(IntegrationsView.as_view()), name="integrations" + ), + # Misc + path("favicon/", login_required(FaviconRedirectView.as_view()), name="favicon"), + path("", login_required(SettingsView.as_view()), name="home"), +] + urlpatterns = [ # Auth path("login/", LoginView.as_view(), name="login"), @@ -70,42 +111,6 @@ urlpatterns = [ login_required(PasswordChangeView.as_view()), name="password-change", ), - # Integrations - path( - "settings/integrations/reddit/callback/", - login_required(RedditTemplateView.as_view()), - name="reddit-template", - ), - path( - "settings/integrations/reddit/refresh/", - login_required(RedditTokenRedirectView.as_view()), - name="reddit-refresh", - ), - path( - "settings/integrations/reddit/revoke/", - login_required(RedditRevokeRedirectView.as_view()), - name="reddit-revoke", - ), - path( - "settings/integrations/twitter/auth/", - login_required(TwitterAuthRedirectView.as_view()), - name="twitter-auth", - ), - path( - "settings/integrations/twitter/callback/", - login_required(TwitterTemplateView.as_view()), - name="twitter-template", - ), - path( - "settings/integrations/twitter/revoke/", - login_required(TwitterRevokeRedirectView.as_view()), - name="twitter-revoke", - ), - path( - "settings/integrations", - login_required(IntegrationsView.as_view()), - name="integrations", - ), # Settings - path("settings/", login_required(SettingsView.as_view()), name="settings"), + path("settings/", include((settings_patterns, "settings"))), ] diff --git a/src/newsreader/accounts/views/__init__.py b/src/newsreader/accounts/views/__init__.py index 81dd1fc..3be2b81 100644 --- a/src/newsreader/accounts/views/__init__.py +++ b/src/newsreader/accounts/views/__init__.py @@ -1,4 +1,5 @@ from newsreader.accounts.views.auth import LoginView, LogoutView +from newsreader.accounts.views.favicon import FaviconRedirectView from newsreader.accounts.views.integrations import ( IntegrationsView, RedditRevokeRedirectView, diff --git a/src/newsreader/accounts/views/favicon.py b/src/newsreader/accounts/views/favicon.py new file mode 100644 index 0000000..1b85399 --- /dev/null +++ b/src/newsreader/accounts/views/favicon.py @@ -0,0 +1,26 @@ +from django.contrib import messages +from django.core.cache import cache +from django.urls import reverse_lazy +from django.utils.translation import gettext as _ +from django.views.generic import RedirectView + +from newsreader.news.collection.tasks import FaviconTask + + +class FaviconRedirectView(RedirectView): + url = reverse_lazy("accounts:settings:home") + + def get(self, request, *args, **kwargs): + response = super().get(request, *args, **kwargs) + + user = request.user + task_active = cache.get(f"{user.email}-favicon-task") + + if not task_active: + FaviconTask.delay(user.pk) + messages.success(request, _("Favicons are being fetched")) + cache.set(f"{user.email}-favicon-task", 1, 18000) # 5 hours + return response + + messages.error(request, _("Limit reached, try again later")) + return response diff --git a/src/newsreader/accounts/views/integrations.py b/src/newsreader/accounts/views/integrations.py index 62d71fc..e6ed605 100644 --- a/src/newsreader/accounts/views/integrations.py +++ b/src/newsreader/accounts/views/integrations.py @@ -53,7 +53,7 @@ class IntegrationsView(TemplateView): and not user.reddit_access_token and not reddit_task_active ): - reddit_refresh_url = reverse_lazy("accounts:reddit-refresh") + reddit_refresh_url = reverse_lazy("accounts:settings:reddit-refresh") if not user.reddit_refresh_token: reddit_authorization_url = get_reddit_authorization_url(user) @@ -62,7 +62,7 @@ class IntegrationsView(TemplateView): "reddit_authorization_url": reddit_authorization_url, "reddit_refresh_url": reddit_refresh_url, "reddit_revoke_url": ( - reverse_lazy("accounts:reddit-revoke") + reverse_lazy("accounts:settings:reddit-revoke") if not reddit_authorization_url else None ), @@ -72,10 +72,10 @@ class IntegrationsView(TemplateView): twitter_revoke_url = None if self.request.user.has_twitter_auth: - twitter_revoke_url = reverse_lazy("accounts:twitter-revoke") + twitter_revoke_url = reverse_lazy("accounts:settings:twitter-revoke") return { - "twitter_auth_url": reverse_lazy("accounts:twitter-auth"), + "twitter_auth_url": reverse_lazy("accounts:settings:twitter-auth"), "twitter_revoke_url": twitter_revoke_url, } @@ -130,7 +130,7 @@ class RedditTemplateView(TemplateView): class RedditTokenRedirectView(RedirectView): - url = reverse_lazy("accounts:integrations") + url = reverse_lazy("accounts:settings:integrations") def get(self, request, *args, **kwargs): response = super().get(request, *args, **kwargs) @@ -149,7 +149,7 @@ class RedditTokenRedirectView(RedirectView): class RedditRevokeRedirectView(RedirectView): - url = reverse_lazy("accounts:integrations") + url = reverse_lazy("accounts:settings:integrations") def get(self, request, *args, **kwargs): response = super().get(request, *args, **kwargs) @@ -181,7 +181,7 @@ class RedditRevokeRedirectView(RedirectView): class TwitterRevokeRedirectView(RedirectView): - url = reverse_lazy("accounts:integrations") + url = reverse_lazy("accounts:settings:integrations") def get(self, request, *args, **kwargs): if not request.user.has_twitter_auth: @@ -212,7 +212,7 @@ class TwitterRevokeRedirectView(RedirectView): class TwitterAuthRedirectView(RedirectView): - url = reverse_lazy("accounts:integrations") + url = reverse_lazy("accounts:settings:integrations") def get(self, request, *args, **kwargs): oauth = OAuth( diff --git a/src/newsreader/accounts/views/settings.py b/src/newsreader/accounts/views/settings.py index 1603252..aac24fb 100644 --- a/src/newsreader/accounts/views/settings.py +++ b/src/newsreader/accounts/views/settings.py @@ -1,3 +1,4 @@ +from django.core.cache import cache from django.urls import reverse_lazy from django.views.generic.edit import FormView, ModelFormMixin @@ -11,7 +12,7 @@ from newsreader.news.collection.reddit import ( class SettingsView(ModelFormMixin, FormView): template_name = "accounts/views/settings.html" - success_url = reverse_lazy("accounts:settings") + success_url = reverse_lazy("accounts:settings:home") form_class = UserSettingsForm model = User @@ -19,6 +20,14 @@ class SettingsView(ModelFormMixin, FormView): self.object = self.get_object() return super().get(request, *args, **kwargs) + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + + return { + **context, + "favicon_task_allowed": not cache.get(f"{self.request.user}-favicon-task"), + } + def get_object(self, **kwargs): return self.request.user diff --git a/src/newsreader/js/components/Messages.js b/src/newsreader/js/components/Messages.js index 843677c..150b003 100644 --- a/src/newsreader/js/components/Messages.js +++ b/src/newsreader/js/components/Messages.js @@ -22,7 +22,7 @@ class Messages extends React.Component { ); }); - return
    {messages}
; + return
    {messages}
; } } diff --git a/src/newsreader/news/collection/favicon.py b/src/newsreader/news/collection/favicon.py index 639e7f6..1ca21e6 100644 --- a/src/newsreader/news/collection/favicon.py +++ b/src/newsreader/news/collection/favicon.py @@ -126,7 +126,7 @@ class FaviconCollector(Collector): feed_client, favicon_client = (FeedClient, FaviconClient) url_builder, favicon_builder = (WebsiteURLBuilder, FaviconBuilder) - def collect(self, rules=None): + def collect(self, rules=[]): streams = [] with self.feed_client(rules=rules) as client: diff --git a/src/newsreader/news/collection/management/commands/collect.py b/src/newsreader/news/collection/management/commands/collect.py deleted file mode 100644 index 7d928f0..0000000 --- a/src/newsreader/news/collection/management/commands/collect.py +++ /dev/null @@ -1,11 +0,0 @@ -from django.core.management.base import BaseCommand - -from newsreader.news.collection.feed import FeedCollector - - -class Command(BaseCommand): - help = "Collects Atom/RSS feeds" - - def handle(self, *args, **options): - collector = FeedCollector() - collector.collect() diff --git a/src/newsreader/news/collection/management/commands/fetch_favicons.py b/src/newsreader/news/collection/management/commands/fetch_favicons.py deleted file mode 100644 index 1ee96cf..0000000 --- a/src/newsreader/news/collection/management/commands/fetch_favicons.py +++ /dev/null @@ -1,11 +0,0 @@ -from django.core.management.base import BaseCommand - -from newsreader.news.collection.favicon import FaviconCollector - - -class Command(BaseCommand): - help = "Fetch favicons for collection rules" - - def handle(self, *args, **options): - collector = FaviconCollector() - collector.collect() diff --git a/src/newsreader/news/collection/tasks.py b/src/newsreader/news/collection/tasks.py index 926b05b..b82bf66 100644 --- a/src/newsreader/news/collection/tasks.py +++ b/src/newsreader/news/collection/tasks.py @@ -147,7 +147,49 @@ class TwitterTimelineTask(app.Task): raise Reject(reason="Task already running", requeue=False) +class FaviconTask(app.Task): + name = "FaviconTask" + ignore_result = True + + def run(self, user_pk): + from newsreader.news.collection.favicon import FaviconCollector + + try: + user = User.objects.get(pk=user_pk) + except ObjectDoesNotExist: + message = f"User {user_pk} does not exist" + logger.exception(message) + + raise Reject(reason=message, requeue=False) + + with MemCacheLock("f{user.email}-favicon-task", self.app.oid) as acquired: + if acquired: + logger.info(f"Running favicon task for user {user_pk}") + + rules = user.rules.enabled().filter(type=RuleTypeChoices.feed) + + collector = FaviconCollector() + collector.collect(rules=rules) + + third_party_rules = user.rules.enabled().exclude( + type=RuleTypeChoices.feed + ) + + for rule in third_party_rules: + if rule.type == RuleTypeChoices.subreddit: + rule.favicon = "https://www.reddit.com/favicon.ico" + rule.save() + elif rule.type == RuleTypeChoices.twitter_timeline: + rule.favicon = "https://abs.twimg.com/favicons/favicon.ico" + rule.save() + else: + logger.warning(f"Cancelling task due to existing lock") + + raise Reject(reason="Task already running", requeue=False) + + FeedTask = app.register_task(FeedTask()) +FaviconTask = app.register_task(FaviconTask()) RedditTask = app.register_task(RedditTask()) RedditTokenTask = app.register_task(RedditTokenTask()) TwitterTimelineTask = app.register_task(TwitterTimelineTask()) diff --git a/src/newsreader/scss/components/messages/_messages.scss b/src/newsreader/scss/components/messages/_messages.scss index 74d88b5..b1ba9d0 100644 --- a/src/newsreader/scss/components/messages/_messages.scss +++ b/src/newsreader/scss/components/messages/_messages.scss @@ -3,12 +3,10 @@ flex-direction: column; align-items: center; - position: fixed; - top: 0; width: 100%; margin: 5px 0 20px 0; - color: $white; + color: $font-color; &__item { width: 80%; @@ -17,7 +15,7 @@ padding: 20px 15px; margin: 5px 0; - background-color: $blue; + background-color: $transparant-blue; &--error { background-color: $transparant-red; @@ -27,7 +25,6 @@ background-color: $transparant-orange; } - // TODO check this color &--success { background-color: $transparant-green; } @@ -39,4 +36,28 @@ --ggs: 2; } } + + &--fixed { + position: fixed; + top: 0; + } + + &--fixed &__item { + color: $white; + background-color: $blue; + } + + &--fixed &__item--error { + color: $white; + background-color: $red; + } + + &--fixed &__item--warning { + background-color: $orange; + } + + &--fixed &__item--success { + color: $white; + background-color: $green; + } } diff --git a/src/newsreader/templates/base.html b/src/newsreader/templates/base.html index 3f677c0..efaf9f2 100644 --- a/src/newsreader/templates/base.html +++ b/src/newsreader/templates/base.html @@ -17,7 +17,7 @@ - + {% if request.user.is_superuser %} {% endif %} From 763d8ee093a83d921cfa28424c5ebe7f0a4af72a Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Thu, 15 Oct 2020 19:30:53 +0200 Subject: [PATCH 015/253] Refactor builders to use custom exceptions --- .../news/collection/exceptions/__init__.py | 16 ++ .../news/collection/exceptions/builder.py | 21 ++ .../{exceptions.py => exceptions/stream.py} | 0 src/newsreader/news/collection/feed.py | 60 ++--- src/newsreader/news/collection/reddit.py | 213 ++++++++++------- .../collection/tests/feed/builder/tests.py | 221 +++++++----------- .../collection/tests/reddit/builder/tests.py | 57 ----- .../collection/tests/twitter/builder/mocks.py | 199 ++++++++++++++++ .../collection/tests/twitter/builder/tests.py | 19 ++ src/newsreader/news/collection/twitter.py | 79 ++++--- 10 files changed, 554 insertions(+), 331 deletions(-) create mode 100644 src/newsreader/news/collection/exceptions/__init__.py create mode 100644 src/newsreader/news/collection/exceptions/builder.py rename src/newsreader/news/collection/{exceptions.py => exceptions/stream.py} (100%) diff --git a/src/newsreader/news/collection/exceptions/__init__.py b/src/newsreader/news/collection/exceptions/__init__.py new file mode 100644 index 0000000..35ce72d --- /dev/null +++ b/src/newsreader/news/collection/exceptions/__init__.py @@ -0,0 +1,16 @@ +from newsreader.news.collection.exceptions.builder import ( + BuilderDuplicateException, + BuilderException, + BuilderMissingDataException, + BuilderParseException, +) +from newsreader.news.collection.exceptions.stream import ( + StreamConnectionException, + StreamDeniedException, + StreamException, + StreamForbiddenException, + StreamNotFoundException, + StreamParseException, + StreamTimeOutException, + StreamTooManyException, +) diff --git a/src/newsreader/news/collection/exceptions/builder.py b/src/newsreader/news/collection/exceptions/builder.py new file mode 100644 index 0000000..6fb2d60 --- /dev/null +++ b/src/newsreader/news/collection/exceptions/builder.py @@ -0,0 +1,21 @@ +class BuilderException(Exception): + message = "Builder exception" + + def __init__(self, payload=None, message=None): + self.payload = payload + self.message = message if message else self.message + + def __str__(self): + return self.message + + +class BuilderMissingDataException(BuilderException): + message = "Payload contains missing data" + + +class BuilderDuplicateException(BuilderException): + message = "Payload contains duplicate entry" + + +class BuilderParseException(BuilderException): + message = "Failed to parse payload" diff --git a/src/newsreader/news/collection/exceptions.py b/src/newsreader/news/collection/exceptions/stream.py similarity index 100% rename from src/newsreader/news/collection/exceptions.py rename to src/newsreader/news/collection/exceptions/stream.py diff --git a/src/newsreader/news/collection/feed.py b/src/newsreader/news/collection/feed.py index ae6cd42..379f18e 100644 --- a/src/newsreader/news/collection/feed.py +++ b/src/newsreader/news/collection/feed.py @@ -39,6 +39,18 @@ class FeedBuilder(PostBuilder): rule__type = RuleTypeChoices.feed def build(self): + instances = [] + + with FeedDuplicateHandler(self.stream.rule) as duplicate_handler: + entries = self.payload.get("entries", []) + + for entry in entries: + post = self.build_post(entry) + instances.append(post) + + self.instances = duplicate_handler.check(instances) + + def build_post(self, entry): field_mapping = { "id": "remote_identifier", "title": "title", @@ -48,41 +60,37 @@ class FeedBuilder(PostBuilder): "author": "author", } tz = pytz.timezone(self.stream.rule.timezone) - instances = [] + data = {"rule_id": self.stream.rule.pk} - with FeedDuplicateHandler(self.stream.rule) as duplicate_handler: - entries = self.payload.get("entries", []) + for field, model_field in field_mapping.items(): + if not field in entry: + continue - for entry in entries: - data = {"rule_id": self.stream.rule.pk} + value = truncate_text(Post, model_field, entry[field]) - for field, model_field in field_mapping.items(): - if not field in entry: - continue + if field == "published_parsed": + data[model_field] = build_publication_date(value, tz) + elif field == "summary": + data[model_field] = self.sanitize_fragment(value) + else: + data[model_field] = value - value = truncate_text(Post, model_field, entry[field]) + content_details = self.get_content_details(entry) - if field == "published_parsed": - data[model_field] = build_publication_date(value, tz) - elif field == "summary": - data[model_field] = self.sanitize_fragment(value) - else: - data[model_field] = value + # use content details key if it contains more information + if not "body" in data or len(data["body"]) < len(content_details): + data["body"] = content_details - if "content" in entry: - content = self.get_content(entry["content"]) - body = data.get("body", "") + return Post(**data) - if not body or len(body) < len(content): - data["body"] = content + def get_content_details(self, entry): + content_items = entry.get("content") - instances.append(Post(**data)) + if not content_items: + return "" - self.instances = duplicate_handler.check(instances) - - def get_content(self, items): - content = "\n ".join([item.get("value") for item in items]) - return self.sanitize_fragment(content) + content_details = "\n ".join([item.get("value") for item in content_items]) + return self.sanitize_fragment(content_details) class FeedStream(PostStream): diff --git a/src/newsreader/news/collection/reddit.py b/src/newsreader/news/collection/reddit.py index daeb85f..1fbffe2 100644 --- a/src/newsreader/news/collection/reddit.py +++ b/src/newsreader/news/collection/reddit.py @@ -28,6 +28,10 @@ from newsreader.news.collection.constants import ( WHITELISTED_TAGS, ) from newsreader.news.collection.exceptions import ( + BuilderDuplicateException, + BuilderException, + BuilderMissingDataException, + BuilderParseException, StreamDeniedException, StreamException, StreamParseException, @@ -122,99 +126,136 @@ class RedditBuilder(PostBuilder): if not "data" in self.payload or not "children" in self.payload["data"]: return - posts = self.payload["data"]["children"] - rule = self.stream.rule - - for post in posts: - if not "data" in post or post["kind"] != REDDIT_POST: - continue - - data = post["data"] - - remote_identifier = data["id"] - title = truncate_text(Post, "title", data["title"]) - author = truncate_text(Post, "author", data["author"]) - post_url_fragment = data["permalink"] - direct_url = data["url"] - is_text_post = data["is_self"] - - if remote_identifier in results: - continue - - if is_text_post: - uncleaned_body = data["selftext_html"] - unescaped_body = unescape(uncleaned_body) if uncleaned_body else "" - body = self.sanitize_fragment(unescaped_body) if unescaped_body else "" - elif direct_url.endswith(REDDIT_IMAGE_EXTENSIONS): - body = format_html( - "
{title}
", - url=direct_url, - title=title, - ) - elif data["is_video"]: - video_info = data["secure_media"]["reddit_video"] - - body = format_html( - "
", - url=video_info["fallback_url"], - ) - elif direct_url.endswith(REDDIT_VIDEO_EXTENSIONS): - extension = next( - extension.replace(".", "") - for extension in REDDIT_VIDEO_EXTENSIONS - if direct_url.endswith(extension) - ) - - if extension == "gifv": - body = format_html( - "
", - url=direct_url.replace(extension, "mp4"), - ) - else: - body = format_html( - "
", - url=direct_url, - extension=extension, - ) - else: - body = format_html( - "", - url=direct_url, - title=title, - ) + entries = self.payload["data"]["children"] + for entry in entries: try: - parsed_date = datetime.fromtimestamp(post["data"]["created_utc"]) - created_date = pytz.utc.localize(parsed_date) - except (OverflowError, OSError): - logging.warning( - f"Failed parsing timestamp from {REDDIT_URL}{post_url_fragment}" - ) - created_date = timezone.now() - - post_data = { - "remote_identifier": remote_identifier, - "title": title, - "body": body, - "author": author, - "url": f"{REDDIT_URL}{post_url_fragment}", - "publication_date": created_date, - "rule": rule, - } - - if remote_identifier in self.existing_posts: - existing_post = self.existing_posts[remote_identifier] - - for key, value in post_data.items(): - setattr(existing_post, key, value) - - results[existing_post.remote_identifier] = existing_post + post = self.build_post(entry) + except BuilderException: + logger.exception("Failed building post") continue - results[remote_identifier] = Post(**post_data) + identifier = post.remote_identifier + results[identifier] = post self.instances = results.values() + def build_post(self, entry): + rule = self.stream.rule + entry_data = entry.get("data", {}) + remote_identifier = entry_data.get("id", "") + kind = entry.get("kind") + + if remote_identifier in self.existing_posts: + raise BuilderDuplicateException(payload=entry) + elif kind != REDDIT_POST: + raise BuilderParseException( + message=f"Payload is not an reddit post, its of kind {kind}", + payload=entry, + ) + elif not entry_data: + raise BuilderMissingDataException( + message=f"Post {remote_identifier} did not contain any data", + payload=entry, + ) + + try: + title = entry_data["title"] + author = entry_data["author"] + post_url_fragment = entry_data["permalink"] + direct_url = entry_data["url"] + is_text = entry_data["is_self"] + is_video = entry_data["is_video"] + except KeyError as e: + raise BuilderMissingDataException(payload=entry) from e + + title = truncate_text(Post, "title", title) + author = truncate_text(Post, "author", author) + + if is_text: + body = self.get_text_post(entry_data) + elif direct_url.endswith(REDDIT_IMAGE_EXTENSIONS): + body = self.get_image_post(title, direct_url) + elif is_video: + body = self.get_native_video_post(entry_data) + elif direct_url.endswith(REDDIT_VIDEO_EXTENSIONS): + body = self.get_video_post(direct_url) + else: + body = self.get_url_post(title, direct_url) + + try: + parsed_date = datetime.fromtimestamp(entry_data["created_utc"]) + created_date = pytz.utc.localize(parsed_date) + except (OverflowError, OSError) as e: + raise BuilderParseException(payload=entry) from e + except KeyError as e: + raise BuilderMissingDataException(payload=entry) from e + + post_entry = { + "remote_identifier": remote_identifier, + "title": title, + "body": body, + "author": author, + "url": f"{REDDIT_URL}{post_url_fragment}", + "publication_date": created_date, + "rule": rule, + } + + return Post(**post_entry) + + def get_text_post(self, entry): + try: + uncleaned_body = entry["selftext_html"] + except KeyError as e: + raise BuilderMissingDataException(payload=entry) from e + + unescaped_body = unescape(uncleaned_body) if uncleaned_body else "" + return self.sanitize_fragment(unescaped_body) if unescaped_body else "" + + def get_image_post(self, title, url): + return format_html( + "
{title}
", + url=url, + title=title, + ) + + def get_native_video_post(self, entry): + try: + video_info = entry["secure_media"]["reddit_video"] + except KeyError as e: + raise BuilderMissingDataException(payload=entry) from e + + return format_html( + "
", + url=video_info["fallback_url"], + ) + + def get_video_post(self, url): + extension = next( + extension.replace(".", "") + for extension in REDDIT_VIDEO_EXTENSIONS + if url.endswith(extension) + ) + + if extension == "gifv": + return format_html( + "
", + url=url.replace(extension, "mp4"), + ) + + return format_html( + "
", + url=url, + extension=extension, + ) + + def get_url_post(self, title, url): + return format_html( + "", + url=url, + title=title, + ) + class RedditStream(PostStream): rule_type = RuleTypeChoices.subreddit diff --git a/src/newsreader/news/collection/tests/feed/builder/tests.py b/src/newsreader/news/collection/tests/feed/builder/tests.py index 571a7cd..7f4edf0 100644 --- a/src/newsreader/news/collection/tests/feed/builder/tests.py +++ b/src/newsreader/news/collection/tests/feed/builder/tests.py @@ -1,4 +1,4 @@ -from datetime import date, datetime, time +from datetime import datetime from unittest.mock import Mock from django.test import TestCase @@ -21,277 +21,233 @@ class FeedBuilderTestCase(TestCase): def setUp(self): self.maxDiff = None - def test_basic_entry(self): - builder = FeedBuilder - rule = FeedFactory() - mock_stream = Mock(rule=rule) - - with builder(simple_mock, mock_stream) as builder: - builder.build() - builder.save() - - post = Post.objects.get() - - publication_date = datetime.combine( - date(2019, 5, 20), time(hour=16, minute=7, second=37) - ) - aware_date = pytz.utc.localize(publication_date) - - self.assertEquals(post.publication_date, aware_date) - self.assertEquals(Post.objects.count(), 1) - - self.assertEquals( - post.remote_identifier, - "https://www.bbc.co.uk/news/world-us-canada-48338168", - ) - - self.assertEquals( - post.url, "https://www.bbc.co.uk/news/world-us-canada-48338168" - ) - - self.assertEquals( - post.title, "Trump's 'genocidal taunts' will not end Iran - Zarif" - ) - def test_multiple_entries(self): - builder = FeedBuilder rule = FeedFactory() mock_stream = Mock(rule=rule) - with builder(multiple_mock, mock_stream) as builder: + with FeedBuilder(multiple_mock, mock_stream) as builder: builder.build() builder.save() posts = Post.objects.order_by("-publication_date") - self.assertEquals(Post.objects.count(), 3) + self.assertEqual(Post.objects.count(), 3) post = posts[0] - publication_date = datetime.combine( - date(2019, 5, 20), time(hour=16, minute=32, second=38) + publication_date = datetime( + 2019, 5, 20, hour=16, minute=32, second=38, tzinfo=pytz.utc ) - aware_date = pytz.utc.localize(publication_date) - self.assertEquals( + self.assertEqual( post.publication_date.strftime("%Y-%m-%d %H:%M:%S"), - aware_date.strftime("%Y-%m-%d %H:%M:%S"), + publication_date.strftime("%Y-%m-%d %H:%M:%S"), ) - self.assertEquals( + self.assertEqual( post.remote_identifier, "https://www.bbc.co.uk/news/uk-england-birmingham-48339080", ) - self.assertEquals( + self.assertEqual( post.url, "https://www.bbc.co.uk/news/uk-england-birmingham-48339080" ) - self.assertEquals( + self.assertEqual( post.title, "Birmingham head teacher threatened over LGBT lessons" ) post = posts[1] - publication_date = datetime.combine( - date(2019, 5, 20), time(hour=16, minute=7, second=37) + publication_date = datetime( + 2019, 5, 20, hour=16, minute=7, second=37, tzinfo=pytz.utc ) - aware_date = pytz.utc.localize(publication_date) - self.assertEquals( + self.assertEqual( post.publication_date.strftime("%Y-%m-%d %H:%M:%S"), - aware_date.strftime("%Y-%m-%d %H:%M:%S"), + publication_date.strftime("%Y-%m-%d %H:%M:%S"), ) - self.assertEquals( + self.assertEqual( post.remote_identifier, "https://www.bbc.co.uk/news/world-us-canada-48338168", ) - self.assertEquals( + self.assertEqual( post.url, "https://www.bbc.co.uk/news/world-us-canada-48338168" ) - self.assertEquals( + self.assertEqual( post.title, "Trump's 'genocidal taunts' will not end Iran - Zarif" ) def test_entries_without_remote_identifier(self): - builder = FeedBuilder rule = FeedFactory() mock_stream = Mock(rule=rule) - with builder(mock_without_identifier, mock_stream) as builder: + with FeedBuilder(mock_without_identifier, mock_stream) as builder: builder.build() builder.save() posts = Post.objects.order_by("-publication_date") - self.assertEquals(Post.objects.count(), 2) + self.assertEqual(Post.objects.count(), 2) post = posts[0] - publication_date = datetime.combine( - date(2019, 5, 20), time(hour=16, minute=7, second=37) + publication_date = datetime( + 2019, 5, 20, hour=16, minute=7, second=37, tzinfo=pytz.utc ) - aware_date = pytz.utc.localize(publication_date) - self.assertEquals(post.publication_date, aware_date) - self.assertEquals(post.remote_identifier, None) - self.assertEquals( + self.assertEqual(post.publication_date, publication_date) + self.assertEqual(post.remote_identifier, None) + self.assertEqual( post.url, "https://www.bbc.co.uk/news/world-us-canada-48338168" ) - self.assertEquals( + self.assertEqual( post.title, "Trump's 'genocidal taunts' will not end Iran - Zarif" ) post = posts[1] - publication_date = datetime.combine( - date(2019, 5, 20), time(hour=12, minute=19, second=19) + publication_date = datetime( + 2019, 5, 20, hour=12, minute=19, second=19, tzinfo=pytz.utc ) - aware_date = pytz.utc.localize(publication_date) - self.assertEquals(post.publication_date, aware_date) - self.assertEquals(post.remote_identifier, None) - self.assertEquals(post.url, "https://www.bbc.co.uk/news/technology-48334739") - self.assertEquals(post.title, "Huawei's Android loss: How it affects you") + self.assertEqual(post.publication_date, publication_date) + self.assertEqual(post.remote_identifier, None) + self.assertEqual(post.url, "https://www.bbc.co.uk/news/technology-48334739") + self.assertEqual(post.title, "Huawei's Android loss: How it affects you") def test_entry_without_publication_date(self): - builder = FeedBuilder rule = FeedFactory() mock_stream = Mock(rule=rule) - with builder(mock_without_publish_date, mock_stream) as builder: + with FeedBuilder(mock_without_publish_date, mock_stream) as builder: builder.build() builder.save() posts = Post.objects.order_by("-publication_date") - self.assertEquals(Post.objects.count(), 2) + self.assertEqual(Post.objects.count(), 2) post = posts[0] - self.assertEquals( + self.assertEqual( post.publication_date.strftime("%Y-%m-%d %H:%M"), "2019-10-30 12:30" ) - self.assertEquals(post.created, timezone.now()) - self.assertEquals( + self.assertEqual(post.created, timezone.now()) + self.assertEqual( post.remote_identifier, "https://www.bbc.co.uk/news/world-us-canada-48338168", ) post = posts[1] - self.assertEquals( + self.assertEqual( post.publication_date.strftime("%Y-%m-%d %H:%M"), "2019-10-30 12:30" ) - self.assertEquals(post.created, timezone.now()) - self.assertEquals( + self.assertEqual(post.created, timezone.now()) + self.assertEqual( post.remote_identifier, "https://www.bbc.co.uk/news/technology-48334739" ) def test_entry_without_url(self): - builder = FeedBuilder rule = FeedFactory() mock_stream = Mock(rule=rule) - with builder(mock_without_url, mock_stream) as builder: + with FeedBuilder(mock_without_url, mock_stream) as builder: builder.build() builder.save() posts = Post.objects.order_by("-publication_date") - self.assertEquals(Post.objects.count(), 2) + self.assertEqual(Post.objects.count(), 2) post = posts[0] - self.assertEquals(post.created, timezone.now()) - self.assertEquals( + self.assertEqual(post.created, timezone.now()) + self.assertEqual( post.remote_identifier, "https://www.bbc.co.uk/news/world-us-canada-48338168", ) post = posts[1] - self.assertEquals(post.created, timezone.now()) - self.assertEquals( + self.assertEqual(post.created, timezone.now()) + self.assertEqual( post.remote_identifier, "https://www.bbc.co.uk/news/technology-48334739" ) def test_entry_without_body(self): - builder = FeedBuilder rule = FeedFactory() mock_stream = Mock(rule=rule) - with builder(mock_without_body, mock_stream) as builder: + with FeedBuilder(mock_without_body, mock_stream) as builder: builder.build() builder.save() posts = Post.objects.order_by("-publication_date") - self.assertEquals(Post.objects.count(), 2) + self.assertEqual(Post.objects.count(), 2) post = posts[0] - self.assertEquals( + self.assertEqual( post.created.strftime("%Y-%m-%d %H:%M:%S"), "2019-10-30 12:30:00" ) - self.assertEquals( + self.assertEqual( post.remote_identifier, "https://www.bbc.co.uk/news/uk-england-birmingham-48339080", ) - self.assertEquals(post.body, "") + self.assertEqual(post.body, "") post = posts[1] - self.assertEquals( + self.assertEqual( post.created.strftime("%Y-%m-%d %H:%M:%S"), "2019-10-30 12:30:00" ) - self.assertEquals( + self.assertEqual( post.remote_identifier, "https://www.bbc.co.uk/news/world-us-canada-48338168", ) - self.assertEquals(post.body, "") + self.assertEqual(post.body, "") def test_entry_without_author(self): - builder = FeedBuilder rule = FeedFactory() mock_stream = Mock(rule=rule) - with builder(mock_without_author, mock_stream) as builder: + with FeedBuilder(mock_without_author, mock_stream) as builder: builder.build() builder.save() posts = Post.objects.order_by("-publication_date") - self.assertEquals(Post.objects.count(), 2) + self.assertEqual(Post.objects.count(), 2) post = posts[0] - self.assertEquals(post.created, timezone.now()) - self.assertEquals( + self.assertEqual(post.created, timezone.now()) + self.assertEqual( post.remote_identifier, "https://www.bbc.co.uk/news/world-us-canada-48338168", ) - self.assertEquals(post.author, None) + self.assertEqual(post.author, None) post = posts[1] - self.assertEquals(post.created, timezone.now()) - self.assertEquals( + self.assertEqual(post.created, timezone.now()) + self.assertEqual( post.remote_identifier, "https://www.bbc.co.uk/news/technology-48334739" ) - self.assertEquals(post.author, None) + self.assertEqual(post.author, None) def test_empty_entries(self): - builder = FeedBuilder rule = FeedFactory() mock_stream = Mock(rule=rule) - with builder(mock_without_entries, mock_stream) as builder: + with FeedBuilder(mock_without_entries, mock_stream) as builder: builder.build() builder.save() - self.assertEquals(Post.objects.count(), 0) + self.assertEqual(Post.objects.count(), 0) def test_update_entries(self): - builder = FeedBuilder rule = FeedFactory() mock_stream = Mock(rule=rule) @@ -303,36 +259,35 @@ class FeedBuilderTestCase(TestCase): remote_identifier="a5479c66-8fae-11e9-8422-00163ef6bee7", rule=rule ) - with builder(mock_with_update_entries, mock_stream) as builder: + with FeedBuilder(mock_with_update_entries, mock_stream) as builder: builder.build() builder.save() - self.assertEquals(Post.objects.count(), 3) + self.assertEqual(Post.objects.count(), 3) existing_first_post.refresh_from_db() existing_second_post.refresh_from_db() - self.assertEquals( + self.assertEqual( existing_first_post.title, "Trump's 'genocidal taunts' will not end Iran - Zarif", ) - self.assertEquals( + self.assertEqual( existing_second_post.title, "Huawei's Android loss: How it affects you" ) def test_html_sanitizing(self): - builder = FeedBuilder rule = FeedFactory() mock_stream = Mock(rule=rule) - with builder(mock_with_html, mock_stream) as builder: + with FeedBuilder(mock_with_html, mock_stream) as builder: builder.build() builder.save() post = Post.objects.get() - self.assertEquals(Post.objects.count(), 1) + self.assertEqual(Post.objects.count(), 1) self.assertTrue("
" in post.body) self.assertTrue("

" in post.body) @@ -345,64 +300,60 @@ class FeedBuilderTestCase(TestCase): self.assertTrue("", - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://blog.documentfoundation.org/blog/2020/07/06/board-statement-on-the-libreoffice-7-0rc-personal-edition-label/", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "7127ec98-5859-11e8-9488-0e8717893ec8", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "#0aa18f", - "id": "hnd7cy", - "is_robot_indexable": True, - "report_reasons": None, - "author": "TheQuantumZero", - "discussion_type": None, - "num_comments": 120, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "crosspost_parent": "t3_hnd6yo", - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hnd7cy/board_statement_on_the_libreoffice_70_rc_personal/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://blog.documentfoundation.org/blog/2020/07/06/board-statement-on-the-libreoffice-7-0rc-personal-edition-label/", - "subreddit_subscribers": 544037, - "created_utc": 1594196218.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - } - ], - "after": "t3_hmytic", - "before": None, - }, -} - -author_mock = { - "kind": "Listing", - "data": { - "modhash": "rjewztai5w0ab64547311ae1fb1f9cf81cd18949bfb629cb7f", - "dist": 27, - "children": [ - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "", - "author_fullname": "t2_hlv0o", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": 'Board statement on the LibreOffice 7.0 RC "Personal Edition" label', - "link_flair_richtext": [{"e": "text", "t": "Popular Application"}], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hnd7cy", - "quarantine": False, - "link_flair_text_color": "light", - "upvote_ratio": 0.95, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 226, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "Popular Application", - "can_mod_post": False, - "score": 226, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "crosspost_parent_list": [ - { - "approved_at_utc": None, - "subreddit": "libreoffice", - "selftext": "", - "author_fullname": "t2_hlv0o", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": 'Board statement on the LibreOffice 7.0 RC "Personal Edition" label', - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/libreoffice", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "", - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hnd6yo", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.96, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 29, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "News", - "can_mod_post": False, - "score": 29, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594224961.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "blog.documentfoundation.org", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://blog.documentfoundation.org/blog/2020/07/06/board-statement-on-the-libreoffice-7-0rc-personal-edition-label/", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "dc82ac98-bafb-11e4-9f88-22000b310327", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2s4nt", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hnd6yo", - "is_robot_indexable": True, - "report_reasons": None, - "author": "TheQuantumZero", - "discussion_type": None, - "num_comments": 38, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/libreoffice/comments/hnd6yo/board_statement_on_the_libreoffice_70_rc_personal/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://blog.documentfoundation.org/blog/2020/07/06/board-statement-on-the-libreoffice-7-0rc-personal-edition-label/", - "subreddit_subscribers": 4669, - "created_utc": 1594196161.0, - "num_crossposts": 2, - "media": None, - "is_video": False, - } - ], - "created": 1594225018.0, - "link_flair_type": "richtext", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "blog.documentfoundation.org", - "allow_live_comments": False, - "selftext_html": "
", - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://blog.documentfoundation.org/blog/2020/07/06/board-statement-on-the-libreoffice-7-0rc-personal-edition-label/", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "7127ec98-5859-11e8-9488-0e8717893ec8", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "#0aa18f", - "id": "hnd7cy", - "is_robot_indexable": True, - "report_reasons": None, - "author": "TheQuantumZeroTheQuantumZeroTheQuantumZero", - "discussion_type": None, - "num_comments": 120, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "crosspost_parent": "t3_hnd6yo", - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hnd7cy/board_statement_on_the_libreoffice_70_rc_personal/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://blog.documentfoundation.org/blog/2020/07/06/board-statement-on-the-libreoffice-7-0rc-personal-edition-label/", - "subreddit_subscribers": 544037, - "created_utc": 1594196218.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - } - ], - "after": "t3_hmytic", - "before": None, - }, -} - -title_mock = { - "kind": "Listing", - "data": { - "modhash": "rjewztai5w0ab64547311ae1fb1f9cf81cd18949bfb629cb7f", - "dist": 27, - "children": [ - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "", - "author_fullname": "t2_hlv0o", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": 'Board statement on the LibreOffice 7.0 RC "Personal EditionBoard statement on the LibreOffice 7.0 RC "Personal Edition" label" labelBoard statement on the LibreOffice 7.0 RC "PersBoard statement on the LibreOffice 7.0 RC "Personal Edition" labelonal Edition" label', - "link_flair_richtext": [{"e": "text", "t": "Popular Application"}], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hnd7cy", - "quarantine": False, - "link_flair_text_color": "light", - "upvote_ratio": 0.95, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 226, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "Popular Application", - "can_mod_post": False, - "score": 226, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "crosspost_parent_list": [ - { - "approved_at_utc": None, - "subreddit": "libreoffice", - "selftext": "", - "author_fullname": "t2_hlv0o", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": 'Board statement on the LibreOffice 7.0 RC "Personal Edition" label', - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/libreoffice", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "", - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hnd6yo", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.96, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 29, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "News", - "can_mod_post": False, - "score": 29, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594224961.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "blog.documentfoundation.org", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://blog.documentfoundation.org/blog/2020/07/06/board-statement-on-the-libreoffice-7-0rc-personal-edition-label/", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "dc82ac98-bafb-11e4-9f88-22000b310327", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2s4nt", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hnd6yo", - "is_robot_indexable": True, - "report_reasons": None, - "author": "TheQuantumZero", - "discussion_type": None, - "num_comments": 38, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/libreoffice/comments/hnd6yo/board_statement_on_the_libreoffice_70_rc_personal/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://blog.documentfoundation.org/blog/2020/07/06/board-statement-on-the-libreoffice-7-0rc-personal-edition-label/", - "subreddit_subscribers": 4669, - "created_utc": 1594196161.0, - "num_crossposts": 2, - "media": None, - "is_video": False, - } - ], - "created": 1594225018.0, - "link_flair_type": "richtext", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "blog.documentfoundation.org", - "allow_live_comments": False, - "selftext_html": "
", - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://blog.documentfoundation.org/blog/2020/07/06/board-statement-on-the-libreoffice-7-0rc-personal-edition-label/", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "7127ec98-5859-11e8-9488-0e8717893ec8", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "#0aa18f", - "id": "hnd7cy", - "is_robot_indexable": True, - "report_reasons": None, - "author": "TheQuantumZeroTheQuantumZeroTheQuantumZero", - "discussion_type": None, - "num_comments": 120, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "crosspost_parent": "t3_hnd6yo", - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hnd7cy/board_statement_on_the_libreoffice_70_rc_personal/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://blog.documentfoundation.org/blog/2020/07/06/board-statement-on-the-libreoffice-7-0rc-personal-edition-label/", - "subreddit_subscribers": 544037, - "created_utc": 1594196218.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - } - ], - "after": "t3_hmytic", - "before": None, - }, -} - -duplicate_mock = { - "kind": "Listing", - "data": { - "modhash": "rjewztai5w0ab64547311ae1fb1f9cf81cd18949bfb629cb7f", - "dist": 27, - "children": [ - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "Welcome to r/linux rants and experiences! This megathread is also to hear opinions from anyone just starting out with Linux or those that have used Linux (GNU or otherwise) for a long time.\n\nLet us know what's annoying you, whats making you happy, or something that you want to get out to r/linux but didn't make the cut into a full post of it's own.\n\nFor those looking for certifications please use this megathread to ask about how to get certified whether it's for the business world or for your own satisfaction. Be sure to check out r/linuxadmin for more discussion in the SysAdmin world!\n\n_Please keep questions in r/linuxquestions, r/linux4noobs, or the Wednesday automod thread._", - "author_fullname": "t2_6l4z3", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Linux Experiences/Rants or Education/Certifications thread - July 06, 2020", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hm0qct", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.7, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 8, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 8, - "approved_by": None, - "author_premium": True, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594037482.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.linux", - "allow_live_comments": False, - "selftext_html": "<!-- SC_OFF --><div class='md'><p>Welcome to <a href='/r/linux'>r/linux</a> rants and experiences! This megathread is also to hear opinions from anyone just starting out with Linux or those that have used Linux (GNU or otherwise) for a long time.</p>\n\n<p>Let us know what&#39;s annoying you, whats making you happy, or something that you want to get out to <a href='/r/linux'>r/linux</a> but didn&#39;t make the cut into a full post of it&#39;s own.</p>\n\n<p>For those looking for certifications please use this megathread to ask about how to get certified whether it&#39;s for the business world or for your own satisfaction. Be sure to check out <a href='/r/linuxadmin'>r/linuxadmin</a> for more discussion in the SysAdmin world!</p>\n\n<p><em>Please keep questions in <a href='/r/linuxquestions'>r/linuxquestions</a>, <a href='/r/linux4noobs'>r/linux4noobs</a>, or the Wednesday automod thread.</em></p>\n</div><!-- SC_ON -->", - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": True, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": "moderator", - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hm0qct", - "is_robot_indexable": True, - "report_reasons": None, - "author": "AutoModerator", - "discussion_type": None, - "num_comments": 9, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hm0qct/linux_experiencesrants_or_educationcertifications/", - "parent_whitelist_status": "all_ads", - "stickied": True, - "url": "https://www.reddit.com/r/linux/comments/hm0qct/linux_experiencesrants_or_educationcertifications/", - "subreddit_subscribers": 544037, - "created_utc": 1594008682.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "Welcome to r/linux! If you're new to Linux or trying to get started this thread is for you. Get help here or as always, check out r/linuxquestions or r/linux4noobs\n\nThis megathread is for all your question needs. As we don't allow questions on r/linux outside of this megathread, please consider using r/linuxquestions or r/linux4noobs for the best solution to your problem.\n\nAsk your hardware requests here too or try r/linuxhardware!", - "author_fullname": "t2_6l4z3", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Weekly Questions and Hardware Thread - July 08, 2020", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hna75r", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.6, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 2, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 2, - "approved_by": None, - "author_premium": True, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594210138.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.linux", - "allow_live_comments": False, - "selftext_html": '<!-- SC_OFF --><div class="md"><p>Welcome to <a href="/r/linux">r/linux</a>! If you&#39;re new to Linux or trying to get started this thread is for you. Get help here or as always, check out <a href="/r/linuxquestions">r/linuxquestions</a> or <a href="/r/linux4noobs">r/linux4noobs</a></p>\n\n<p>This megathread is for all your question needs. As we don&#39;t allow questions on <a href="/r/linux">r/linux</a> outside of this megathread, please consider using <a href="/r/linuxquestions">r/linuxquestions</a> or <a href="/r/linux4noobs">r/linux4noobs</a> for the best solution to your problem.</p>\n\n<p>Ask your hardware requests here too or try <a href="/r/linuxhardware">r/linuxhardware</a>!</p>\n</div><!-- SC_ON -->', - "likes": None, - "suggested_sort": "new", - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": True, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": "moderator", - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hna75r", - "is_robot_indexable": True, - "report_reasons": None, - "author": "AutoModerator", - "discussion_type": None, - "num_comments": 2, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hna75r/weekly_questions_and_hardware_thread_july_08_2020/", - "parent_whitelist_status": "all_ads", - "stickied": True, - "url": "https://www.reddit.com/r/linux/comments/hna75r/weekly_questions_and_hardware_thread_july_08_2020/", - "subreddit_subscribers": 544037, - "created_utc": 1594181338.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "Welcome to r/linux rants and experiences! This megathread is also to hear opinions from anyone just starting out with Linux or those that have used Linux (GNU or otherwise) for a long time.\n\nLet us know what's annoying you, whats making you happy, or something that you want to get out to r/linux but didn't make the cut into a full post of it's own.\n\nFor those looking for certifications please use this megathread to ask about how to get certified whether it's for the business world or for your own satisfaction. Be sure to check out r/linuxadmin for more discussion in the SysAdmin world!\n\n_Please keep questions in r/linuxquestions, r/linux4noobs, or the Wednesday automod thread._", - "author_fullname": "t2_6l4z3", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Linux Experiences/Rants or Education/Certifications thread - July 06, 2020", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hm0qct", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.7, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 8, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 8, - "approved_by": None, - "author_premium": True, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594037482.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.linux", - "allow_live_comments": False, - "selftext_html": "<!-- SC_OFF --><div class='md'><p>Welcome to <a href='/r/linux'>r/linux</a> rants and experiences! This megathread is also to hear opinions from anyone just starting out with Linux or those that have used Linux (GNU or otherwise) for a long time.</p>\n\n<p>Let us know what&#39;s annoying you, whats making you happy, or something that you want to get out to <a href='/r/linux'>r/linux</a> but didn&#39;t make the cut into a full post of it&#39;s own.</p>\n\n<p>For those looking for certifications please use this megathread to ask about how to get certified whether it&#39;s for the business world or for your own satisfaction. Be sure to check out <a href='/r/linuxadmin'>r/linuxadmin</a> for more discussion in the SysAdmin world!</p>\n\n<p><em>Please keep questions in <a href='/r/linuxquestions'>r/linuxquestions</a>, <a href='/r/linux4noobs'>r/linux4noobs</a>, or the Wednesday automod thread.</em></p>\n</div><!-- SC_ON -->", - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": True, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": "moderator", - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hm0qct", - "is_robot_indexable": True, - "report_reasons": None, - "author": "AutoModerator", - "discussion_type": None, - "num_comments": 9, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hm0qct/linux_experiencesrants_or_educationcertifications/", - "parent_whitelist_status": "all_ads", - "stickied": True, - "url": "https://www.reddit.com/r/linux/comments/hm0qct/linux_experiencesrants_or_educationcertifications/", - "subreddit_subscribers": 544037, - "created_utc": 1594008682.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - ], - "after": "t3_hmytic", - "before": None, - }, -} - -image_mock = { - "data": { - "after": "t3_hr3mhe", - "before": None, - "children": [ - { - "data": { - "all_awardings": [], - "allow_live_comments": True, - "approved_at_utc": None, - "approved_by": None, - "archived": False, - "author": "SamLynn79", - "author_flair_background_color": None, - "author_flair_css_class": None, - "author_flair_richtext": [], - "author_flair_template_id": None, - "author_flair_text": None, - "author_flair_text_color": None, - "author_flair_type": "text", - "author_fullname": "t2_6c9cj", - "author_patreon_flair": False, - "author_premium": True, - "awarders": [], - "banned_at_utc": None, - "banned_by": None, - "can_gild": True, - "can_mod_post": False, - "category": None, - "clicked": False, - "content_categories": None, - "contest_mode": False, - "created": 1594777552.0, - "created_utc": 1594748752.0, - "discussion_type": None, - "distinguished": None, - "domain": "i.redd.it", - "downs": 0, - "edited": False, - "gilded": 1, - "gildings": {"gid_2": 1}, - "hidden": False, - "hide_score": False, - "id": "hr64xh", - "is_crosspostable": True, - "is_meta": False, - "is_original_content": False, - "is_reddit_media_domain": True, - "is_robot_indexable": True, - "is_self": False, - "is_video": False, - "likes": None, - "link_flair_background_color": "", - "link_flair_css_class": None, - "link_flair_richtext": [], - "link_flair_text": None, - "link_flair_text_color": "dark", - "link_flair_type": "text", - "locked": True, - "media": None, - "media_embed": {}, - "media_only": False, - "mod_note": None, - "mod_reason_by": None, - "mod_reason_title": None, - "mod_reports": [], - "name": "t3_hr64xh", - "no_follow": False, - "num_comments": 579, - "num_crossposts": 2, - "num_reports": None, - "over_18": False, - "parent_whitelist_status": "all_ads", - "permalink": "/r/aww/comments/hr64xh/yall_i_just_cant_this_is_my_son_judah_my_wife_and/", - "pinned": False, - "post_hint": "image", - "preview": { - "enabled": True, - "images": [ - { - "id": "xWBh4hObZx0zmG_IDOHBLNN-_NZzEss2dAgm1sm9p1w", - "resolutions": [ - { - "height": 135, - "url": "https://preview.redd.it/cm2qybia1va51.jpg?width=108&crop=smart&auto=webp&s=5374b8f3dff520eba8cf97b589ebc67206f130dc", - "width": 108, - }, - { - "height": 270, - "url": "https://preview.redd.it/cm2qybia1va51.jpg?width=216&crop=smart&auto=webp&s=09d937a8db6f843d9fd34ee024cdfc6432dc0a13", - "width": 216, - }, - { - "height": 400, - "url": "https://preview.redd.it/cm2qybia1va51.jpg?width=320&crop=smart&auto=webp&s=9ba3654c12cb54f6d9c2dce1b07c80ecd6ca9d06", - "width": 320, - }, - { - "height": 800, - "url": "https://preview.redd.it/cm2qybia1va51.jpg?width=640&crop=smart&auto=webp&s=8c53747ae0f92b65fdd41f3aab60ebb8f8d4b1ca", - "width": 640, - }, - { - "height": 1200, - "url": "https://preview.redd.it/cm2qybia1va51.jpg?width=960&crop=smart&auto=webp&s=5668a626da6cd69e23b6c01587783c6cc5817bea", - "width": 960, - }, - { - "height": 1350, - "url": "https://preview.redd.it/cm2qybia1va51.jpg?width=1080&crop=smart&auto=webp&s=8fdd61aed8718109f3739cb532d96be31192b9a0", - "width": 1080, - }, - ], - "source": { - "height": 1800, - "url": "https://preview.redd.it/cm2qybia1va51.jpg?auto=webp&s=17b817b8d0e35bddc7f605d242cd7d116ef8e235", - "width": 1440, - }, - "variants": {}, - } - ], - }, - "pwls": 6, - "quarantine": False, - "removal_reason": None, - "removed_by": None, - "removed_by_category": None, - "report_reasons": None, - "saved": False, - "score": 23419, - "secure_media": None, - "secure_media_embed": {}, - "selftext": "", - "selftext_html": None, - "send_replies": True, - "spoiler": False, - "stickied": False, - "subreddit": "aww", - "subreddit_id": "t5_2qh1o", - "subreddit_name_prefixed": "r/aww", - "subreddit_subscribers": 25634399, - "subreddit_type": "public", - "suggested_sort": None, - "thumbnail": "https://b.thumbs.redditmedia.com/0X39S2jBL66zQCUbJAtlRKeswI8uUxf3-7vmog0VLjc.jpg", - "thumbnail_height": 140, - "thumbnail_width": 140, - "title": "Ya’ll, I just can’t... this is my " - "son, Judah. My wife and I have no " - "idea how we created such a " - "beautiful child.", - "top_awarded_type": None, - "total_awards_received": 4, - "treatment_tags": [], - "ups": 23419, - "upvote_ratio": 0.72, - "url": "https://i.redd.it/cm2qybia1va51.jpg", - "url_overridden_by_dest": "https://i.redd.it/cm2qybia1va51.jpg", - "user_reports": [], - "view_count": None, - "visited": False, - "whitelist_status": "all_ads", - "wls": 6, - }, - "kind": "t3", - }, - { - "data": { - "all_awardings": [], - "allow_live_comments": True, - "approved_at_utc": None, - "approved_by": None, - "archived": False, - "author": "0_GG_0", - "author_flair_background_color": None, - "author_flair_css_class": None, - "author_flair_richtext": [], - "author_flair_template_id": None, - "author_flair_text": None, - "author_flair_text_color": None, - "author_flair_type": "text", - "author_fullname": "t2_70k94sn8", - "author_patreon_flair": False, - "author_premium": True, - "awarders": [], - "banned_at_utc": None, - "banned_by": None, - "can_gild": True, - "can_mod_post": False, - "category": None, - "clicked": False, - "content_categories": None, - "contest_mode": False, - "created": 1594771808.0, - "created_utc": 1594743008.0, - "discussion_type": None, - "distinguished": None, - "domain": "i.redd.it", - "downs": 0, - "edited": False, - "gilded": 0, - "gildings": {}, - "hidden": False, - "hide_score": False, - "id": "hr4bxo", - "is_crosspostable": True, - "is_meta": False, - "is_original_content": False, - "is_reddit_media_domain": True, - "is_robot_indexable": True, - "is_self": False, - "is_video": False, - "likes": None, - "link_flair_background_color": "", - "link_flair_css_class": "lc", - "link_flair_richtext": [], - "link_flair_text": None, - "link_flair_text_color": "dark", - "link_flair_type": "text", - "locked": False, - "media": None, - "media_embed": {}, - "media_only": False, - "mod_note": None, - "mod_reason_by": None, - "mod_reason_title": None, - "mod_reports": [], - "name": "t3_hr4bxo", - "no_follow": False, - "num_comments": 248, - "num_crossposts": 4, - "num_reports": None, - "over_18": False, - "parent_whitelist_status": "all_ads", - "permalink": "/r/aww/comments/hr4bxo/just_thought_yall_would_enjoy_my_goat_dressed_as/", - "pinned": False, - "post_hint": "image", - "preview": { - "enabled": True, - "images": [ - { - "id": "TSXyc6ZJGdCcHk7-wuWnJdVpqsa_t8hmVd4k_e3ofCA", - "resolutions": [ - { - "height": 144, - "url": "https://preview.redd.it/4udujbu6kua51.jpg?width=108&crop=smart&auto=webp&s=ed5a11a7637acc66de48e30fd51d5019fa0c69f7", - "width": 108, - }, - { - "height": 288, - "url": "https://preview.redd.it/4udujbu6kua51.jpg?width=216&crop=smart&auto=webp&s=a812bec268d8ea31dbb9dfe696e0798490538f5a", - "width": 216, - }, - { - "height": 426, - "url": "https://preview.redd.it/4udujbu6kua51.jpg?width=320&crop=smart&auto=webp&s=1be4e3bdea19243b0a627bacb4c9e04f2d3569a7", - "width": 320, - }, - { - "height": 853, - "url": "https://preview.redd.it/4udujbu6kua51.jpg?width=640&crop=smart&auto=webp&s=e73755c3f0b27bb0435d07aa60b32e091bed7957", - "width": 640, - }, - { - "height": 1280, - "url": "https://preview.redd.it/4udujbu6kua51.jpg?width=960&crop=smart&auto=webp&s=8ab6972fffc4786503284a0253e91e9104f2d01e", - "width": 960, - }, - { - "height": 1440, - "url": "https://preview.redd.it/4udujbu6kua51.jpg?width=1080&crop=smart&auto=webp&s=a1e554889179a7599786985679304fda706d83d6", - "width": 1080, - }, - ], - "source": { - "height": 4032, - "url": "https://preview.redd.it/4udujbu6kua51.jpg?auto=webp&s=3eefdef653e0a3a8a10090b804f0888ee6a1a163", - "width": 3024, - }, - "variants": {}, - } - ], - }, - "pwls": 6, - "quarantine": False, - "removal_reason": None, - "removed_by": None, - "removed_by_category": None, - "report_reasons": None, - "saved": False, - "score": 16684, - "secure_media": None, - "secure_media_embed": {}, - "selftext": "", - "selftext_html": None, - "send_replies": True, - "spoiler": False, - "stickied": False, - "subreddit": "aww", - "subreddit_id": "t5_2qh1o", - "subreddit_name_prefixed": "r/aww", - "subreddit_subscribers": 25634399, - "subreddit_type": "public", - "suggested_sort": None, - "thumbnail": "https://b.thumbs.redditmedia.com/h3Ylp4kb0uJzAsST4ZZGsGN8WGxK4wjK2XrM9uUH5uc.jpg", - "thumbnail_height": 140, - "thumbnail_width": 140, - "title": "Just thought y’all would enjoy my " - "goat dressed as a tractor", - "top_awarded_type": None, - "total_awards_received": 2, - "treatment_tags": [], - "ups": 16684, - "upvote_ratio": 0.98, - "url": "https://i.redd.it/4udujbu6kua51.jpg", - "url_overridden_by_dest": "https://i.redd.it/4udujbu6kua51.jpg", - "user_reports": [], - "view_count": None, - "visited": False, - "whitelist_status": "all_ads", - "wls": 6, - }, - "kind": "t3", - }, - { - "data": { - "all_awardings": [], - "allow_live_comments": True, - "approved_at_utc": None, - "approved_by": None, - "archived": False, - "author": "Mechanic619", - "author_flair_background_color": None, - "author_flair_css_class": None, - "author_flair_richtext": [], - "author_flair_template_id": None, - "author_flair_text": None, - "author_flair_text_color": None, - "author_flair_type": "text", - "author_fullname": "t2_4ptrdtz5", - "author_patreon_flair": False, - "author_premium": False, - "awarders": [], - "banned_at_utc": None, - "banned_by": None, - "can_gild": True, - "can_mod_post": False, - "category": None, - "clicked": False, - "content_categories": None, - "contest_mode": False, - "created": 1594760700.0, - "created_utc": 1594731900.0, - "discussion_type": None, - "distinguished": None, - "domain": "i.redd.it", - "downs": 0, - "edited": False, - "gilded": 0, - "gildings": {"gid_1": 1}, - "hidden": False, - "hide_score": False, - "id": "hr14y5", - "is_crosspostable": True, - "is_meta": False, - "is_original_content": False, - "is_reddit_media_domain": True, - "is_robot_indexable": True, - "is_self": False, - "is_video": False, - "likes": None, - "link_flair_background_color": "", - "link_flair_css_class": "lc", - "link_flair_richtext": [], - "link_flair_text": None, - "link_flair_text_color": "dark", - "link_flair_type": "text", - "locked": False, - "media": None, - "media_embed": {}, - "media_only": False, - "mod_note": None, - "mod_reason_by": None, - "mod_reason_title": None, - "mod_reports": [], - "name": "t3_hr14y5", - "no_follow": False, - "num_comments": 1439, - "num_crossposts": 20, - "num_reports": None, - "over_18": False, - "parent_whitelist_status": "all_ads", - "permalink": "/r/aww/comments/hr14y5/mosque_security_on_patrol/", - "pinned": False, - "post_hint": "image", - "preview": { - "enabled": True, - "images": [ - { - "id": "Qs_FmhJgYT8GWyxmDQ8kjBCs_w2V_77cvHvdqLJ7i4s", - "resolutions": [ - { - "height": 135, - "url": "https://preview.redd.it/jk08ge66nta51.jpg?width=108&crop=smart&auto=webp&s=cf4c24ef4f9be86d186c143296bd1e14f15f960a", - "width": 108, - }, - { - "height": 270, - "url": "https://preview.redd.it/jk08ge66nta51.jpg?width=216&crop=smart&auto=webp&s=308e2367a849334c32b579265ed738d9937bed71", - "width": 216, - }, - { - "height": 400, - "url": "https://preview.redd.it/jk08ge66nta51.jpg?width=320&crop=smart&auto=webp&s=bc890f054dc34bb3f8607a70d088926afe113ff1", - "width": 320, - }, - { - "height": 800, - "url": "https://preview.redd.it/jk08ge66nta51.jpg?width=640&crop=smart&auto=webp&s=e23a9bc2d8d1ac6ccefab7f30cfa9def741aaa25", - "width": 640, - }, - { - "height": 1201, - "url": "https://preview.redd.it/jk08ge66nta51.jpg?width=960&crop=smart&auto=webp&s=4d294d1626046d27edc2a281c21ab10502b9ca4c", - "width": 960, - }, - { - "height": 1351, - "url": "https://preview.redd.it/jk08ge66nta51.jpg?width=1080&crop=smart&auto=webp&s=a801e5d9d703204e8b1497d3038d6405b2ed1157", - "width": 1080, - }, - ], - "source": { - "height": 1413, - "url": "https://preview.redd.it/jk08ge66nta51.jpg?auto=webp&s=f4e87e2ad0f0e40ca4f7a08c2a894b234601f3ce", - "width": 1129, - }, - "variants": {}, - } - ], - }, - "pwls": 6, - "quarantine": False, - "removal_reason": None, - "removed_by": None, - "removed_by_category": None, - "report_reasons": None, - "saved": False, - "score": 89133, - "secure_media": None, - "secure_media_embed": {}, - "selftext": "", - "selftext_html": None, - "send_replies": True, - "spoiler": False, - "stickied": False, - "subreddit": "aww", - "subreddit_id": "t5_2qh1o", - "subreddit_name_prefixed": "r/aww", - "subreddit_subscribers": 25634399, - "subreddit_type": "public", - "suggested_sort": None, - "thumbnail": "https://b.thumbs.redditmedia.com/GGHjIElMHDgefR0UdMXVk8CHeDUBhuZMY_QHjls4ynA.jpg", - "thumbnail_height": 140, - "thumbnail_width": 140, - "title": "Mosque security on patrol", - "top_awarded_type": None, - "total_awards_received": 3, - "treatment_tags": [], - "ups": 89133, - "upvote_ratio": 0.93, - "url": "https://i.redd.it/jk08ge66nta51.jpg", - "url_overridden_by_dest": "https://i.redd.it/jk08ge66nta51.jpg", - "user_reports": [], - "view_count": None, - "visited": False, - "whitelist_status": "all_ads", - "wls": 6, - }, - "kind": "t3", - }, - { - "data": { - "all_awardings": [], - "allow_live_comments": False, - "approved_at_utc": None, - "approved_by": None, - "archived": False, - "author": "Amnesia19", - "author_cakeday": True, - "author_flair_background_color": None, - "author_flair_css_class": None, - "author_flair_richtext": [], - "author_flair_template_id": None, - "author_flair_text": None, - "author_flair_text_color": None, - "author_flair_type": "text", - "author_fullname": "t2_1rqe7gk1", - "author_patreon_flair": False, - "author_premium": False, - "awarders": [], - "banned_at_utc": None, - "banned_by": None, - "can_gild": True, - "can_mod_post": False, - "category": None, - "clicked": False, - "content_categories": None, - "contest_mode": False, - "created": 1594765470.0, - "created_utc": 1594736670.0, - "discussion_type": None, - "distinguished": None, - "domain": "i.redd.it", - "downs": 0, - "edited": False, - "gilded": 0, - "gildings": {}, - "hidden": False, - "hide_score": False, - "id": "hr2fv0", - "is_crosspostable": True, - "is_meta": False, - "is_original_content": False, - "is_reddit_media_domain": True, - "is_robot_indexable": True, - "is_self": False, - "is_video": False, - "likes": None, - "link_flair_background_color": "", - "link_flair_css_class": None, - "link_flair_richtext": [], - "link_flair_text": None, - "link_flair_text_color": "dark", - "link_flair_type": "text", - "locked": False, - "media": None, - "media_embed": {}, - "media_only": False, - "mod_note": None, - "mod_reason_by": None, - "mod_reason_title": None, - "mod_reports": [], - "name": "t3_hr2fv0", - "no_follow": False, - "num_comments": 71, - "num_crossposts": 1, - "num_reports": None, - "over_18": False, - "parent_whitelist_status": "all_ads", - "permalink": "/r/aww/comments/hr2fv0/the_look_my_dog_gives_my_grandpa/", - "pinned": False, - "post_hint": "image", - "preview": { - "enabled": True, - "images": [ - { - "id": "v0BbkKy6haXmUxmHz4oXygoR0E-cHkvZDACWL_s7STw", - "resolutions": [ - { - "height": 144, - "url": "https://preview.redd.it/y6q7bgzc1ua51.jpg?width=108&crop=smart&auto=webp&s=4e65e8ff55c02de0ebe79763c91fe43f51216717", - "width": 108, - }, - { - "height": 288, - "url": "https://preview.redd.it/y6q7bgzc1ua51.jpg?width=216&crop=smart&auto=webp&s=e2006e5fe7ac43f911c17dc7f185f33db24e3b52", - "width": 216, - }, - { - "height": 426, - "url": "https://preview.redd.it/y6q7bgzc1ua51.jpg?width=320&crop=smart&auto=webp&s=3dad39d5e48a1b176f7e87b2dd110fb0044b32d7", - "width": 320, - }, - { - "height": 853, - "url": "https://preview.redd.it/y6q7bgzc1ua51.jpg?width=640&crop=smart&auto=webp&s=2f8e86a3feca27a23a72d10b92aba1b79b80f7be", - "width": 640, - }, - { - "height": 1280, - "url": "https://preview.redd.it/y6q7bgzc1ua51.jpg?width=960&crop=smart&auto=webp&s=5ecdd44b728031f8e109f41f99841a1d6c8e86c8", - "width": 960, - }, - { - "height": 1440, - "url": "https://preview.redd.it/y6q7bgzc1ua51.jpg?width=1080&crop=smart&auto=webp&s=49555499040c0ac9958dabd98cbe4e90c054b2a7", - "width": 1080, - }, - ], - "source": { - "height": 4032, - "url": "https://preview.redd.it/y6q7bgzc1ua51.jpg?auto=webp&s=443e98e46a8a096e426ebdc256c45682f46ebe2a", - "width": 3024, - }, - "variants": {}, - } - ], - }, - "pwls": 6, - "quarantine": False, - "removal_reason": None, - "removed_by": None, - "removed_by_category": None, - "report_reasons": None, - "saved": False, - "score": 13614, - "secure_media": None, - "secure_media_embed": {}, - "selftext": "", - "selftext_html": None, - "send_replies": True, - "spoiler": False, - "stickied": False, - "subreddit": "aww", - "subreddit_id": "t5_2qh1o", - "subreddit_name_prefixed": "r/aww", - "subreddit_subscribers": 25634399, - "subreddit_type": "public", - "suggested_sort": None, - "thumbnail": "https://b.thumbs.redditmedia.com/RWRuGJ7ZyBtjO6alY1vbc65TQzgng8RFRWnPG7WUkhE.jpg", - "thumbnail_height": 140, - "thumbnail_width": 140, - "title": "The look my dog gives my grandpa", - "top_awarded_type": None, - "total_awards_received": 0, - "treatment_tags": [], - "ups": 13614, - "upvote_ratio": 0.99, - "url": "https://i.redd.it/y6q7bgzc1ua51.jpg", - "url_overridden_by_dest": "https://i.redd.it/y6q7bgzc1ua51.jpg", - "user_reports": [], - "view_count": None, - "visited": False, - "whitelist_status": "all_ads", - "wls": 6, - }, - "kind": "t3", - }, - ], - "dist": 25, - "modhash": None, - }, - "kind": "Listing", -} - -external_image_mock = { - "data": { - "after": "t3_hr3mhe", - "before": None, - "children": [ - { - "data": { - "all_awardings": [], - "allow_live_comments": False, - "approved_at_utc": None, - "approved_by": None, - "archived": False, - "author": "Captainbuttsreads", - "author_flair_background_color": None, - "author_flair_css_class": None, - "author_flair_richtext": [], - "author_flair_template_id": None, - "author_flair_text": None, - "author_flair_text_color": None, - "author_flair_type": "text", - "author_fullname": "t2_5qaat4af", - "author_patreon_flair": False, - "author_premium": False, - "awarders": [], - "banned_at_utc": None, - "banned_by": None, - "can_gild": True, - "can_mod_post": False, - "category": None, - "clicked": False, - "content_categories": None, - "contest_mode": False, - "created": 1594770844.0, - "created_utc": 1594742044.0, - "crosspost_parent": "t3_gc6eq2", - "crosspost_parent_list": [], - "discussion_type": None, - "distinguished": None, - "domain": "gfycat.com", - "downs": 0, - "edited": False, - "gilded": 0, - "gildings": {}, - "hidden": False, - "hide_score": False, - "id": "hr41am", - "is_crosspostable": True, - "is_meta": False, - "is_original_content": False, - "is_reddit_media_domain": False, - "is_robot_indexable": True, - "is_self": False, - "is_video": False, - "likes": None, - "link_flair_background_color": "", - "link_flair_css_class": None, - "link_flair_richtext": [], - "link_flair_text": None, - "link_flair_text_color": "dark", - "link_flair_type": "text", - "locked": False, - "media": None, - "media_embed": {}, - "media_only": False, - "mod_note": None, - "mod_reason_by": None, - "mod_reason_title": None, - "mod_reports": [], - "name": "t3_hr41am", - "no_follow": False, - "num_comments": 45, - "num_crossposts": 0, - "num_reports": None, - "over_18": False, - "parent_whitelist_status": "all_ads", - "permalink": "/r/aww/comments/hr41am/excited_cows_have_a_new_brush/", - "pinned": False, - "post_hint": "link", - "preview": { - "enabled": False, - "images": [ - { - "id": "l5tVSe6B4QDc7wk6Z9WfCXr20D_rAOHerf6i0N53nNc", - "resolutions": [ - { - "height": 108, - "url": "https://external-preview.redd.it/R51JAzaGbva91vYxn9uWL3NwCzWJW5mrdVxb1idjtBg.jpg?width=108&crop=smart&auto=webp&s=f908e1fb9403194a31f9a0c1f056f59e0718201e", - "width": 108, - }, - { - "height": 216, - "url": "https://external-preview.redd.it/R51JAzaGbva91vYxn9uWL3NwCzWJW5mrdVxb1idjtBg.jpg?width=216&crop=smart&auto=webp&s=de377df68832a52419d83c06ea74a13de28b96e0", - "width": 216, - }, - ], - "source": { - "height": 250, - "url": "https://external-preview.redd.it/R51JAzaGbva91vYxn9uWL3NwCzWJW5mrdVxb1idjtBg.jpg?auto=webp&s=b4166cb5a350e6d0197381cdf8db702f8a760493", - "width": 250, - }, - "variants": {}, - } - ], - "reddit_video_preview": { - "dash_url": "https://v.redd.it/mimyo7z6ppa51/DASHPlaylist.mpd", - "duration": 33, - "fallback_url": "https://v.redd.it/mimyo7z6ppa51/DASH_480.mp4", - "height": 640, - "hls_url": "https://v.redd.it/mimyo7z6ppa51/HLSPlaylist.m3u8", - "is_gif": True, - "scrubber_media_url": "https://v.redd.it/mimyo7z6ppa51/DASH_96.mp4", - "transcoding_status": "completed", - "width": 640, - }, - }, - "pwls": 6, - "quarantine": False, - "removal_reason": None, - "removed_by": None, - "removed_by_category": None, - "report_reasons": None, - "saved": False, - "score": 3219, - "secure_media": None, - "secure_media_embed": {}, - "selftext": "", - "selftext_html": None, - "send_replies": False, - "spoiler": False, - "stickied": False, - "subreddit": "aww", - "subreddit_id": "t5_2qh1o", - "subreddit_name_prefixed": "r/aww", - "subreddit_subscribers": 25634399, - "subreddit_type": "public", - "suggested_sort": None, - "thumbnail": "https://b.thumbs.redditmedia.com/NKTwvIU2xxoOMpzYNlYYstS2586x64Gi--52N0M-OJY.jpg", - "thumbnail_height": 140, - "thumbnail_width": 140, - "title": "Excited cows have a new brush!", - "top_awarded_type": None, - "total_awards_received": 0, - "treatment_tags": [], - "ups": 3219, - "upvote_ratio": 0.99, - "url": "http://gfycat.com/thatalivedogwoodclubgall", - "url_overridden_by_dest": "http://gfycat.com/thatalivedogwoodclubgall", - "user_reports": [], - "view_count": None, - "visited": False, - "whitelist_status": "all_ads", - "wls": 6, - }, - "kind": "t3", - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "aww", - "selftext": "", - "author_fullname": "t2_78ni2", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Novosibirsk Zoo welcomes 16 cobalt-eyed Pallas’s cat kittens", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/aww", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "thumbnail_height": 93, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_huoldn", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.99, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 1933, - "total_awards_received": 0, - "media_embed": {}, - "thumbnail_width": 140, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 1933, - "approved_by": None, - "author_premium": False, - "thumbnail": "https://a.thumbs.redditmedia.com/j-D-Z79QQ6tGk0E3SGdb8GzqbLVUY3lu59tDaXbOYl8.jpg", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "post_hint": "image", - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1595292144, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "i.imgur.com", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://i.imgur.com/usfMVUJ.jpg", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": False, - "pinned": False, - "over_18": False, - "preview": { - "images": [ - { - "source": { - "url": "https://external-preview.redd.it/iPfDCL-dfB4_TmnGsMEXWJMzxXmBEMPuV5ejLkYBNVo.jpg?auto=webp&s=2126d34a0134efa94ecab03917944709c8bc3305", - "width": 1024, - "height": 682, - }, - "resolutions": [ - { - "url": "https://external-preview.redd.it/iPfDCL-dfB4_TmnGsMEXWJMzxXmBEMPuV5ejLkYBNVo.jpg?width=108&crop=smart&auto=webp&s=710a44f787b98a0a37ca543b7428917ee55b3c46", - "width": 108, - "height": 71, - }, - { - "url": "https://external-preview.redd.it/iPfDCL-dfB4_TmnGsMEXWJMzxXmBEMPuV5ejLkYBNVo.jpg?width=216&crop=smart&auto=webp&s=b1bcdd7734a3a569f99fa88c6be9447105e58276", - "width": 216, - "height": 143, - }, - { - "url": "https://external-preview.redd.it/iPfDCL-dfB4_TmnGsMEXWJMzxXmBEMPuV5ejLkYBNVo.jpg?width=320&crop=smart&auto=webp&s=1671bf09a7b73d0ca51cf2de884b37d6a3591d6a", - "width": 320, - "height": 213, - }, - { - "url": "https://external-preview.redd.it/iPfDCL-dfB4_TmnGsMEXWJMzxXmBEMPuV5ejLkYBNVo.jpg?width=640&crop=smart&auto=webp&s=9fcdddbaeaad13273e0b53a862c73c4fee9f7e3d", - "width": 640, - "height": 426, - }, - { - "url": "https://external-preview.redd.it/iPfDCL-dfB4_TmnGsMEXWJMzxXmBEMPuV5ejLkYBNVo.jpg?width=960&crop=smart&auto=webp&s=e531480236c0ae72b78f27dd88f2cedc9f73cccc", - "width": 960, - "height": 639, - }, - ], - "variants": {}, - "id": "oJ9pHVA-JhoodtgNlku8ZQv8FhtadS2r36wGLAriUtY", - } - ], - "enabled": True, - }, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": False, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1o", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "huoldn", - "is_robot_indexable": True, - "report_reasons": None, - "author": "Ben_zyl", - "discussion_type": None, - "num_comments": 20, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/aww/comments/huoldn/novosibirsk_zoo_welcomes_16_cobalteyed_pallass/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://i.imgur.com/usfMVUJ.jpg", - "subreddit_subscribers": 25723833, - "created_utc": 1595263344, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - ], - "dist": 25, - "modhash": None, - }, - "kind": "Listing", -} - -video_mock = { - "data": { - "after": "t3_hr3mhe", - "before": None, - "children": [ - { - "data": { - "all_awardings": [], - "allow_live_comments": False, - "approved_at_utc": None, - "approved_by": None, - "archived": False, - "author": "TommyLondoner", - "author_flair_background_color": None, - "author_flair_css_class": None, - "author_flair_richtext": [], - "author_flair_template_id": None, - "author_flair_text": None, - "author_flair_text_color": None, - "author_flair_type": "text", - "author_fullname": "t2_75bis9gi", - "author_patreon_flair": False, - "author_premium": True, - "awarders": [], - "banned_at_utc": None, - "banned_by": None, - "can_gild": True, - "can_mod_post": False, - "category": None, - "clicked": False, - "content_categories": None, - "contest_mode": False, - "created": 1594767660.0, - "created_utc": 1594738860.0, - "discussion_type": None, - "distinguished": None, - "domain": "v.redd.it", - "downs": 0, - "edited": False, - "gilded": 1, - "gildings": {"gid_2": 1}, - "hidden": False, - "hide_score": False, - "id": "hr32jf", - "is_crosspostable": True, - "is_meta": False, - "is_original_content": False, - "is_reddit_media_domain": True, - "is_robot_indexable": True, - "is_self": False, - "is_video": True, - "likes": None, - "link_flair_background_color": "", - "link_flair_css_class": "lc", - "link_flair_richtext": [], - "link_flair_text": None, - "link_flair_text_color": "dark", - "link_flair_type": "text", - "locked": False, - "media": { - "reddit_video": { - "dash_url": "https://v.redd.it/9avhmd5s7ua51/DASHPlaylist.mpd?a=1597351258%2CODVjMjcyMDkzOWE1NDBiNzUwNzVhNDUwYmE0MGNiNzk5MGRmZmZmMzBhZjIzNDAzYzczY2NkNzRjNTgyMjAzNQ%3D%3D&v=1&f=sd", - "duration": 78, - "fallback_url": "https://v.redd.it/9avhmd5s7ua51/DASH_360.mp4?source=fallback", - "height": 428, - "hls_url": "https://v.redd.it/9avhmd5s7ua51/HLSPlaylist.m3u8?a=1597351258%2CNjE4YTA0NjUwZWNmNjhjNTRhNmU4ZjBmNDMyYWYxOGYzZTNkZWM2YjViM2I2ZDZjZWNhYzY0ZGVmOWU0Y2EyYg%3D%3D&v=1&f=sd", - "is_gif": False, - "scrubber_media_url": "https://v.redd.it/9avhmd5s7ua51/DASH_96.mp4", - "transcoding_status": "completed", - "width": 258, - } - }, - "media_embed": {}, - "media_only": False, - "mod_note": None, - "mod_reason_by": None, - "mod_reason_title": None, - "mod_reports": [], - "name": "t3_hr32jf", - "no_follow": False, - "num_comments": 150, - "num_crossposts": 2, - "num_reports": None, - "over_18": False, - "parent_whitelist_status": "all_ads", - "permalink": "/r/aww/comments/hr32jf/this_guy_definitely_loves_his_job/", - "pinned": False, - "post_hint": "hosted:video", - "preview": { - "enabled": False, - "images": [ - { - "id": "dX_mx_ZfJMwVn_pak9ZPQq8rMT_gPkW0_4gOzDxPSHM", - "resolutions": [ - { - "height": 179, - "url": "https://external-preview.redd.it/PMy-Z___DIG6aWnoyEy1VKottxLQFWCRSdHDV1a9N8w.png?width=108&crop=smart&format=pjpg&auto=webp&s=e0b8b68a78a8e9071bf56417ac6589bc8aff7634", - "width": 108, - }, - { - "height": 358, - "url": "https://external-preview.redd.it/PMy-Z___DIG6aWnoyEy1VKottxLQFWCRSdHDV1a9N8w.png?width=216&crop=smart&format=pjpg&auto=webp&s=8668c3c7ccbdacfe3376d8af4b1b49df9d6aec97", - "width": 216, - }, - ], - "source": { - "height": 428, - "url": "https://external-preview.redd.it/PMy-Z___DIG6aWnoyEy1VKottxLQFWCRSdHDV1a9N8w.png?format=pjpg&auto=webp&s=b0b6439fbe01c3f5d1bf1eae54a588cc745d3415", - "width": 258, - }, - "variants": {}, - } - ], - }, - "pwls": 6, - "quarantine": False, - "removal_reason": None, - "removed_by": None, - "removed_by_category": None, - "report_reasons": None, - "saved": False, - "score": 9324, - "secure_media": { - "reddit_video": { - "dash_url": "https://v.redd.it/9avhmd5s7ua51/DASHPlaylist.mpd?a=1597351258%2CODVjMjcyMDkzOWE1NDBiNzUwNzVhNDUwYmE0MGNiNzk5MGRmZmZmMzBhZjIzNDAzYzczY2NkNzRjNTgyMjAzNQ%3D%3D&v=1&f=sd", - "duration": 78, - "fallback_url": "https://v.redd.it/9avhmd5s7ua51/DASH_360.mp4?source=fallback", - "height": 428, - "hls_url": "https://v.redd.it/9avhmd5s7ua51/HLSPlaylist.m3u8?a=1597351258%2CNjE4YTA0NjUwZWNmNjhjNTRhNmU4ZjBmNDMyYWYxOGYzZTNkZWM2YjViM2I2ZDZjZWNhYzY0ZGVmOWU0Y2EyYg%3D%3D&v=1&f=sd", - "is_gif": False, - "scrubber_media_url": "https://v.redd.it/9avhmd5s7ua51/DASH_96.mp4", - "transcoding_status": "completed", - "width": 258, - } - }, - "secure_media_embed": {}, - "selftext": "", - "selftext_html": None, - "send_replies": True, - "spoiler": False, - "stickied": False, - "subreddit": "aww", - "subreddit_id": "t5_2qh1o", - "subreddit_name_prefixed": "r/aww", - "subreddit_subscribers": 25634399, - "subreddit_type": "public", - "suggested_sort": None, - "thumbnail": "https://b.thumbs.redditmedia.com/ibsS3H5xMLDSVglh8NBYJ4cgIsXuqYVLJWbiYVTykXg.jpg", - "thumbnail_height": 140, - "thumbnail_width": 140, - "title": "This guy definitely loves his job !", - "top_awarded_type": None, - "total_awards_received": 1, - "treatment_tags": [], - "ups": 9324, - "upvote_ratio": 0.96, - "url": "https://v.redd.it/9avhmd5s7ua51", - "url_overridden_by_dest": "https://v.redd.it/9avhmd5s7ua51", - "user_reports": [], - "view_count": None, - "visited": False, - "whitelist_status": "all_ads", - "wls": 6, - }, - "kind": "t3", - }, - { - "data": { - "all_awardings": [], - "allow_live_comments": True, - "approved_at_utc": None, - "approved_by": None, - "archived": False, - "author": "LucileEsparza", - "author_flair_background_color": None, - "author_flair_css_class": None, - "author_flair_richtext": [], - "author_flair_template_id": None, - "author_flair_text": None, - "author_flair_text_color": None, - "author_flair_type": "text", - "author_fullname": "t2_5loa1v96", - "author_patreon_flair": False, - "author_premium": False, - "awarders": [], - "banned_at_utc": None, - "banned_by": None, - "can_gild": True, - "can_mod_post": False, - "category": None, - "clicked": False, - "content_categories": None, - "contest_mode": False, - "created": 1594762969.0, - "created_utc": 1594734169.0, - "discussion_type": None, - "distinguished": None, - "domain": "v.redd.it", - "downs": 0, - "edited": False, - "gilded": 0, - "gildings": {}, - "hidden": False, - "hide_score": False, - "id": "hr1r00", - "is_crosspostable": True, - "is_meta": False, - "is_original_content": False, - "is_reddit_media_domain": True, - "is_robot_indexable": True, - "is_self": False, - "is_video": True, - "likes": None, - "link_flair_background_color": "", - "link_flair_css_class": "lc", - "link_flair_richtext": [], - "link_flair_text": None, - "link_flair_text_color": "dark", - "link_flair_type": "text", - "locked": False, - "media": { - "reddit_video": { - "dash_url": "https://v.redd.it/eyvbxaeqtta51/DASHPlaylist.mpd?a=1597351258%2CYjJmMWE3ZGJmM2FhMzVkYzZlNjIzOTAwM2ZmZTBkYjAxMzE0NDY2MDIyNGRhOWViMTViZTE0NTlmMzkzM2JlYg%3D%3D&v=1&f=sd", - "duration": 8, - "fallback_url": "https://v.redd.it/eyvbxaeqtta51/DASH_480.mp4?source=fallback", - "height": 640, - "hls_url": "https://v.redd.it/eyvbxaeqtta51/HLSPlaylist.m3u8?a=1597351258%2CY2JiMmQ0MjliNmE5NTA5MDE3YjAyNmVkYTg2Yjg1YWYwYmJlNDE4ZGM1NjE4ZDU3YjkzYjJlMDE2ZmM4Yzk5MQ%3D%3D&v=1&f=sd", - "is_gif": False, - "scrubber_media_url": "https://v.redd.it/eyvbxaeqtta51/DASH_96.mp4", - "transcoding_status": "completed", - "width": 640, - } - }, - "media_embed": {}, - "media_only": False, - "mod_note": None, - "mod_reason_by": None, - "mod_reason_title": None, - "mod_reports": [], - "name": "t3_hr1r00", - "no_follow": False, - "num_comments": 63, - "num_crossposts": 3, - "num_reports": None, - "over_18": False, - "parent_whitelist_status": "all_ads", - "permalink": "/r/aww/comments/hr1r00/cool_catt_and_his_clingy_girlfriend/", - "pinned": False, - "post_hint": "hosted:video", - "preview": { - "enabled": False, - "images": [ - { - "id": "wrscJ_l9A6Q_Mn1NAg06I4o3W39bbNgTBYg2Xm_Vl8U", - "resolutions": [ - { - "height": 108, - "url": "https://external-preview.redd.it/GkeXMqmDn03NOYgnIk0QDQAS8HfRacPrmYvyTUSv6w0.png?width=108&crop=smart&format=pjpg&auto=webp&s=f285ef95065be8a340e1cb7792d80a9640564eb6", - "width": 108, - }, - { - "height": 216, - "url": "https://external-preview.redd.it/GkeXMqmDn03NOYgnIk0QDQAS8HfRacPrmYvyTUSv6w0.png?width=216&crop=smart&format=pjpg&auto=webp&s=6d26b4f8d7b16f0f02bc6ce6f35af889b43cf026", - "width": 216, - }, - { - "height": 320, - "url": "https://external-preview.redd.it/GkeXMqmDn03NOYgnIk0QDQAS8HfRacPrmYvyTUSv6w0.png?width=320&crop=smart&format=pjpg&auto=webp&s=5d081467da187bd8c24e9c524583513ee6afe388", - "width": 320, - }, - { - "height": 640, - "url": "https://external-preview.redd.it/GkeXMqmDn03NOYgnIk0QDQAS8HfRacPrmYvyTUSv6w0.png?width=640&crop=smart&format=pjpg&auto=webp&s=557369f302f18b35284ffaacaccf09986f755187", - "width": 640, - }, - ], - "source": { - "height": 640, - "url": "https://external-preview.redd.it/GkeXMqmDn03NOYgnIk0QDQAS8HfRacPrmYvyTUSv6w0.png?format=pjpg&auto=webp&s=cb0a79a2effe0323e862fb713dab76b39051afbb", - "width": 640, - }, - "variants": {}, - } - ], - }, - "pwls": 6, - "quarantine": False, - "removal_reason": None, - "removed_by": None, - "removed_by_category": None, - "report_reasons": None, - "saved": False, - "score": 11007, - "secure_media": { - "reddit_video": { - "dash_url": "https://v.redd.it/eyvbxaeqtta51/DASHPlaylist.mpd?a=1597351258%2CYjJmMWE3ZGJmM2FhMzVkYzZlNjIzOTAwM2ZmZTBkYjAxMzE0NDY2MDIyNGRhOWViMTViZTE0NTlmMzkzM2JlYg%3D%3D&v=1&f=sd", - "duration": 8, - "fallback_url": "https://v.redd.it/eyvbxaeqtta51/DASH_480.mp4?source=fallback", - "height": 640, - "hls_url": "https://v.redd.it/eyvbxaeqtta51/HLSPlaylist.m3u8?a=1597351258%2CY2JiMmQ0MjliNmE5NTA5MDE3YjAyNmVkYTg2Yjg1YWYwYmJlNDE4ZGM1NjE4ZDU3YjkzYjJlMDE2ZmM4Yzk5MQ%3D%3D&v=1&f=sd", - "is_gif": False, - "scrubber_media_url": "https://v.redd.it/eyvbxaeqtta51/DASH_96.mp4", - "transcoding_status": "completed", - "width": 640, - } - }, - "secure_media_embed": {}, - "selftext": "", - "selftext_html": None, - "send_replies": False, - "spoiler": False, - "stickied": False, - "subreddit": "aww", - "subreddit_id": "t5_2qh1o", - "subreddit_name_prefixed": "r/aww", - "subreddit_subscribers": 25634399, - "subreddit_type": "public", - "suggested_sort": None, - "thumbnail": "https://b.thumbs.redditmedia.com/WSBiDcoWPwAgSkt08uCI6TK7v_tdAdHmQHv7TePyTOs.jpg", - "thumbnail_height": 140, - "thumbnail_width": 140, - "title": "Cool catt and his clingy girlfriend", - "top_awarded_type": None, - "total_awards_received": 1, - "treatment_tags": [], - "ups": 11007, - "upvote_ratio": 0.99, - "url": "https://v.redd.it/eyvbxaeqtta51", - "url_overridden_by_dest": "https://v.redd.it/eyvbxaeqtta51", - "user_reports": [], - "view_count": None, - "visited": False, - "whitelist_status": "all_ads", - "wls": 6, - }, - "kind": "t3", - }, - { - "data": { - "all_awardings": [], - "allow_live_comments": False, - "approved_at_utc": None, - "approved_by": None, - "archived": False, - "author": "memezzer", - "author_flair_background_color": "", - "author_flair_css_class": "k", - "author_flair_richtext": [], - "author_flair_template_id": None, - "author_flair_text": None, - "author_flair_text_color": "dark", - "author_flair_type": "text", - "author_fullname": "t2_41jaebm4", - "author_patreon_flair": False, - "author_premium": True, - "awarders": [], - "banned_at_utc": None, - "banned_by": None, - "can_gild": True, - "can_mod_post": False, - "category": None, - "clicked": False, - "content_categories": None, - "contest_mode": False, - "created": 1594759625.0, - "created_utc": 1594730825.0, - "discussion_type": None, - "distinguished": None, - "domain": "v.redd.it", - "downs": 0, - "edited": False, - "gilded": 0, - "gildings": {}, - "hidden": False, - "hide_score": False, - "id": "hr0uzh", - "is_crosspostable": True, - "is_meta": False, - "is_original_content": False, - "is_reddit_media_domain": True, - "is_robot_indexable": True, - "is_self": False, - "is_video": True, - "likes": None, - "link_flair_background_color": "", - "link_flair_css_class": None, - "link_flair_richtext": [], - "link_flair_text": None, - "link_flair_text_color": "dark", - "link_flair_type": "text", - "locked": False, - "media": { - "reddit_video": { - "dash_url": "https://v.redd.it/y0mavwswjta51/DASHPlaylist.mpd?a=1597351258%2CYjU1NzFjOTE0YzY2OTdmODk3MGRiMGU4MjdhOGE5ODk2YWNiODQyMGUyOWRhNzI1M2U1MTEyZjBhOWZkZTZmMw%3D%3D&v=1&f=sd", - "duration": 8, - "fallback_url": "https://v.redd.it/y0mavwswjta51/DASH_720.mp4?source=fallback", - "height": 960, - "hls_url": "https://v.redd.it/y0mavwswjta51/HLSPlaylist.m3u8?a=1597351258%2CODk4NTdhMzA3NmY2ZmY2NGQxMmI2ZjcyMzk0ZTFhOTdhOGI4NGQ1NjBiMzNiMmVmZDBhMTQ4MGRkOWJlOWU1YQ%3D%3D&v=1&f=sd", - "is_gif": False, - "scrubber_media_url": "https://v.redd.it/y0mavwswjta51/DASH_96.mp4", - "transcoding_status": "completed", - "width": 960, - } - }, - "media_embed": {}, - "media_only": False, - "mod_note": None, - "mod_reason_by": None, - "mod_reason_title": None, - "mod_reports": [], - "name": "t3_hr0uzh", - "no_follow": False, - "num_comments": 86, - "num_crossposts": 3, - "num_reports": None, - "over_18": False, - "parent_whitelist_status": "all_ads", - "permalink": "/r/aww/comments/hr0uzh/good_pillow/", - "pinned": False, - "post_hint": "hosted:video", - "preview": { - "enabled": False, - "images": [ - { - "id": "neoTdGv5lMArlfu6euGUK_v_O87Lfmdrrz1ePTwzp1w", - "resolutions": [ - { - "height": 108, - "url": "https://external-preview.redd.it/E3alyJV8xErhjjDt_Qujcd0ZqmUhGOSFINXALm2FZAQ.png?width=108&crop=smart&format=pjpg&auto=webp&s=dcc1172b7ace007e8c72080519a16a487596d7e2", - "width": 108, - }, - { - "height": 216, - "url": "https://external-preview.redd.it/E3alyJV8xErhjjDt_Qujcd0ZqmUhGOSFINXALm2FZAQ.png?width=216&crop=smart&format=pjpg&auto=webp&s=a7968ce1aa34957a7f7103d06a66d4f9df95d437", - "width": 216, - }, - { - "height": 320, - "url": "https://external-preview.redd.it/E3alyJV8xErhjjDt_Qujcd0ZqmUhGOSFINXALm2FZAQ.png?width=320&crop=smart&format=pjpg&auto=webp&s=a2302d80948fba08e91db0a10db579341e1df712", - "width": 320, - }, - { - "height": 640, - "url": "https://external-preview.redd.it/E3alyJV8xErhjjDt_Qujcd0ZqmUhGOSFINXALm2FZAQ.png?width=640&crop=smart&format=pjpg&auto=webp&s=a8487450d38d14bcdfda2aeb659b453d8b1cacab", - "width": 640, - }, - { - "height": 960, - "url": "https://external-preview.redd.it/E3alyJV8xErhjjDt_Qujcd0ZqmUhGOSFINXALm2FZAQ.png?width=960&crop=smart&format=pjpg&auto=webp&s=d371bee68cab49130babe4b890c6323db128c214", - "width": 960, - }, - ], - "source": { - "height": 960, - "url": "https://external-preview.redd.it/E3alyJV8xErhjjDt_Qujcd0ZqmUhGOSFINXALm2FZAQ.png?format=pjpg&auto=webp&s=ff90de8f0a693afeca69dc85dbecb6af9783c769", - "width": 960, - }, - "variants": {}, - } - ], - }, - "pwls": 6, - "quarantine": False, - "removal_reason": None, - "removed_by": None, - "removed_by_category": None, - "report_reasons": None, - "saved": False, - "score": 13271, - "secure_media": { - "reddit_video": { - "dash_url": "https://v.redd.it/y0mavwswjta51/DASHPlaylist.mpd?a=1597351258%2CYjU1NzFjOTE0YzY2OTdmODk3MGRiMGU4MjdhOGE5ODk2YWNiODQyMGUyOWRhNzI1M2U1MTEyZjBhOWZkZTZmMw%3D%3D&v=1&f=sd", - "duration": 8, - "fallback_url": "https://v.redd.it/y0mavwswjta51/DASH_720.mp4?source=fallback", - "height": 960, - "hls_url": "https://v.redd.it/y0mavwswjta51/HLSPlaylist.m3u8?a=1597351258%2CODk4NTdhMzA3NmY2ZmY2NGQxMmI2ZjcyMzk0ZTFhOTdhOGI4NGQ1NjBiMzNiMmVmZDBhMTQ4MGRkOWJlOWU1YQ%3D%3D&v=1&f=sd", - "is_gif": False, - "scrubber_media_url": "https://v.redd.it/y0mavwswjta51/DASH_96.mp4", - "transcoding_status": "completed", - "width": 960, - } - }, - "secure_media_embed": {}, - "selftext": "", - "selftext_html": None, - "send_replies": True, - "spoiler": False, - "stickied": False, - "subreddit": "aww", - "subreddit_id": "t5_2qh1o", - "subreddit_name_prefixed": "r/aww", - "subreddit_subscribers": 25634399, - "subreddit_type": "public", - "suggested_sort": "confidence", - "thumbnail": "https://b.thumbs.redditmedia.com/sxFESWCVsSf4ij5_-a1xdJaFhSU2MjJ5T_TVFbook6Q.jpg", - "thumbnail_height": 140, - "thumbnail_width": 140, - "title": "Good pillow", - "top_awarded_type": None, - "total_awards_received": 0, - "treatment_tags": [], - "ups": 13271, - "upvote_ratio": 0.99, - "url": "https://v.redd.it/y0mavwswjta51", - "url_overridden_by_dest": "https://v.redd.it/y0mavwswjta51", - "user_reports": [], - "view_count": None, - "visited": False, - "whitelist_status": "all_ads", - "wls": 6, - }, - "kind": "t3", - }, - { - "data": { - "all_awardings": [], - "allow_live_comments": True, - "approved_at_utc": None, - "approved_by": None, - "archived": False, - "author": "asdfpartyy", - "author_flair_background_color": None, - "author_flair_css_class": None, - "author_flair_richtext": [], - "author_flair_template_id": None, - "author_flair_text": None, - "author_flair_text_color": None, - "author_flair_type": "text", - "author_fullname": "t2_t0ay0", - "author_patreon_flair": False, - "author_premium": True, - "awarders": [], - "banned_at_utc": None, - "banned_by": None, - "can_gild": True, - "can_mod_post": False, - "category": None, - "clicked": False, - "content_categories": None, - "contest_mode": False, - "created": 1594745472.0, - "created_utc": 1594716672.0, - "discussion_type": None, - "distinguished": None, - "domain": "v.redd.it", - "downs": 0, - "edited": False, - "gilded": 1, - "gildings": {"gid_2": 1}, - "hidden": False, - "hide_score": False, - "id": "hqy0ny", - "is_crosspostable": True, - "is_meta": False, - "is_original_content": False, - "is_reddit_media_domain": True, - "is_robot_indexable": True, - "is_self": False, - "is_video": True, - "likes": None, - "link_flair_background_color": "", - "link_flair_css_class": None, - "link_flair_richtext": [], - "link_flair_text": None, - "link_flair_text_color": "dark", - "link_flair_type": "text", - "locked": False, - "media": { - "reddit_video": { - "dash_url": "https://v.redd.it/asj4p03rdsa51/DASHPlaylist.mpd?a=1597351258%2CY2VmYTAyMWNmZjIwZjQ4YTBmMDc5MTRjOTU0NjliZWU3MDE2YTU3NjJiYzQxZWRiODY4ZTc1YWI1NDY4MWIxNA%3D%3D&v=1&f=sd", - "duration": 30, - "fallback_url": "https://v.redd.it/asj4p03rdsa51/DASH_360.mp4?source=fallback", - "height": 360, - "hls_url": "https://v.redd.it/asj4p03rdsa51/HLSPlaylist.m3u8?a=1597351258%2CY2QxM2I4Njk5MmIyOTRiZTBhNDQ2MDg0ZTM2NTllYzBjODBlYjNiNDc1Mzg2ODIxNDk4MTAzMzYyNzlmNjI1NQ%3D%3D&v=1&f=sd", - "is_gif": False, - "scrubber_media_url": "https://v.redd.it/asj4p03rdsa51/DASH_96.mp4", - "transcoding_status": "completed", - "width": 640, - } - }, - "media_embed": {}, - "media_only": False, - "mod_note": None, - "mod_reason_by": None, - "mod_reason_title": None, - "mod_reports": [], - "name": "t3_hqy0ny", - "no_follow": False, - "num_comments": 849, - "num_crossposts": 24, - "num_reports": None, - "over_18": False, - "parent_whitelist_status": "all_ads", - "permalink": "/r/aww/comments/hqy0ny/bunnies_flop_over_when_they_feel_completely_safe/", - "pinned": False, - "post_hint": "hosted:video", - "preview": { - "enabled": False, - "images": [ - { - "id": "eMi5JzdWDMeDALsqK8bVceX3jbXTWS_S1D-Ie1hQxnc", - "resolutions": [ - { - "height": 60, - "url": "https://external-preview.redd.it/e67OvQTnkypoYCuC4ApCsgdzVGjPLX3986XW_Ttm9bU.png?width=108&crop=smart&format=pjpg&auto=webp&s=5c6d61e0d4934df3c1f4b7a4c3c3afdd4c31c037", - "width": 108, - }, - { - "height": 121, - "url": "https://external-preview.redd.it/e67OvQTnkypoYCuC4ApCsgdzVGjPLX3986XW_Ttm9bU.png?width=216&crop=smart&format=pjpg&auto=webp&s=24586000b5821e23ce78f395c1f294bbe3fa3945", - "width": 216, - }, - { - "height": 180, - "url": "https://external-preview.redd.it/e67OvQTnkypoYCuC4ApCsgdzVGjPLX3986XW_Ttm9bU.png?width=320&crop=smart&format=pjpg&auto=webp&s=dcaed0109703cbddd4914e138afdb61086cffd81", - "width": 320, - }, - { - "height": 360, - "url": "https://external-preview.redd.it/e67OvQTnkypoYCuC4ApCsgdzVGjPLX3986XW_Ttm9bU.png?width=640&crop=smart&format=pjpg&auto=webp&s=ef4f6dc33fe582b93e954114e9eb1447bbbc197b", - "width": 640, - }, - ], - "source": { - "height": 360, - "url": "https://external-preview.redd.it/e67OvQTnkypoYCuC4ApCsgdzVGjPLX3986XW_Ttm9bU.png?format=pjpg&auto=webp&s=b6e8cba9d25c684ecb7104c1e1c454dba7fd3f2f", - "width": 640, - }, - "variants": {}, - } - ], - }, - "pwls": 6, - "quarantine": False, - "removal_reason": None, - "removed_by": None, - "removed_by_category": None, - "report_reasons": None, - "saved": False, - "score": 112661, - "secure_media": { - "reddit_video": { - "dash_url": "https://v.redd.it/asj4p03rdsa51/DASHPlaylist.mpd?a=1597351258%2CY2VmYTAyMWNmZjIwZjQ4YTBmMDc5MTRjOTU0NjliZWU3MDE2YTU3NjJiYzQxZWRiODY4ZTc1YWI1NDY4MWIxNA%3D%3D&v=1&f=sd", - "duration": 30, - "fallback_url": "https://v.redd.it/asj4p03rdsa51/DASH_360.mp4?source=fallback", - "height": 360, - "hls_url": "https://v.redd.it/asj4p03rdsa51/HLSPlaylist.m3u8?a=1597351258%2CY2QxM2I4Njk5MmIyOTRiZTBhNDQ2MDg0ZTM2NTllYzBjODBlYjNiNDc1Mzg2ODIxNDk4MTAzMzYyNzlmNjI1NQ%3D%3D&v=1&f=sd", - "is_gif": False, - "scrubber_media_url": "https://v.redd.it/asj4p03rdsa51/DASH_96.mp4", - "transcoding_status": "completed", - "width": 640, - } - }, - "secure_media_embed": {}, - "selftext": "", - "selftext_html": None, - "send_replies": True, - "spoiler": False, - "stickied": False, - "subreddit": "aww", - "subreddit_id": "t5_2qh1o", - "subreddit_name_prefixed": "r/aww", - "subreddit_subscribers": 25634399, - "subreddit_type": "public", - "suggested_sort": None, - "thumbnail": "https://b.thumbs.redditmedia.com/l_4Yk7NC8hz2HM0D3Hv2dK_nZBjpL8FL3NPv9WkRo8k.jpg", - "thumbnail_height": 78, - "thumbnail_width": 140, - "title": "Bunnies flop over when they feel " - "completely safe beside their " - "protectors", - "top_awarded_type": None, - "total_awards_received": 12, - "treatment_tags": [], - "ups": 112661, - "upvote_ratio": 0.94, - "url": "https://v.redd.it/asj4p03rdsa51", - "url_overridden_by_dest": "https://v.redd.it/asj4p03rdsa51", - "user_reports": [], - "view_count": None, - "visited": False, - "whitelist_status": "all_ads", - "wls": 6, - }, - "kind": "t3", - }, - ], - "dist": 25, - "modhash": None, - }, - "kind": "Listing", -} - -external_video_mock = { - "data": { - "after": "t3_hr3mhe", - "before": None, - "children": [ - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "aww", - "selftext": "", - "author_fullname": "t2_ot2b2", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Dog splashing in water", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/aww", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "thumbnail_height": 140, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hulh8k", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.94, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 1142, - "total_awards_received": 0, - "media_embed": { - "content": '<iframe class="embedly-embed" src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgfycat.com%2Fifr%2Fexcellentinfantileamericanwigeon&display_name=Gfycat&url=https%3A%2F%2Fgfycat.com%2Fexcellentinfantileamericanwigeon&image=https%3A%2F%2Fthumbs.gfycat.com%2FExcellentInfantileAmericanwigeon-size_restricted.gif&key=ed8fa8699ce04833838e66ce79ba05f1&type=text%2Fhtml&schema=gfycat" width="400" height="400" scrolling="no" title="Gfycat embed" frameborder="0" allow="autoplay; fullscreen" allowfullscreen="True"></iframe>', - "width": 400, - "scrolling": False, - "height": 400, - }, - "thumbnail_width": 140, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": { - "oembed": { - "provider_url": "https://gfycat.com", - "description": 'Hi! We use cookies and similar technologies ("cookies"), including third-party cookies, on this website to help operate and improve your experience on our site, monitor our site performance, and for advertising purposes. By clicking "Accept Cookies" below, you are giving us consent to use cookies (except consent is not required for cookies necessary to run our site).', - "title": "97991217 286625482366728 7551185146460766208 n", - "author_name": "Gfycat", - "height": 400, - "width": 400, - "html": '<iframe class="embedly-embed" src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgfycat.com%2Fifr%2Fexcellentinfantileamericanwigeon&display_name=Gfycat&url=https%3A%2F%2Fgfycat.com%2Fexcellentinfantileamericanwigeon&image=https%3A%2F%2Fthumbs.gfycat.com%2FExcellentInfantileAmericanwigeon-size_restricted.gif&key=ed8fa8699ce04833838e66ce79ba05f1&type=text%2Fhtml&schema=gfycat" width="400" height="400" scrolling="no" title="Gfycat embed" frameborder="0" allow="autoplay; fullscreen" allowfullscreen="True"></iframe>', - "thumbnail_width": 250, - "version": "1.0", - "provider_name": "Gfycat", - "thumbnail_url": "https://thumbs.gfycat.com/ExcellentInfantileAmericanwigeon-size_restricted.gif", - "type": "video", - "thumbnail_height": 250, - }, - "type": "gfycat.com", - }, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": { - "content": '<iframe class="embedly-embed" src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgfycat.com%2Fifr%2Fexcellentinfantileamericanwigeon&display_name=Gfycat&url=https%3A%2F%2Fgfycat.com%2Fexcellentinfantileamericanwigeon&image=https%3A%2F%2Fthumbs.gfycat.com%2FExcellentInfantileAmericanwigeon-size_restricted.gif&key=ed8fa8699ce04833838e66ce79ba05f1&type=text%2Fhtml&schema=gfycat" width="400" height="400" scrolling="no" title="Gfycat embed" frameborder="0" allow="autoplay; fullscreen" allowfullscreen="True"></iframe>', - "width": 400, - "scrolling": False, - "media_domain_url": "https://www.redditmedia.com/mediaembed/hulh8k", - "height": 400, - }, - "link_flair_text": None, - "can_mod_post": False, - "score": 1142, - "approved_by": None, - "author_premium": False, - "thumbnail": "https://b.thumbs.redditmedia.com/eR_Cu4w1l9PwaM14RTEpnKD20EaK5mMxUbyK8BBDo_M.jpg", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "post_hint": "rich:video", - "content_categories": None, - "is_self": False, - "mod_note": None, - "crosspost_parent_list": [], - "created": 1595281442, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "gfycat.com", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://gfycat.com/excellentinfantileamericanwigeon", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "preview": { - "images": [ - { - "source": { - "url": "https://external-preview.redd.it/rZXN_aGbww8NNlhGWB-5cjHPonSST4S7aS6uaZyb_W4.jpg?auto=webp&s=2a2d3a1e0a06742bf752c1c4e1582c2fa49793a3", - "width": 250, - "height": 250, - }, - "resolutions": [ - { - "url": "https://external-preview.redd.it/rZXN_aGbww8NNlhGWB-5cjHPonSST4S7aS6uaZyb_W4.jpg?width=108&crop=smart&auto=webp&s=35f61b003416516f664682717876a94d186793ae", - "width": 108, - "height": 108, - }, - { - "url": "https://external-preview.redd.it/rZXN_aGbww8NNlhGWB-5cjHPonSST4S7aS6uaZyb_W4.jpg?width=216&crop=smart&auto=webp&s=842416c1b8f8fae758a7ba6eb98af93ee2404a8d", - "width": 216, - "height": 216, - }, - ], - "variants": {}, - "id": "IVorc9dV9K9nJhhSVFKST92dfGfmhgBQjw257DWmJcE", - } - ], - "reddit_video_preview": { - "fallback_url": "https://v.redd.it/syp9pkiu00c51/DASH_360.mp4", - "height": 400, - "width": 400, - "scrubber_media_url": "https://v.redd.it/syp9pkiu00c51/DASH_96.mp4", - "dash_url": "https://v.redd.it/syp9pkiu00c51/DASHPlaylist.mpd", - "duration": 21, - "hls_url": "https://v.redd.it/syp9pkiu00c51/HLSPlaylist.m3u8", - "is_gif": True, - "transcoding_status": "completed", - }, - "enabled": False, - }, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1o", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hulh8k", - "is_robot_indexable": True, - "report_reasons": None, - "author": "TheRikari", - "discussion_type": None, - "num_comments": 21, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "crosspost_parent": "t3_hujqxu", - "author_flair_text_color": None, - "permalink": "/r/aww/comments/hulh8k/dog_splashing_in_water/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://gfycat.com/excellentinfantileamericanwigeon", - "subreddit_subscribers": 25721914, - "created_utc": 1595252642, - "num_crossposts": 0, - "media": { - "oembed": { - "provider_url": "https://gfycat.com", - "description": 'Hi! We use cookies and similar technologies ("cookies"), including third-party cookies, on this website to help operate and improve your experience on our site, monitor our site performance, and for advertising purposes. By clicking "Accept Cookies" below, you are giving us consent to use cookies (except consent is not required for cookies necessary to run our site).', - "title": "97991217 286625482366728 7551185146460766208 n", - "author_name": "Gfycat", - "height": 400, - "width": 400, - "html": '<iframe class="embedly-embed" src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgfycat.com%2Fifr%2Fexcellentinfantileamericanwigeon&display_name=Gfycat&url=https%3A%2F%2Fgfycat.com%2Fexcellentinfantileamericanwigeon&image=https%3A%2F%2Fthumbs.gfycat.com%2FExcellentInfantileAmericanwigeon-size_restricted.gif&key=ed8fa8699ce04833838e66ce79ba05f1&type=text%2Fhtml&schema=gfycat" width="400" height="400" scrolling="no" title="Gfycat embed" frameborder="0" allow="autoplay; fullscreen" allowfullscreen="True"></iframe>', - "thumbnail_width": 250, - "version": "1.0", - "provider_name": "Gfycat", - "thumbnail_url": "https://thumbs.gfycat.com/ExcellentInfantileAmericanwigeon-size_restricted.gif", - "type": "video", - "thumbnail_height": 250, - }, - "type": "gfycat.com", - }, - "is_video": False, - }, - } - ], - "dist": 25, - "modhash": None, - }, - "kind": "Listing", -} - -external_gifv_mock = { - "data": { - "after": "t3_hr3mhe", - "before": None, - "children": [ - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "aww", - "selftext": "", - "author_fullname": "t2_ygx0p1u", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "if i fits i sits", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/aww", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "thumbnail_height": 74, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_humdlf", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.97, - "author_flair_background_color": "", - "subreddit_type": "public", - "ups": 7512, - "total_awards_received": 1, - "media_embed": {}, - "thumbnail_width": 140, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 7512, - "approved_by": None, - "author_premium": True, - "thumbnail": "https://b.thumbs.redditmedia.com/QHK44nUFZup-hfFX2Z1dXhk-1lPEmROUCB3bBujvTck.jpg", - "edited": False, - "author_flair_css_class": "k", - "author_flair_richtext": [], - "gildings": {}, - "post_hint": "link", - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1595284712, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "i.imgur.com", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": "confidence", - "banned_at_utc": None, - "url_overridden_by_dest": "https://i.imgur.com/grVh2AG.gifv", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": False, - "pinned": False, - "over_18": False, - "preview": { - "images": [ - { - "source": { - "url": "https://external-preview.redd.it/XDHMFAMlcn3iuSqmWeDIc4yG-q-6xnTIdGivYX-cus4.jpg?auto=webp&s=c4ba246318b3502b080d37fcbdb12e07221401a9", - "width": 638, - "height": 338, - }, - "resolutions": [ - { - "url": "https://external-preview.redd.it/XDHMFAMlcn3iuSqmWeDIc4yG-q-6xnTIdGivYX-cus4.jpg?width=108&crop=smart&auto=webp&s=c9c340a60ba3da1af3f5d5c08f3ed618ebd567d4", - "width": 108, - "height": 57, - }, - { - "url": "https://external-preview.redd.it/XDHMFAMlcn3iuSqmWeDIc4yG-q-6xnTIdGivYX-cus4.jpg?width=216&crop=smart&auto=webp&s=d05c0415e3dc63d097264bfb1b35b09676bd24f6", - "width": 216, - "height": 114, - }, - { - "url": "https://external-preview.redd.it/XDHMFAMlcn3iuSqmWeDIc4yG-q-6xnTIdGivYX-cus4.jpg?width=320&crop=smart&auto=webp&s=5c236179ccfff29e9ba980f31d5a6a9905adbe86", - "width": 320, - "height": 169, - }, - ], - "variants": {}, - "id": "4Z8zF5e4sZJnX4vWH7pZkbqiDPMCuh2J4kNotV9AGSI", - } - ], - "reddit_video_preview": { - "fallback_url": "https://v.redd.it/zzctc8y2dzb51/DASH_240.mp4", - "height": 338, - "width": 638, - "scrubber_media_url": "https://v.redd.it/zzctc8y2dzb51/DASH_96.mp4", - "dash_url": "https://v.redd.it/zzctc8y2dzb51/DASHPlaylist.mpd", - "duration": 44, - "hls_url": "https://v.redd.it/zzctc8y2dzb51/HLSPlaylist.m3u8", - "is_gif": True, - "transcoding_status": "completed", - }, - "enabled": False, - }, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": False, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1o", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "humdlf", - "is_robot_indexable": True, - "report_reasons": None, - "author": "jasontaken", - "discussion_type": None, - "num_comments": 67, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": "dark", - "permalink": "/r/aww/comments/humdlf/if_i_fits_i_sits/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://i.imgur.com/grVh2AG.gifv", - "subreddit_subscribers": 25723833, - "created_utc": 1595255912, - "num_crossposts": 1, - "media": None, - "is_video": False, - }, - } - ], - "dist": 25, - "modhash": None, - }, - "kind": "Listing", -} - -unknown_mock = { - "data": { - "after": "t3_hr3mhe", - "before": None, - "children": [ - { - "kind": "t1", - "data": { - "approved_at_utc": None, - "subreddit": "aww", - "selftext": "", - "author_fullname": "t2_ygx0p1u", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "if i fits i sits", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/aww", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "thumbnail_height": 74, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_humdlf", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.97, - "author_flair_background_color": "", - "subreddit_type": "public", - "ups": 7512, - "total_awards_received": 1, - "media_embed": {}, - "thumbnail_width": 140, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 7512, - "approved_by": None, - "author_premium": True, - "thumbnail": "https://b.thumbs.redditmedia.com/QHK44nUFZup-hfFX2Z1dXhk-1lPEmROUCB3bBujvTck.jpg", - "edited": False, - "author_flair_css_class": "k", - "author_flair_richtext": [], - "gildings": {}, - "post_hint": "link", - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1595284712, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "i.imgur.com", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": "confidence", - "banned_at_utc": None, - "url_overridden_by_dest": "https://i.imgur.com/grVh2AG.gifv", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": False, - "pinned": False, - "over_18": False, - "preview": { - "images": [ - { - "source": { - "url": "https://external-preview.redd.it/XDHMFAMlcn3iuSqmWeDIc4yG-q-6xnTIdGivYX-cus4.jpg?auto=webp&s=c4ba246318b3502b080d37fcbdb12e07221401a9", - "width": 638, - "height": 338, - }, - "resolutions": [ - { - "url": "https://external-preview.redd.it/XDHMFAMlcn3iuSqmWeDIc4yG-q-6xnTIdGivYX-cus4.jpg?width=108&crop=smart&auto=webp&s=c9c340a60ba3da1af3f5d5c08f3ed618ebd567d4", - "width": 108, - "height": 57, - }, - { - "url": "https://external-preview.redd.it/XDHMFAMlcn3iuSqmWeDIc4yG-q-6xnTIdGivYX-cus4.jpg?width=216&crop=smart&auto=webp&s=d05c0415e3dc63d097264bfb1b35b09676bd24f6", - "width": 216, - "height": 114, - }, - { - "url": "https://external-preview.redd.it/XDHMFAMlcn3iuSqmWeDIc4yG-q-6xnTIdGivYX-cus4.jpg?width=320&crop=smart&auto=webp&s=5c236179ccfff29e9ba980f31d5a6a9905adbe86", - "width": 320, - "height": 169, - }, - ], - "variants": {}, - "id": "4Z8zF5e4sZJnX4vWH7pZkbqiDPMCuh2J4kNotV9AGSI", - } - ], - "reddit_video_preview": { - "fallback_url": "https://v.redd.it/zzctc8y2dzb51/DASH_240.mp4", - "height": 338, - "width": 638, - "scrubber_media_url": "https://v.redd.it/zzctc8y2dzb51/DASH_96.mp4", - "dash_url": "https://v.redd.it/zzctc8y2dzb51/DASHPlaylist.mpd", - "duration": 44, - "hls_url": "https://v.redd.it/zzctc8y2dzb51/HLSPlaylist.m3u8", - "is_gif": True, - "transcoding_status": "completed", - }, - "enabled": False, - }, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": False, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1o", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "humdlf", - "is_robot_indexable": True, - "report_reasons": None, - "author": "jasontaken", - "discussion_type": None, - "num_comments": 67, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": "dark", - "permalink": "/r/aww/comments/humdlf/if_i_fits_i_sits/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://i.imgur.com/grVh2AG.gifv", - "subreddit_subscribers": 25723833, - "created_utc": 1595255912, - "num_crossposts": 1, - "media": None, - "is_video": False, - }, - } - ], - "dist": 25, - "modhash": None, - }, - "kind": "Listing", -} - -nsfw_mock = { - "kind": "Listing", - "data": { - "modhash": "rjewztai5w0ab64547311ae1fb1f9cf81cd18949bfb629cb7f", - "dist": 27, - "children": [ - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "Welcome to r/linux rants and experiences! This megathread is also to hear opinions from anyone just starting out with Linux or those that have used Linux (GNU or otherwise) for a long time.\n\nLet us know what's annoying you, whats making you happy, or something that you want to get out to r/linux but didn't make the cut into a full post of it's own.\n\nFor those looking for certifications please use this megathread to ask about how to get certified whether it's for the business world or for your own satisfaction. Be sure to check out r/linuxadmin for more discussion in the SysAdmin world!\n\n_Please keep questions in r/linuxquestions, r/linux4noobs, or the Wednesday automod thread._", - "author_fullname": "t2_6l4z3", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Linux Experiences/Rants or Education/Certifications thread - July 06, 2020", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hm0qct", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.7, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 8, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 8, - "approved_by": None, - "author_premium": True, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594037482.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.linux", - "allow_live_comments": False, - "selftext_html": "<!-- SC_OFF --><div class='md'><p>Welcome to <a href='/r/linux'>r/linux</a> rants and experiences! This megathread is also to hear opinions from anyone just starting out with Linux or those that have used Linux (GNU or otherwise) for a long time.</p>\n\n<p>Let us know what&#39;s annoying you, whats making you happy, or something that you want to get out to <a href='/r/linux'>r/linux</a> but didn&#39;t make the cut into a full post of it&#39;s own.</p>\n\n<p>For those looking for certifications please use this megathread to ask about how to get certified whether it&#39;s for the business world or for your own satisfaction. Be sure to check out <a href='/r/linuxadmin'>r/linuxadmin</a> for more discussion in the SysAdmin world!</p>\n\n<p><em>Please keep questions in <a href='/r/linuxquestions'>r/linuxquestions</a>, <a href='/r/linux4noobs'>r/linux4noobs</a>, or the Wednesday automod thread.</em></p>\n</div><!-- SC_ON -->", - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": True, - "is_crosspostable": True, - "pinned": False, - "over_18": True, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": "moderator", - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hm0qct", - "is_robot_indexable": True, - "report_reasons": None, - "author": "AutoModerator", - "discussion_type": None, - "num_comments": 9, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hm0qct/linux_experiencesrants_or_educationcertifications/", - "parent_whitelist_status": "all_ads", - "stickied": True, - "url": "https://www.reddit.com/r/linux/comments/hm0qct/linux_experiencesrants_or_educationcertifications/", - "subreddit_subscribers": 544037, - "created_utc": 1594008682.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "Welcome to r/linux! If you're new to Linux or trying to get started this thread is for you. Get help here or as always, check out r/linuxquestions or r/linux4noobs\n\nThis megathread is for all your question needs. As we don't allow questions on r/linux outside of this megathread, please consider using r/linuxquestions or r/linux4noobs for the best solution to your problem.\n\nAsk your hardware requests here too or try r/linuxhardware!", - "author_fullname": "t2_6l4z3", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Weekly Questions and Hardware Thread - July 08, 2020", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hna75r", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.6, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 2, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 2, - "approved_by": None, - "author_premium": True, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594210138.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.linux", - "allow_live_comments": False, - "selftext_html": '<!-- SC_OFF --><div class="md"><p>Welcome to <a href="/r/linux">r/linux</a>! If you&#39;re new to Linux or trying to get started this thread is for you. Get help here or as always, check out <a href="/r/linuxquestions">r/linuxquestions</a> or <a href="/r/linux4noobs">r/linux4noobs</a></p>\n\n<p>This megathread is for all your question needs. As we don&#39;t allow questions on <a href="/r/linux">r/linux</a> outside of this megathread, please consider using <a href="/r/linuxquestions">r/linuxquestions</a> or <a href="/r/linux4noobs">r/linux4noobs</a> for the best solution to your problem.</p>\n\n<p>Ask your hardware requests here too or try <a href="/r/linuxhardware">r/linuxhardware</a>!</p>\n</div><!-- SC_ON -->', - "likes": None, - "suggested_sort": "new", - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": True, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": "moderator", - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hna75r", - "is_robot_indexable": True, - "report_reasons": None, - "author": "AutoModerator", - "discussion_type": None, - "num_comments": 2, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hna75r/weekly_questions_and_hardware_thread_july_08_2020/", - "parent_whitelist_status": "all_ads", - "stickied": True, - "url": "https://www.reddit.com/r/linux/comments/hna75r/weekly_questions_and_hardware_thread_july_08_2020/", - "subreddit_subscribers": 544037, - "created_utc": 1594181338.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - ], - "after": "t3_hmytic", - "before": None, - }, -} - -spoiler_mock = { - "kind": "Listing", - "data": { - "modhash": "rjewztai5w0ab64547311ae1fb1f9cf81cd18949bfb629cb7f", - "dist": 27, - "children": [ - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "Welcome to r/linux rants and experiences! This megathread is also to hear opinions from anyone just starting out with Linux or those that have used Linux (GNU or otherwise) for a long time.\n\nLet us know what's annoying you, whats making you happy, or something that you want to get out to r/linux but didn't make the cut into a full post of it's own.\n\nFor those looking for certifications please use this megathread to ask about how to get certified whether it's for the business world or for your own satisfaction. Be sure to check out r/linuxadmin for more discussion in the SysAdmin world!\n\n_Please keep questions in r/linuxquestions, r/linux4noobs, or the Wednesday automod thread._", - "author_fullname": "t2_6l4z3", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Linux Experiences/Rants or Education/Certifications thread - July 06, 2020", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hm0qct", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.7, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 8, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 8, - "approved_by": None, - "author_premium": True, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594037482.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.linux", - "allow_live_comments": False, - "selftext_html": "<!-- SC_OFF --><div class='md'><p>Welcome to <a href='/r/linux'>r/linux</a> rants and experiences! This megathread is also to hear opinions from anyone just starting out with Linux or those that have used Linux (GNU or otherwise) for a long time.</p>\n\n<p>Let us know what&#39;s annoying you, whats making you happy, or something that you want to get out to <a href='/r/linux'>r/linux</a> but didn&#39;t make the cut into a full post of it&#39;s own.</p>\n\n<p>For those looking for certifications please use this megathread to ask about how to get certified whether it&#39;s for the business world or for your own satisfaction. Be sure to check out <a href='/r/linuxadmin'>r/linuxadmin</a> for more discussion in the SysAdmin world!</p>\n\n<p><em>Please keep questions in <a href='/r/linuxquestions'>r/linuxquestions</a>, <a href='/r/linux4noobs'>r/linux4noobs</a>, or the Wednesday automod thread.</em></p>\n</div><!-- SC_ON -->", - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": True, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": "moderator", - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hm0qct", - "is_robot_indexable": True, - "report_reasons": None, - "author": "AutoModerator", - "discussion_type": None, - "num_comments": 9, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hm0qct/linux_experiencesrants_or_educationcertifications/", - "parent_whitelist_status": "all_ads", - "stickied": True, - "url": "https://www.reddit.com/r/linux/comments/hm0qct/linux_experiencesrants_or_educationcertifications/", - "subreddit_subscribers": 544037, - "created_utc": 1594008682.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "Welcome to r/linux! If you're new to Linux or trying to get started this thread is for you. Get help here or as always, check out r/linuxquestions or r/linux4noobs\n\nThis megathread is for all your question needs. As we don't allow questions on r/linux outside of this megathread, please consider using r/linuxquestions or r/linux4noobs for the best solution to your problem.\n\nAsk your hardware requests here too or try r/linuxhardware!", - "author_fullname": "t2_6l4z3", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Weekly Questions and Hardware Thread - July 08, 2020", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hna75r", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.6, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 2, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 2, - "approved_by": None, - "author_premium": True, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594210138.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.linux", - "allow_live_comments": False, - "selftext_html": '<!-- SC_OFF --><div class="md"><p>Welcome to <a href="/r/linux">r/linux</a>! If you&#39;re new to Linux or trying to get started this thread is for you. Get help here or as always, check out <a href="/r/linuxquestions">r/linuxquestions</a> or <a href="/r/linux4noobs">r/linux4noobs</a></p>\n\n<p>This megathread is for all your question needs. As we don&#39;t allow questions on <a href="/r/linux">r/linux</a> outside of this megathread, please consider using <a href="/r/linuxquestions">r/linuxquestions</a> or <a href="/r/linux4noobs">r/linux4noobs</a> for the best solution to your problem.</p>\n\n<p>Ask your hardware requests here too or try <a href="/r/linuxhardware">r/linuxhardware</a>!</p>\n</div><!-- SC_ON -->', - "likes": None, - "suggested_sort": "new", - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": True, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": True, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": "moderator", - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hna75r", - "is_robot_indexable": True, - "report_reasons": None, - "author": "AutoModerator", - "discussion_type": None, - "num_comments": 2, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hna75r/weekly_questions_and_hardware_thread_july_08_2020/", - "parent_whitelist_status": "all_ads", - "stickied": True, - "url": "https://www.reddit.com/r/linux/comments/hna75r/weekly_questions_and_hardware_thread_july_08_2020/", - "subreddit_subscribers": 544037, - "created_utc": 1594181338.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - ], - "after": "t3_hmytic", - "before": None, - }, -} - -seen_mock = { - "kind": "Listing", - "data": { - "modhash": "rjewztai5w0ab64547311ae1fb1f9cf81cd18949bfb629cb7f", - "dist": 27, - "children": [ - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "Welcome to r/linux rants and experiences! This megathread is also to hear opinions from anyone just starting out with Linux or those that have used Linux (GNU or otherwise) for a long time.\n\nLet us know what's annoying you, whats making you happy, or something that you want to get out to r/linux but didn't make the cut into a full post of it's own.\n\nFor those looking for certifications please use this megathread to ask about how to get certified whether it's for the business world or for your own satisfaction. Be sure to check out r/linuxadmin for more discussion in the SysAdmin world!\n\n_Please keep questions in r/linuxquestions, r/linux4noobs, or the Wednesday automod thread._", - "author_fullname": "t2_6l4z3", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": True, - "title": "Linux Experiences/Rants or Education/Certifications thread - July 06, 2020", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hm0qct", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.7, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 8, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 8, - "approved_by": None, - "author_premium": True, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594037482.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.linux", - "allow_live_comments": False, - "selftext_html": "<!-- SC_OFF --><div class='md'><p>Welcome to <a href='/r/linux'>r/linux</a> rants and experiences! This megathread is also to hear opinions from anyone just starting out with Linux or those that have used Linux (GNU or otherwise) for a long time.</p>\n\n<p>Let us know what&#39;s annoying you, whats making you happy, or something that you want to get out to <a href='/r/linux'>r/linux</a> but didn&#39;t make the cut into a full post of it&#39;s own.</p>\n\n<p>For those looking for certifications please use this megathread to ask about how to get certified whether it&#39;s for the business world or for your own satisfaction. Be sure to check out <a href='/r/linuxadmin'>r/linuxadmin</a> for more discussion in the SysAdmin world!</p>\n\n<p><em>Please keep questions in <a href='/r/linuxquestions'>r/linuxquestions</a>, <a href='/r/linux4noobs'>r/linux4noobs</a>, or the Wednesday automod thread.</em></p>\n</div><!-- SC_ON -->", - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": True, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": "moderator", - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hm0qct", - "is_robot_indexable": True, - "report_reasons": None, - "author": "AutoModerator", - "discussion_type": None, - "num_comments": 9, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hm0qct/linux_experiencesrants_or_educationcertifications/", - "parent_whitelist_status": "all_ads", - "stickied": True, - "url": "https://www.reddit.com/r/linux/comments/hm0qct/linux_experiencesrants_or_educationcertifications/", - "subreddit_subscribers": 544037, - "created_utc": 1594008682.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "Welcome to r/linux! If you're new to Linux or trying to get started this thread is for you. Get help here or as always, check out r/linuxquestions or r/linux4noobs\n\nThis megathread is for all your question needs. As we don't allow questions on r/linux outside of this megathread, please consider using r/linuxquestions or r/linux4noobs for the best solution to your problem.\n\nAsk your hardware requests here too or try r/linuxhardware!", - "author_fullname": "t2_6l4z3", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Weekly Questions and Hardware Thread - July 08, 2020", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hna75r", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.6, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 2, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 2, - "approved_by": None, - "author_premium": True, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594210138.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.linux", - "allow_live_comments": False, - "selftext_html": '<!-- SC_OFF --><div class="md"><p>Welcome to <a href="/r/linux">r/linux</a>! If you&#39;re new to Linux or trying to get started this thread is for you. Get help here or as always, check out <a href="/r/linuxquestions">r/linuxquestions</a> or <a href="/r/linux4noobs">r/linux4noobs</a></p>\n\n<p>This megathread is for all your question needs. As we don&#39;t allow questions on <a href="/r/linux">r/linux</a> outside of this megathread, please consider using <a href="/r/linuxquestions">r/linuxquestions</a> or <a href="/r/linux4noobs">r/linux4noobs</a> for the best solution to your problem.</p>\n\n<p>Ask your hardware requests here too or try <a href="/r/linuxhardware">r/linuxhardware</a>!</p>\n</div><!-- SC_ON -->', - "likes": None, - "suggested_sort": "new", - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": True, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": "moderator", - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hna75r", - "is_robot_indexable": True, - "report_reasons": None, - "author": "AutoModerator", - "discussion_type": None, - "num_comments": 2, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hna75r/weekly_questions_and_hardware_thread_july_08_2020/", - "parent_whitelist_status": "all_ads", - "stickied": True, - "url": "https://www.reddit.com/r/linux/comments/hna75r/weekly_questions_and_hardware_thread_july_08_2020/", - "subreddit_subscribers": 544037, - "created_utc": 1594181338.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - ], - "after": "t3_hmytic", - "before": None, - }, -} - -upvote_mock = { - "kind": "Listing", - "data": { - "modhash": "rjewztai5w0ab64547311ae1fb1f9cf81cd18949bfb629cb7f", - "dist": 27, - "children": [ - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "Welcome to r/linux rants and experiences! This megathread is also to hear opinions from anyone just starting out with Linux or those that have used Linux (GNU or otherwise) for a long time.\n\nLet us know what's annoying you, whats making you happy, or something that you want to get out to r/linux but didn't make the cut into a full post of it's own.\n\nFor those looking for certifications please use this megathread to ask about how to get certified whether it's for the business world or for your own satisfaction. Be sure to check out r/linuxadmin for more discussion in the SysAdmin world!\n\n_Please keep questions in r/linuxquestions, r/linux4noobs, or the Wednesday automod thread._", - "author_fullname": "t2_6l4z3", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": True, - "title": "Linux Experiences/Rants or Education/Certifications thread - July 06, 2020", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hm0qct", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.7, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 99, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 8, - "approved_by": None, - "author_premium": True, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594037482.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.linux", - "allow_live_comments": False, - "selftext_html": "<!-- SC_OFF --><div class='md'><p>Welcome to <a href='/r/linux'>r/linux</a> rants and experiences! This megathread is also to hear opinions from anyone just starting out with Linux or those that have used Linux (GNU or otherwise) for a long time.</p>\n\n<p>Let us know what&#39;s annoying you, whats making you happy, or something that you want to get out to <a href='/r/linux'>r/linux</a> but didn&#39;t make the cut into a full post of it&#39;s own.</p>\n\n<p>For those looking for certifications please use this megathread to ask about how to get certified whether it&#39;s for the business world or for your own satisfaction. Be sure to check out <a href='/r/linuxadmin'>r/linuxadmin</a> for more discussion in the SysAdmin world!</p>\n\n<p><em>Please keep questions in <a href='/r/linuxquestions'>r/linuxquestions</a>, <a href='/r/linux4noobs'>r/linux4noobs</a>, or the Wednesday automod thread.</em></p>\n</div><!-- SC_ON -->", - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": True, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": "moderator", - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hm0qct", - "is_robot_indexable": True, - "report_reasons": None, - "author": "AutoModerator", - "discussion_type": None, - "num_comments": 9, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hm0qct/linux_experiencesrants_or_educationcertifications/", - "parent_whitelist_status": "all_ads", - "stickied": True, - "url": "https://www.reddit.com/r/linux/comments/hm0qct/linux_experiencesrants_or_educationcertifications/", - "subreddit_subscribers": 544037, - "created_utc": 1594008682.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "Welcome to r/linux! If you're new to Linux or trying to get started this thread is for you. Get help here or as always, check out r/linuxquestions or r/linux4noobs\n\nThis megathread is for all your question needs. As we don't allow questions on r/linux outside of this megathread, please consider using r/linuxquestions or r/linux4noobs for the best solution to your problem.\n\nAsk your hardware requests here too or try r/linuxhardware!", - "author_fullname": "t2_6l4z3", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Weekly Questions and Hardware Thread - July 08, 2020", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hna75r", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.6, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 150, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 2, - "approved_by": None, - "author_premium": True, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594210138.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.linux", - "allow_live_comments": False, - "selftext_html": '<!-- SC_OFF --><div class="md"><p>Welcome to <a href="/r/linux">r/linux</a>! If you&#39;re new to Linux or trying to get started this thread is for you. Get help here or as always, check out <a href="/r/linuxquestions">r/linuxquestions</a> or <a href="/r/linux4noobs">r/linux4noobs</a></p>\n\n<p>This megathread is for all your question needs. As we don&#39;t allow questions on <a href="/r/linux">r/linux</a> outside of this megathread, please consider using <a href="/r/linuxquestions">r/linuxquestions</a> or <a href="/r/linux4noobs">r/linux4noobs</a> for the best solution to your problem.</p>\n\n<p>Ask your hardware requests here too or try <a href="/r/linuxhardware">r/linuxhardware</a>!</p>\n</div><!-- SC_ON -->', - "likes": None, - "suggested_sort": "new", - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": True, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": "moderator", - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hna75r", - "is_robot_indexable": True, - "report_reasons": None, - "author": "AutoModerator", - "discussion_type": None, - "num_comments": 2, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hna75r/weekly_questions_and_hardware_thread_july_08_2020/", - "parent_whitelist_status": "all_ads", - "stickied": True, - "url": "https://www.reddit.com/r/linux/comments/hna75r/weekly_questions_and_hardware_thread_july_08_2020/", - "subreddit_subscribers": 544037, - "created_utc": 1594181338.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - ], - "after": "t3_hmytic", - "before": None, - }, -} - -comment_mock = { - "kind": "Listing", - "data": { - "modhash": "rjewztai5w0ab64547311ae1fb1f9cf81cd18949bfb629cb7f", - "dist": 27, - "children": [ - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "Welcome to r/linux rants and experiences! This megathread is also to hear opinions from anyone just starting out with Linux or those that have used Linux (GNU or otherwise) for a long time.\n\nLet us know what's annoying you, whats making you happy, or something that you want to get out to r/linux but didn't make the cut into a full post of it's own.\n\nFor those looking for certifications please use this megathread to ask about how to get certified whether it's for the business world or for your own satisfaction. Be sure to check out r/linuxadmin for more discussion in the SysAdmin world!\n\n_Please keep questions in r/linuxquestions, r/linux4noobs, or the Wednesday automod thread._", - "author_fullname": "t2_6l4z3", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": True, - "title": "Linux Experiences/Rants or Education/Certifications thread - July 06, 2020", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hm0qct", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.7, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 99, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 8, - "approved_by": None, - "author_premium": True, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594037482.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.linux", - "allow_live_comments": False, - "selftext_html": "<!-- SC_OFF --><div class='md'><p>Welcome to <a href='/r/linux'>r/linux</a> rants and experiences! This megathread is also to hear opinions from anyone just starting out with Linux or those that have used Linux (GNU or otherwise) for a long time.</p>\n\n<p>Let us know what&#39;s annoying you, whats making you happy, or something that you want to get out to <a href='/r/linux'>r/linux</a> but didn&#39;t make the cut into a full post of it&#39;s own.</p>\n\n<p>For those looking for certifications please use this megathread to ask about how to get certified whether it&#39;s for the business world or for your own satisfaction. Be sure to check out <a href='/r/linuxadmin'>r/linuxadmin</a> for more discussion in the SysAdmin world!</p>\n\n<p><em>Please keep questions in <a href='/r/linuxquestions'>r/linuxquestions</a>, <a href='/r/linux4noobs'>r/linux4noobs</a>, or the Wednesday automod thread.</em></p>\n</div><!-- SC_ON -->", - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": True, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": "moderator", - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hm0qct", - "is_robot_indexable": True, - "report_reasons": None, - "author": "AutoModerator", - "discussion_type": None, - "num_comments": 150, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hm0qct/linux_experiencesrants_or_educationcertifications/", - "parent_whitelist_status": "all_ads", - "stickied": True, - "url": "https://www.reddit.com/r/linux/comments/hm0qct/linux_experiencesrants_or_educationcertifications/", - "subreddit_subscribers": 544037, - "created_utc": 1594008682.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "Welcome to r/linux! If you're new to Linux or trying to get started this thread is for you. Get help here or as always, check out r/linuxquestions or r/linux4noobs\n\nThis megathread is for all your question needs. As we don't allow questions on r/linux outside of this megathread, please consider using r/linuxquestions or r/linux4noobs for the best solution to your problem.\n\nAsk your hardware requests here too or try r/linuxhardware!", - "author_fullname": "t2_6l4z3", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Weekly Questions and Hardware Thread - July 08, 2020", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hna75r", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.6, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 150, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 2, - "approved_by": None, - "author_premium": True, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594210138.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.linux", - "allow_live_comments": False, - "selftext_html": '<!-- SC_OFF --><div class="md"><p>Welcome to <a href="/r/linux">r/linux</a>! If you&#39;re new to Linux or trying to get started this thread is for you. Get help here or as always, check out <a href="/r/linuxquestions">r/linuxquestions</a> or <a href="/r/linux4noobs">r/linux4noobs</a></p>\n\n<p>This megathread is for all your question needs. As we don&#39;t allow questions on <a href="/r/linux">r/linux</a> outside of this megathread, please consider using <a href="/r/linuxquestions">r/linuxquestions</a> or <a href="/r/linux4noobs">r/linux4noobs</a> for the best solution to your problem.</p>\n\n<p>Ask your hardware requests here too or try <a href="/r/linuxhardware">r/linuxhardware</a>!</p>\n</div><!-- SC_ON -->', - "likes": None, - "suggested_sort": "new", - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": True, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": "moderator", - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hna75r", - "is_robot_indexable": True, - "report_reasons": None, - "author": "AutoModerator", - "discussion_type": None, - "num_comments": 80, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hna75r/weekly_questions_and_hardware_thread_july_08_2020/", - "parent_whitelist_status": "all_ads", - "stickied": True, - "url": "https://www.reddit.com/r/linux/comments/hna75r/weekly_questions_and_hardware_thread_july_08_2020/", - "subreddit_subscribers": 544037, - "created_utc": 1594181338.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - ], - "after": "t3_hmytic", - "before": None, - }, -} - -downvote_mock = { - "kind": "Listing", - "data": { - "modhash": "rjewztai5w0ab64547311ae1fb1f9cf81cd18949bfb629cb7f", - "dist": 27, - "children": [ - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "Welcome to r/linux rants and experiences! This megathread is also to hear opinions from anyone just starting out with Linux or those that have used Linux (GNU or otherwise) for a long time.\n\nLet us know what's annoying you, whats making you happy, or something that you want to get out to r/linux but didn't make the cut into a full post of it's own.\n\nFor those looking for certifications please use this megathread to ask about how to get certified whether it's for the business world or for your own satisfaction. Be sure to check out r/linuxadmin for more discussion in the SysAdmin world!\n\n_Please keep questions in r/linuxquestions, r/linux4noobs, or the Wednesday automod thread._", - "author_fullname": "t2_6l4z3", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": True, - "title": "Linux Experiences/Rants or Education/Certifications thread - July 06, 2020", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 10, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hm0qct", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.7, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 99, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 8, - "approved_by": None, - "author_premium": True, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594037482.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.linux", - "allow_live_comments": False, - "selftext_html": "<!-- SC_OFF --><div class='md'><p>Welcome to <a href='/r/linux'>r/linux</a> rants and experiences! This megathread is also to hear opinions from anyone just starting out with Linux or those that have used Linux (GNU or otherwise) for a long time.</p>\n\n<p>Let us know what&#39;s annoying you, whats making you happy, or something that you want to get out to <a href='/r/linux'>r/linux</a> but didn&#39;t make the cut into a full post of it&#39;s own.</p>\n\n<p>For those looking for certifications please use this megathread to ask about how to get certified whether it&#39;s for the business world or for your own satisfaction. Be sure to check out <a href='/r/linuxadmin'>r/linuxadmin</a> for more discussion in the SysAdmin world!</p>\n\n<p><em>Please keep questions in <a href='/r/linuxquestions'>r/linuxquestions</a>, <a href='/r/linux4noobs'>r/linux4noobs</a>, or the Wednesday automod thread.</em></p>\n</div><!-- SC_ON -->", - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": True, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": "moderator", - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hm0qct", - "is_robot_indexable": True, - "report_reasons": None, - "author": "AutoModerator", - "discussion_type": None, - "num_comments": 150, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hm0qct/linux_experiencesrants_or_educationcertifications/", - "parent_whitelist_status": "all_ads", - "stickied": True, - "url": "https://www.reddit.com/r/linux/comments/hm0qct/linux_experiencesrants_or_educationcertifications/", - "subreddit_subscribers": 544037, - "created_utc": 1594008682.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "Welcome to r/linux! If you're new to Linux or trying to get started this thread is for you. Get help here or as always, check out r/linuxquestions or r/linux4noobs\n\nThis megathread is for all your question needs. As we don't allow questions on r/linux outside of this megathread, please consider using r/linuxquestions or r/linux4noobs for the best solution to your problem.\n\nAsk your hardware requests here too or try r/linuxhardware!", - "author_fullname": "t2_6l4z3", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Weekly Questions and Hardware Thread - July 08, 2020", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 40, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hna75r", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.6, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 150, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 2, - "approved_by": None, - "author_premium": True, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594210138.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.linux", - "allow_live_comments": False, - "selftext_html": '<!-- SC_OFF --><div class="md"><p>Welcome to <a href="/r/linux">r/linux</a>! If you&#39;re new to Linux or trying to get started this thread is for you. Get help here or as always, check out <a href="/r/linuxquestions">r/linuxquestions</a> or <a href="/r/linux4noobs">r/linux4noobs</a></p>\n\n<p>This megathread is for all your question needs. As we don&#39;t allow questions on <a href="/r/linux">r/linux</a> outside of this megathread, please consider using <a href="/r/linuxquestions">r/linuxquestions</a> or <a href="/r/linux4noobs">r/linux4noobs</a> for the best solution to your problem.</p>\n\n<p>Ask your hardware requests here too or try <a href="/r/linuxhardware">r/linuxhardware</a>!</p>\n</div><!-- SC_ON -->', - "likes": None, - "suggested_sort": "new", - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": True, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": "moderator", - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hna75r", - "is_robot_indexable": True, - "report_reasons": None, - "author": "AutoModerator", - "discussion_type": None, - "num_comments": 80, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hna75r/weekly_questions_and_hardware_thread_july_08_2020/", - "parent_whitelist_status": "all_ads", - "stickied": True, - "url": "https://www.reddit.com/r/linux/comments/hna75r/weekly_questions_and_hardware_thread_july_08_2020/", - "subreddit_subscribers": 544037, - "created_utc": 1594181338.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - ], - "after": "t3_hmytic", - "before": None, - }, -} diff --git a/src/newsreader/news/collection/tests/reddit/builder/tests.py b/src/newsreader/news/collection/tests/reddit/builder/tests.py deleted file mode 100644 index 5144edf..0000000 --- a/src/newsreader/news/collection/tests/reddit/builder/tests.py +++ /dev/null @@ -1,472 +0,0 @@ -from datetime import datetime, timezone -from unittest.mock import Mock - -from django.test import TestCase - -from newsreader.news.collection.reddit import RedditBuilder -from newsreader.news.collection.tests.factories import SubredditFactory -from newsreader.news.collection.tests.reddit.builder.mocks import ( - author_mock, - comment_mock, - downvote_mock, - duplicate_mock, - empty_mock, - external_gifv_mock, - external_image_mock, - external_video_mock, - image_mock, - nsfw_mock, - seen_mock, - simple_mock, - spoiler_mock, - title_mock, - unknown_mock, - unsanitized_mock, - upvote_mock, - video_mock, -) -from newsreader.news.core.models import Post -from newsreader.news.core.tests.factories import RedditPostFactory - - -class RedditBuilderTestCase(TestCase): - def setUp(self): - self.maxDiff = None - - def test_simple_mock(self): - builder = RedditBuilder - - subreddit = SubredditFactory() - mock_stream = Mock(rule=subreddit) - - with builder(simple_mock, mock_stream) as builder: - builder.build() - builder.save() - - posts = {post.remote_identifier: post for post in Post.objects.all()} - - self.assertCountEqual( - ("hm0qct", "hna75r", "hngs71", "hngsj8", "hnd7cy"), posts.keys() - ) - - post = posts["hm0qct"] - - self.assertEqual(post.rule, subreddit) - self.assertEqual( - post.title, - "Linux Experiences/Rants or Education/Certifications thread - July 06, 2020", - ) - self.assertIn( - " This megathread is also to hear opinions from anyone just starting out" - " with Linux or those that have used Linux (GNU or otherwise) for a long", - post.body, - ) - - self.assertIn( - "

For those looking for certifications please use this megathread to ask about how" - " to get certified whether it's for the business world or for your own satisfaction." - ' Be sure to check out r/linuxadmin for more discussion in the' - " SysAdmin world!

", - post.body, - ) - - self.assertEqual(post.author, "AutoModerator") - self.assertEqual( - post.url, - "https://www.reddit.com/r/linux/comments/hm0qct/linux_experiencesrants_or_educationcertifications/", - ) - self.assertEqual( - post.publication_date, datetime(2020, 7, 6, 6, 11, 22, tzinfo=timezone.utc) - ) - - def test_empty_data(self): - builder = RedditBuilder - - subreddit = SubredditFactory() - mock_stream = Mock(rule=subreddit) - - with builder(empty_mock, mock_stream) as builder: - builder.build() - builder.save() - - self.assertEqual(Post.objects.count(), 0) - - def test_unknown_mock(self): - builder = RedditBuilder - - subreddit = SubredditFactory() - mock_stream = Mock(rule=subreddit) - - with builder(unknown_mock, mock_stream) as builder: - builder.build() - builder.save() - - self.assertEqual(Post.objects.count(), 0) - - def test_html_sanitizing(self): - builder = RedditBuilder - - subreddit = SubredditFactory() - mock_stream = Mock(rule=subreddit) - - with builder(unsanitized_mock, mock_stream) as builder: - builder.build() - builder.save() - - posts = {post.remote_identifier: post for post in Post.objects.all()} - - self.assertCountEqual(("hnd7cy",), posts.keys()) - - post = posts["hnd7cy"] - - self.assertEqual(post.body, "
") - - def test_long_author_text_is_truncated(self): - builder = RedditBuilder - - subreddit = SubredditFactory() - mock_stream = Mock(rule=subreddit) - - with builder(author_mock, mock_stream) as builder: - builder.build() - builder.save() - - posts = {post.remote_identifier: post for post in Post.objects.all()} - - self.assertCountEqual(("hnd7cy",), posts.keys()) - - post = posts["hnd7cy"] - - self.assertEqual(post.author, "TheQuantumZeroTheQuantumZeroTheQuantumZ…") - - def test_long_title_text_is_truncated(self): - builder = RedditBuilder - - subreddit = SubredditFactory() - mock_stream = Mock(rule=subreddit) - - with builder(title_mock, mock_stream) as builder: - builder.build() - builder.save() - - posts = {post.remote_identifier: post for post in Post.objects.all()} - - self.assertCountEqual(("hnd7cy",), posts.keys()) - - post = posts["hnd7cy"] - - self.assertEqual( - post.title, - 'Board statement on the LibreOffice 7.0 RC "Personal EditionBoard statement on the LibreOffice 7.0 RC "Personal Edition" label" labelBoard statement on the LibreOffice 7.0 RC "PersBoard statement on t…', - ) - - def test_duplicate_in_response(self): - builder = RedditBuilder - - subreddit = SubredditFactory() - mock_stream = Mock(rule=subreddit) - - with builder(duplicate_mock, mock_stream) as builder: - builder.build() - builder.save() - - posts = {post.remote_identifier: post for post in Post.objects.all()} - - self.assertEqual(Post.objects.count(), 2) - self.assertCountEqual(("hm0qct", "hna75r"), posts.keys()) - - def test_duplicate_in_database(self): - builder = RedditBuilder - - subreddit = SubredditFactory() - mock_stream = Mock(rule=subreddit) - - RedditPostFactory(remote_identifier="hm0qct", rule=subreddit, title="foo") - - with builder(simple_mock, mock_stream) as builder: - builder.build() - builder.save() - - posts = {post.remote_identifier: post for post in Post.objects.all()} - - self.assertEqual(Post.objects.count(), 5) - self.assertCountEqual( - ("hm0qct", "hna75r", "hngs71", "hngsj8", "hnd7cy"), posts.keys() - ) - - def test_image_post(self): - builder = RedditBuilder - - subreddit = SubredditFactory() - mock_stream = Mock(rule=subreddit) - - with builder(image_mock, mock_stream) as builder: - builder.build() - builder.save() - - posts = {post.remote_identifier: post for post in Post.objects.all()} - - self.assertCountEqual(("hr64xh", "hr4bxo", "hr14y5", "hr2fv0"), posts.keys()) - - post = posts["hr64xh"] - - title = ( - "Ya’ll, I just can’t... this is my " - "son, Judah. My wife and I have no " - "idea how we created such a " - "beautiful child." - ) - url = "https://i.redd.it/cm2qybia1va51.jpg" - - self.assertEqual( - "https://www.reddit.com/r/aww/comments/hr64xh/yall_i_just_cant_this_is_my_son_judah_my_wife_and/", - post.url, - ) - self.assertEqual( - f"
{title}
", post.body - ) - - def test_external_image_post(self): - builder = RedditBuilder - - subreddit = SubredditFactory() - mock_stream = Mock(rule=subreddit) - - with builder(external_image_mock, mock_stream) as builder: - builder.build() - builder.save() - - posts = {post.remote_identifier: post for post in Post.objects.all()} - - self.assertCountEqual(("hr41am", "huoldn"), posts.keys()) - - post = posts["hr41am"] - - url = "http://gfycat.com/thatalivedogwoodclubgall" - title = "Excited cows have a new brush!" - - self.assertEqual( - f"", - post.body, - ) - self.assertEqual( - "https://www.reddit.com/r/aww/comments/hr41am/excited_cows_have_a_new_brush/", - post.url, - ) - - post = posts["huoldn"] - - url = "https://i.imgur.com/usfMVUJ.jpg" - title = "Novosibirsk Zoo welcomes 16 cobalt-eyed Pallas’s cat kittens" - - self.assertEqual( - f"
{title}
", post.body - ) - self.assertEqual( - "https://www.reddit.com/r/aww/comments/huoldn/novosibirsk_zoo_welcomes_16_cobalteyed_pallass/", - post.url, - ) - - def test_video_post(self): - builder = RedditBuilder - - subreddit = SubredditFactory() - mock_stream = Mock(rule=subreddit) - - with builder(video_mock, mock_stream) as builder: - builder.build() - builder.save() - - posts = {post.remote_identifier: post for post in Post.objects.all()} - - self.assertCountEqual(("hr32jf", "hr1r00", "hqy0ny", "hr0uzh"), posts.keys()) - - post = posts["hr1r00"] - - url = "https://v.redd.it/eyvbxaeqtta51/DASH_480.mp4?source=fallback" - - self.assertEqual( - post.url, - "https://www.reddit.com/r/aww/comments/hr1r00/cool_catt_and_his_clingy_girlfriend/", - ) - self.assertEqual( - f"
", - post.body, - ) - - def test_external_video_post(self): - builder = RedditBuilder - - subreddit = SubredditFactory() - mock_stream = Mock(rule=subreddit) - - with builder(external_video_mock, mock_stream) as builder: - builder.build() - builder.save() - - post = Post.objects.get() - - self.assertEqual(post.remote_identifier, "hulh8k") - - self.assertEqual( - post.url, - "https://www.reddit.com/r/aww/comments/hulh8k/dog_splashing_in_water/", - ) - - title = "Dog splashing in water" - url = "https://gfycat.com/excellentinfantileamericanwigeon" - - self.assertEqual( - f"", - post.body, - ) - - def test_external_gifv_video_post(self): - builder = RedditBuilder - - subreddit = SubredditFactory() - mock_stream = Mock(rule=subreddit) - - with builder(external_gifv_mock, mock_stream) as builder: - builder.build() - builder.save() - - post = Post.objects.get() - - self.assertEqual(post.remote_identifier, "humdlf") - - self.assertEqual( - post.url, "https://www.reddit.com/r/aww/comments/humdlf/if_i_fits_i_sits/" - ) - - self.assertEqual( - "
", - post.body, - ) - - def test_link_only_post(self): - builder = RedditBuilder - - subreddit = SubredditFactory() - mock_stream = Mock(rule=subreddit) - - with builder(simple_mock, mock_stream) as builder: - builder.build() - builder.save() - - post = Post.objects.get(remote_identifier="hngsj8") - - title = "KeePassXC 2.6.0 released" - url = "https://keepassxc.org/blog/2020-07-07-2.6.0-released/" - - self.assertIn( - f"", - post.body, - ) - - self.assertEqual( - post.url, - "https://www.reddit.com/r/linux/comments/hngsj8/keepassxc_260_released/", - ) - - def test_skip_not_known_post_type(self): - builder = RedditBuilder - - subreddit = SubredditFactory() - mock_stream = Mock(rule=subreddit) - - with builder(unknown_mock, mock_stream) as builder: - builder.build() - builder.save() - - self.assertEqual(Post.objects.count(), 0) - - def test_nsfw_not_allowed(self): - builder = RedditBuilder - - subreddit = SubredditFactory(reddit_allow_nfsw=False) - mock_stream = Mock(rule=subreddit) - - with builder(nsfw_mock, mock_stream) as builder: - builder.build() - builder.save() - - posts = {post.remote_identifier: post for post in Post.objects.all()} - - self.assertEqual(Post.objects.count(), 1) - self.assertCountEqual(("hna75r",), posts.keys()) - - def test_spoiler_not_allowed(self): - builder = RedditBuilder - - subreddit = SubredditFactory(reddit_allow_spoiler=False) - mock_stream = Mock(rule=subreddit) - - with builder(spoiler_mock, mock_stream) as builder: - builder.build() - builder.save() - - posts = {post.remote_identifier: post for post in Post.objects.all()} - - self.assertEqual(Post.objects.count(), 1) - self.assertCountEqual(("hm0qct",), posts.keys()) - - def test_already_seen_not_allowed(self): - builder = RedditBuilder - - subreddit = SubredditFactory(reddit_allow_viewed=False) - mock_stream = Mock(rule=subreddit) - - with builder(seen_mock, mock_stream) as builder: - builder.build() - builder.save() - - posts = {post.remote_identifier: post for post in Post.objects.all()} - - self.assertEqual(Post.objects.count(), 1) - self.assertCountEqual(("hna75r",), posts.keys()) - - def test_upvote_minimum(self): - builder = RedditBuilder - - subreddit = SubredditFactory(reddit_upvotes_min=100) - mock_stream = Mock(rule=subreddit) - - with builder(upvote_mock, mock_stream) as builder: - builder.build() - builder.save() - - posts = {post.remote_identifier: post for post in Post.objects.all()} - - self.assertEqual(Post.objects.count(), 1) - self.assertCountEqual(("hna75r",), posts.keys()) - - def test_comments_minimum(self): - builder = RedditBuilder - - subreddit = SubredditFactory(reddit_comments_min=100) - mock_stream = Mock(rule=subreddit) - - with builder(comment_mock, mock_stream) as builder: - builder.build() - builder.save() - - posts = {post.remote_identifier: post for post in Post.objects.all()} - - self.assertEqual(Post.objects.count(), 1) - self.assertCountEqual(("hm0qct",), posts.keys()) - - def test_downvote_maximum(self): - builder = RedditBuilder - - subreddit = SubredditFactory(reddit_downvotes_max=20) - mock_stream = Mock(rule=subreddit) - - with builder(downvote_mock, mock_stream) as builder: - builder.build() - builder.save() - - posts = {post.remote_identifier: post for post in Post.objects.all()} - - self.assertEqual(Post.objects.count(), 1) - self.assertCountEqual(("hm0qct",), posts.keys()) diff --git a/src/newsreader/news/collection/tests/reddit/client/__init__.py b/src/newsreader/news/collection/tests/reddit/client/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/newsreader/news/collection/tests/reddit/client/mocks.py b/src/newsreader/news/collection/tests/reddit/client/mocks.py deleted file mode 100644 index 6a11409..0000000 --- a/src/newsreader/news/collection/tests/reddit/client/mocks.py +++ /dev/null @@ -1,160 +0,0 @@ -# Note that some response data is truncated - -simple_mock = { - "data": { - "after": "t3_hjywyf", - "before": None, - "children": [ - { - "data": { - "approved_at_utc": None, - "approved_by": None, - "archived": False, - "author": "AutoModerator", - "banned_at_utc": None, - "banned_by": None, - "category": None, - "content_categories": None, - "created": 1593605471.0, - "created_utc": 1593576671.0, - "discussion_type": None, - "distinguished": "moderator", - "domain": "self.linux", - "edited": False, - "hidden": False, - "id": "hj34ck", - "locked": False, - "name": "t3_hj34ck", - "permalink": "/r/linux/comments/hj34ck/weekly_questions_and_hardware_thread_july_01_2020/", - "pinned": False, - "selftext": "Welcome to r/linux! If you're " - "new to Linux or trying to get " - "started this thread is for you. " - "Get help here or as always, " - "check out r/linuxquestions or " - "r/linux4noobs\n" - "\n" - "This megathread is for all your " - "question needs. As we don't " - "allow questions on r/linux " - "outside of this megathread, " - "please consider using " - "r/linuxquestions or " - "r/linux4noobs for the best " - "solution to your problem.\n" - "\n" - "Ask your hardware requests here " - "too or try r/linuxhardware!", - "selftext_html": "<!-- SC_OFF " - "--><div " - 'class="md"><p>Welcome ' - "to <a " - 'href="/r/linux">r/linux</a>! ' - "If you&#39;re new to " - "Linux or trying to get " - "started this thread is for " - "you. Get help here or as " - "always, check out <a " - 'href="/r/linuxquestions">r/linuxquestions</a> ' - "or <a " - 'href="/r/linux4noobs">r/linux4noobs</a></p>\n' - "\n" - "<p>This megathread is " - "for all your question " - "needs. As we don&#39;t " - "allow questions on <a " - 'href="/r/linux">r/linux</a> ' - "outside of this megathread, " - "please consider using <a " - 'href="/r/linuxquestions">r/linuxquestions</a> ' - "or <a " - 'href="/r/linux4noobs">r/linux4noobs</a> ' - "for the best solution to " - "your problem.</p>\n" - "\n" - "<p>Ask your hardware " - "requests here too or try " - "<a " - 'href="/r/linuxhardware">r/linuxhardware</a>!</p>\n' - "</div><!-- SC_ON " - "-->", - "spoiler": False, - "stickied": True, - "subreddit": "linux", - "subreddit_id": "t5_2qh1a", - "subreddit_name_prefixed": "r/linux", - "title": "Weekly Questions and Hardware " "Thread - July 01, 2020", - "url": "https://www.reddit.com/r/linux/comments/hj34ck/weekly_questions_and_hardware_thread_july_01_2020/", - "visited": False, - }, - "kind": "t3", - }, - { - "data": { - "archived": False, - "author": "AutoModerator", - "banned_at_utc": None, - "banned_by": None, - "category": None, - "created": 1593824903.0, - "created_utc": 1593796103.0, - "discussion_type": None, - "domain": "self.linux", - "edited": False, - "hidden": False, - "id": "hkmu0t", - "name": "t3_hkmu0t", - "permalink": "/r/linux/comments/hkmu0t/weekend_fluff_linux_in_the_wild_thread_july_03/", - "pinned": False, - "saved": False, - "selftext": "Welcome to the weekend! This " - "stickied thread is for you to " - "post pictures of your ubuntu " - "2006 install disk, slackware " - "floppies, on-topic memes or " - "more.\n" - "\n" - "When it's not the weekend, be " - "sure to check out " - "r/WildLinuxAppears or " - "r/linuxmemes!", - "selftext_html": "<!-- SC_OFF " - "--><div " - 'class="md"><p>Welcome ' - "to the weekend! This " - "stickied thread is for you " - "to post pictures of your " - "ubuntu 2006 install disk, " - "slackware floppies, " - "on-topic memes or " - "more.</p>\n" - "\n" - "<p>When it&#39;s " - "not the weekend, be sure to " - "check out <a " - 'href="/r/WildLinuxAppears">r/WildLinuxAppears</a> ' - "or <a " - 'href="/r/linuxmemes">r/linuxmemes</a>!</p>\n' - "</div><!-- SC_ON " - "-->", - "spoiler": False, - "stickied": True, - "subreddit": "linux", - "subreddit_id": "t5_2qh1a", - "subreddit_name_prefixed": "r/linux", - "subreddit_subscribers": 542073, - "subreddit_type": "public", - "thumbnail": "", - "title": "Weekend Fluff / Linux in the Wild " - "Thread - July 03, 2020", - "url": "https://www.reddit.com/r/linux/comments/hkmu0t/weekend_fluff_linux_in_the_wild_thread_july_03/", - "visited": False, - }, - "kind": "t3", - }, - ], - "dist": 27, - "modhash": None, - }, - "kind": "Listing", -} diff --git a/src/newsreader/news/collection/tests/reddit/client/tests.py b/src/newsreader/news/collection/tests/reddit/client/tests.py deleted file mode 100644 index a334346..0000000 --- a/src/newsreader/news/collection/tests/reddit/client/tests.py +++ /dev/null @@ -1,163 +0,0 @@ -from unittest.mock import Mock, patch -from uuid import uuid4 - -from django.test import TestCase -from django.utils.lorem_ipsum import words - -from newsreader.accounts.tests.factories import UserFactory -from newsreader.news.collection.exceptions import ( - StreamDeniedException, - StreamException, - StreamNotFoundException, - StreamParseException, - StreamTimeOutException, - StreamTooManyException, -) -from newsreader.news.collection.reddit import RedditClient -from newsreader.news.collection.tests.factories import SubredditFactory - -from .mocks import simple_mock - - -class RedditClientTestCase(TestCase): - def setUp(self): - self.maxDiff = None - - self.patched_read = patch("newsreader.news.collection.reddit.RedditStream.read") - self.mocked_read = self.patched_read.start() - - def tearDown(self): - patch.stopall() - - def test_client_retrieves_single_rules(self): - subreddit = SubredditFactory() - mock_stream = Mock(rule=subreddit) - - self.mocked_read.return_value = (simple_mock, mock_stream) - - with RedditClient([[subreddit]]) as client: - for data, stream in client: - with self.subTest(data=data, stream=stream): - self.assertEquals(data, simple_mock) - self.assertEquals(stream, mock_stream) - - self.mocked_read.assert_called_once_with() - - def test_client_catches_stream_exception(self): - subreddit = SubredditFactory() - - self.mocked_read.side_effect = StreamException(message="Stream exception") - - with RedditClient([[subreddit]]) as client: - for data, stream in client: - with self.subTest(data=data, stream=stream): - self.assertEquals(data, None) - self.assertEquals(stream, None) - self.assertEquals(stream.rule.error, "Stream exception") - self.assertEquals(stream.rule.succeeded, False) - - self.mocked_read.assert_called_once_with() - - def test_client_catches_stream_not_found_exception(self): - subreddit = SubredditFactory.create() - - self.mocked_read.side_effect = StreamNotFoundException( - message="Stream not found" - ) - - with RedditClient([[subreddit]]) as client: - for data, stream in client: - with self.subTest(data=data, stream=stream): - self.assertEquals(data, None) - self.assertEquals(stream, None) - self.assertEquals(stream.rule.error, "Stream not found") - self.assertEquals(stream.rule.succeeded, False) - - self.mocked_read.assert_called_once_with() - - @patch("newsreader.news.collection.reddit.RedditTokenTask") - def test_client_catches_stream_denied_exception(self, mocked_task): - user = UserFactory( - reddit_access_token=str(uuid4()), reddit_refresh_token=str(uuid4()) - ) - subreddit = SubredditFactory(user=user) - - self.mocked_read.side_effect = StreamDeniedException(message="Token expired") - - with RedditClient([(subreddit,)]) as client: - results = [(data, stream) for data, stream in client] - - self.mocked_read.assert_called_once_with() - mocked_task.delay.assert_called_once_with(user.pk) - - self.assertEquals(len(results), 0) - - user.refresh_from_db() - subreddit.refresh_from_db() - - self.assertEquals(user.reddit_access_token, None) - self.assertEquals(subreddit.succeeded, False) - self.assertEquals(subreddit.error, "Token expired") - - def test_client_catches_stream_timed_out_exception(self): - subreddit = SubredditFactory() - - self.mocked_read.side_effect = StreamTimeOutException( - message="Stream timed out" - ) - - with RedditClient([[subreddit]]) as client: - for data, stream in client: - with self.subTest(data=data, stream=stream): - self.assertEquals(data, None) - self.assertEquals(stream, None) - self.assertEquals(stream.rule.error, "Stream timed out") - self.assertEquals(stream.rule.succeeded, False) - - self.mocked_read.assert_called_once_with() - - def test_client_catches_stream_too_many_exception(self): - subreddit = SubredditFactory() - - self.mocked_read.side_effect = StreamTooManyException - - with RedditClient([[subreddit]]) as client: - for data, stream in client: - with self.subTest(data=data, stream=stream): - self.assertEquals(data, None) - self.assertEquals(stream, None) - self.assertEquals(stream.rule.error, "Too many requests") - self.assertEquals(stream.rule.succeeded, False) - - self.mocked_read.assert_called_once_with() - - def test_client_catches_stream_parse_exception(self): - subreddit = SubredditFactory() - - self.mocked_read.side_effect = StreamParseException( - message="Stream could not be parsed" - ) - - with RedditClient([[subreddit]]) as client: - for data, stream in client: - with self.subTest(data=data, stream=stream): - self.assertEquals(data, None) - self.assertEquals(stream, None) - self.assertEquals(stream.rule.error, "Stream could not be parsed") - self.assertEquals(stream.rule.succeeded, False) - - self.mocked_read.assert_called_once_with() - - def test_client_catches_long_exception_text(self): - subreddit = SubredditFactory() - - self.mocked_read.side_effect = StreamParseException(message=words(1000)) - - with RedditClient([[subreddit]]) as client: - for data, stream in client: - self.assertEquals(data, None) - self.assertEquals(stream, None) - self.assertEquals(len(stream.rule.error), 1024) - self.assertEquals(stream.rule.succeeded, False) - - self.mocked_read.assert_called_once_with() diff --git a/src/newsreader/news/collection/tests/reddit/collector/__init__.py b/src/newsreader/news/collection/tests/reddit/collector/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/newsreader/news/collection/tests/reddit/collector/mocks.py b/src/newsreader/news/collection/tests/reddit/collector/mocks.py deleted file mode 100644 index 37d40d8..0000000 --- a/src/newsreader/news/collection/tests/reddit/collector/mocks.py +++ /dev/null @@ -1,1662 +0,0 @@ -simple_mock_1 = { - "kind": "Listing", - "data": { - "modhash": "khwcr8tmp613f1b92d55150adb744983e7f6c37e87e30f6432", - "dist": 26, - "children": [ - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "starcitizen", - "selftext": "Welcome to the Star Citizen question and answer thread. Feel free to ask any questions you have related to SC here!\r\n\r\n---\r\n\r\nUseful Links and Resources:\r\n\r\n[Star Citizen Wiki](https://starcitizen.tools) - *The biggest and best wiki resource dedicated to Star Citizen*\r\n\r\n[Star Citizen FAQ](https://starcitizen.tools/Frequently_Asked_Questions) - *Chances the answer you need is here.* \r\n\r\n[Discord Help Channel](https://discord.gg/0STCP5tSe7x9NBSq) - *Often times community members will be here to help you with issues.*\r\n\r\n[Referral Code Randomizer](http://gorefer.me/starcitizen) - *Use this when creating a new account to get 5000 extra UEC.*\r\n\r\n[Download Star Citizen](https://robertsspaceindustries.com/download) - *Get the latest version of Star Citizen here*\r\n\r\n[Current Game Features](https://robertsspaceindustries.com/feature-list) - *Click here to see what you can currently do in Star Citizen.*\r\n\r\n[Development Roadmap](https://robertsspaceindustries.com/roadmap/board/1-Star-Citizen) - *The current development status of up and coming Star Citizen features.*\r\n\r\n[Pledge FAQ](https://support.robertsspaceindustries.com/hc/en-us/articles/115013194987-Pledges-FAQs) - *Official FAQ regarding spending money on the game.*", - "author_fullname": "t2_otk50", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Star Citizen: Question and Answer Thread", - "link_flair_richtext": [{"e": "text", "t": "QUESTION"}], - "subreddit_name_prefixed": "r/starcitizen", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "QUESTION", - "downs": 0, - "thumbnail_height": None, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hm6byg", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.9, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 21, - "total_awards_received": 0, - "media_embed": {}, - "thumbnail_width": None, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "QUESTION", - "can_mod_post": False, - "score": 21, - "approved_by": None, - "author_premium": False, - "thumbnail": "self", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "post_hint": "self", - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594065605, - "link_flair_type": "richtext", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.starcitizen", - "allow_live_comments": False, - "selftext_html": '<!-- SC_OFF --><div class="md"><p>Welcome to the Star Citizen question and answer thread. Feel free to ask any questions you have related to SC here!</p>\n\n<hr/>\n\n<p>Useful Links and Resources:</p>\n\n<p><a href="https://starcitizen.tools">Star Citizen Wiki</a> - <em>The biggest and best wiki resource dedicated to Star Citizen</em></p>\n\n<p><a href="https://starcitizen.tools/Frequently_Asked_Questions">Star Citizen FAQ</a> - <em>Chances the answer you need is here.</em> </p>\n\n<p><a href="https://discord.gg/0STCP5tSe7x9NBSq">Discord Help Channel</a> - <em>Often times community members will be here to help you with issues.</em></p>\n\n<p><a href="http://gorefer.me/starcitizen">Referral Code Randomizer</a> - <em>Use this when creating a new account to get 5000 extra UEC.</em></p>\n\n<p><a href="https://robertsspaceindustries.com/download">Download Star Citizen</a> - <em>Get the latest version of Star Citizen here</em></p>\n\n<p><a href="https://robertsspaceindustries.com/feature-list">Current Game Features</a> - <em>Click here to see what you can currently do in Star Citizen.</em></p>\n\n<p><a href="https://robertsspaceindustries.com/roadmap/board/1-Star-Citizen">Development Roadmap</a> - <em>The current development status of up and coming Star Citizen features.</em></p>\n\n<p><a href="https://support.robertsspaceindustries.com/hc/en-us/articles/115013194987-Pledges-FAQs">Pledge FAQ</a> - <em>Official FAQ regarding spending money on the game.</em></p>\n</div><!-- SC_ON -->', - "likes": None, - "suggested_sort": "new", - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "preview": { - "images": [ - { - "source": { - "url": "https://external-preview.redd.it/5qLIX6ObbErxkDiTz24uP6TbZGNVNyy2SeXusPhzaKA.jpg?auto=webp&s=738b5270a81373916191470a1da34cdcc54d8511", - "width": 332, - "height": 360, - }, - "resolutions": [ - { - "url": "https://external-preview.redd.it/5qLIX6ObbErxkDiTz24uP6TbZGNVNyy2SeXusPhzaKA.jpg?width=108&crop=smart&auto=webp&s=e2ee2a9dae15472663b52c8cb4e002fdbbb6378c", - "width": 108, - "height": 117, - }, - { - "url": "https://external-preview.redd.it/5qLIX6ObbErxkDiTz24uP6TbZGNVNyy2SeXusPhzaKA.jpg?width=216&crop=smart&auto=webp&s=3690c60a9b533d376f159f306c6667b47ff42102", - "width": 216, - "height": 234, - }, - { - "url": "https://external-preview.redd.it/5qLIX6ObbErxkDiTz24uP6TbZGNVNyy2SeXusPhzaKA.jpg?width=320&crop=smart&auto=webp&s=4dcb434a5071329ecbb9f3543e4d06442ab141df", - "width": 320, - "height": 346, - }, - ], - "variants": {}, - "id": "KTE3H6RnWCasOJCFtdmgmw51FMzxSqXz_SRD6W5Rdsc", - } - ], - "enabled": False, - }, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2v94d", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hm6byg", - "is_robot_indexable": True, - "report_reasons": None, - "author": "UEE_Central_Computer", - "discussion_type": None, - "num_comments": 380, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/starcitizen/comments/hm6byg/star_citizen_question_and_answer_thread/", - "parent_whitelist_status": "all_ads", - "stickied": True, - "url": "https://www.reddit.com/r/starcitizen/comments/hm6byg/star_citizen_question_and_answer_thread/", - "subreddit_subscribers": 213071, - "created_utc": 1594036805, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "starcitizen", - "selftext": "", - "author_fullname": "t2_6wgp9w28", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "5 random people in a train felt like such a rare and special thing 😁", - "link_flair_richtext": [{"e": "text", "t": "FLUFF"}], - "subreddit_name_prefixed": "r/starcitizen", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "fluff", - "downs": 0, - "thumbnail_height": 78, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hpkhgj", - "quarantine": False, - "link_flair_text_color": "light", - "upvote_ratio": 0.98, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 892, - "total_awards_received": 0, - "media_embed": {}, - "thumbnail_width": 140, - "author_flair_template_id": "a87724f8-c2b5-11e4-b7e0-22000b2103f6", - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": True, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "FLUFF", - "can_mod_post": False, - "score": 892, - "approved_by": None, - "author_premium": False, - "thumbnail": "https://b.thumbs.redditmedia.com/YlF6BTm-DfnrZBeukYiOyrP-Fkj2xUQtk_V8ZeUD93w.jpg", - "edited": False, - "author_flair_css_class": "aurora", - "author_flair_richtext": [ - {"e": "text", "t": "🌌2013Backer🎮vGameDev🌌"} - ], - "gildings": {}, - "post_hint": "image", - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594540209, - "link_flair_type": "richtext", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "richtext", - "domain": "i.redd.it", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://i.redd.it/0jkge020fba51.png", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "preview": { - "images": [ - { - "source": { - "url": "https://preview.redd.it/0jkge020fba51.png?auto=webp&s=c3a2b8cb860f839638a364d49abca04fd4f42094", - "width": 2560, - "height": 1440, - }, - "resolutions": [ - { - "url": "https://preview.redd.it/0jkge020fba51.png?width=108&crop=smart&auto=webp&s=778a7f7d9b2e0d713161e84b32c467ebde6cbc17", - "width": 108, - "height": 60, - }, - { - "url": "https://preview.redd.it/0jkge020fba51.png?width=216&crop=smart&auto=webp&s=53afc50cc2dd6c72470e76a4c3ff8ef597f66e0d", - "width": 216, - "height": 121, - }, - { - "url": "https://preview.redd.it/0jkge020fba51.png?width=320&crop=smart&auto=webp&s=089f9ff42e429b5062c143695e695cbb4ea5b679", - "width": 320, - "height": 180, - }, - { - "url": "https://preview.redd.it/0jkge020fba51.png?width=640&crop=smart&auto=webp&s=045327ac6fd113630c0faef426d86efaf04f55e2", - "width": 640, - "height": 360, - }, - { - "url": "https://preview.redd.it/0jkge020fba51.png?width=960&crop=smart&auto=webp&s=efbdc9ddcda1207fafa20bb45e82fbe24ed37df8", - "width": 960, - "height": 540, - }, - { - "url": "https://preview.redd.it/0jkge020fba51.png?width=1080&crop=smart&auto=webp&s=1b94c9951c60a788357dfa0fe21dd983efdcf1e7", - "width": 1080, - "height": 607, - }, - ], - "variants": {}, - "id": "r-JjrJn0RtZLaxMk_d-TCfW80pWgJ-5kjMaje54J5_I", - } - ], - "enabled": True, - }, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "db099dc4-3538-11e5-97ec-0e7f0fa558f9", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": "🌌2013Backer🎮vGameDev🌌", - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2v94d", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "#007373", - "id": "hpkhgj", - "is_robot_indexable": True, - "report_reasons": None, - "author": "Y_DK_Y", - "discussion_type": None, - "num_comments": 39, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": "dark", - "permalink": "/r/starcitizen/comments/hpkhgj/5_random_people_in_a_train_felt_like_such_a_rare/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://i.redd.it/0jkge020fba51.png", - "subreddit_subscribers": 213071, - "created_utc": 1594511409, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "starcitizen", - "selftext": "", - "author_fullname": "t2_4brylpu5", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Drake Interplanetary Smartkey thing that I made!", - "link_flair_richtext": [{"e": "text", "t": "ARTWORK"}], - "subreddit_name_prefixed": "r/starcitizen", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "artwork", - "downs": 0, - "thumbnail_height": 78, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hph00n", - "quarantine": False, - "link_flair_text_color": "light", - "upvote_ratio": 0.97, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 547, - "total_awards_received": 1, - "media_embed": {}, - "thumbnail_width": 140, - "author_flair_template_id": None, - "is_original_content": True, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": True, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "ARTWORK", - "can_mod_post": False, - "score": 547, - "approved_by": None, - "author_premium": False, - "thumbnail": "https://b.thumbs.redditmedia.com/gr7RYEjNN5FNc42LxuizFW_ZxWtS3xbZj1QfhIa-2Hw.jpg", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "post_hint": "image", - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594527804, - "link_flair_type": "richtext", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "i.redd.it", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://i.redd.it/b6h74eljeaa51.png", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "preview": { - "images": [ - { - "source": { - "url": "https://preview.redd.it/b6h74eljeaa51.png?auto=webp&s=fd286c2dcd98378c34fde6e245cf13c357716dca", - "width": 1920, - "height": 1080, - }, - "resolutions": [ - { - "url": "https://preview.redd.it/b6h74eljeaa51.png?width=108&crop=smart&auto=webp&s=3150c2a2643d178eba735cb0bc222b8b29f46c8c", - "width": 108, - "height": 60, - }, - { - "url": "https://preview.redd.it/b6h74eljeaa51.png?width=216&crop=smart&auto=webp&s=9120ce40ce7439ca4d3431da7782a8c6acd2eebf", - "width": 216, - "height": 121, - }, - { - "url": "https://preview.redd.it/b6h74eljeaa51.png?width=320&crop=smart&auto=webp&s=83cd5c93fe7a19e5643df38eec3aefee54912faf", - "width": 320, - "height": 180, - }, - { - "url": "https://preview.redd.it/b6h74eljeaa51.png?width=640&crop=smart&auto=webp&s=b3e280a4a7fbaf794692c01f4ff63af0b8559700", - "width": 640, - "height": 360, - }, - { - "url": "https://preview.redd.it/b6h74eljeaa51.png?width=960&crop=smart&auto=webp&s=8ebac203688ba0e42c7975f3d7688dab25fc065b", - "width": 960, - "height": 540, - }, - { - "url": "https://preview.redd.it/b6h74eljeaa51.png?width=1080&crop=smart&auto=webp&s=8350e0b4e004820ef9f30501397d49a2121186ec", - "width": 1080, - "height": 607, - }, - ], - "variants": {}, - "id": "B2HxXfFibxKUtHO9eBwT-Bt_VrE870XhC0R5OFA95rI", - } - ], - "enabled": True, - }, - "all_awardings": [ - { - "giver_coin_reward": 0, - "subreddit_id": None, - "is_new": False, - "days_of_drip_extension": 0, - "coin_price": 50, - "id": "award_02d9ab2c-162e-4c01-8438-317a016ed3d9", - "penny_donate": 0, - "award_sub_type": "GLOBAL", - "coin_reward": 0, - "icon_url": "https://i.redd.it/award_images/t5_22cerq/898sygoknoo41_TakeMyEnergy.png", - "days_of_premium": 0, - "resized_icons": [ - { - "url": "https://preview.redd.it/award_images/t5_22cerq/898sygoknoo41_TakeMyEnergy.png?width=16&height=16&auto=webp&s=92e96be1dbd278dc987fbd9acc1bd5078566f254", - "width": 16, - "height": 16, - }, - { - "url": "https://preview.redd.it/award_images/t5_22cerq/898sygoknoo41_TakeMyEnergy.png?width=32&height=32&auto=webp&s=83e14655f2b162b295f7d2c7058b9ad94cf8b73c", - "width": 32, - "height": 32, - }, - { - "url": "https://preview.redd.it/award_images/t5_22cerq/898sygoknoo41_TakeMyEnergy.png?width=48&height=48&auto=webp&s=83038a4d6181d3c8f5107dbca4ddb735ca6c2231", - "width": 48, - "height": 48, - }, - { - "url": "https://preview.redd.it/award_images/t5_22cerq/898sygoknoo41_TakeMyEnergy.png?width=64&height=64&auto=webp&s=3c4e39a7664d799ff50f32e9a3f96c3109d2e266", - "width": 64, - "height": 64, - }, - { - "url": "https://preview.redd.it/award_images/t5_22cerq/898sygoknoo41_TakeMyEnergy.png?width=128&height=128&auto=webp&s=390bf9706b8e1a6215716ebcf6363373f125c339", - "width": 128, - "height": 128, - }, - ], - "icon_width": 2048, - "static_icon_width": 2048, - "start_date": None, - "is_enabled": True, - "description": "I'm in this with you.", - "end_date": None, - "subreddit_coin_reward": 0, - "count": 1, - "static_icon_height": 2048, - "name": "Take My Energy", - "resized_static_icons": [ - { - "url": "https://preview.redd.it/award_images/t5_22cerq/898sygoknoo41_TakeMyEnergy.png?width=16&height=16&auto=webp&s=92e96be1dbd278dc987fbd9acc1bd5078566f254", - "width": 16, - "height": 16, - }, - { - "url": "https://preview.redd.it/award_images/t5_22cerq/898sygoknoo41_TakeMyEnergy.png?width=32&height=32&auto=webp&s=83e14655f2b162b295f7d2c7058b9ad94cf8b73c", - "width": 32, - "height": 32, - }, - { - "url": "https://preview.redd.it/award_images/t5_22cerq/898sygoknoo41_TakeMyEnergy.png?width=48&height=48&auto=webp&s=83038a4d6181d3c8f5107dbca4ddb735ca6c2231", - "width": 48, - "height": 48, - }, - { - "url": "https://preview.redd.it/award_images/t5_22cerq/898sygoknoo41_TakeMyEnergy.png?width=64&height=64&auto=webp&s=3c4e39a7664d799ff50f32e9a3f96c3109d2e266", - "width": 64, - "height": 64, - }, - { - "url": "https://preview.redd.it/award_images/t5_22cerq/898sygoknoo41_TakeMyEnergy.png?width=128&height=128&auto=webp&s=390bf9706b8e1a6215716ebcf6363373f125c339", - "width": 128, - "height": 128, - }, - ], - "icon_format": "PNG", - "icon_height": 2048, - "penny_price": 0, - "award_type": "global", - "static_icon_url": "https://i.redd.it/award_images/t5_22cerq/898sygoknoo41_TakeMyEnergy.png", - } - ], - "awarders": [], - "media_only": False, - "link_flair_template_id": "e3bb68b2-3538-11e5-bf5a-0e09b4299f63", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2v94d", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "#ff66ac", - "id": "hph00n", - "is_robot_indexable": True, - "report_reasons": None, - "author": "HannahB888", - "discussion_type": None, - "num_comments": 38, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/starcitizen/comments/hph00n/drake_interplanetary_smartkey_thing_that_i_made/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://i.redd.it/b6h74eljeaa51.png", - "subreddit_subscribers": 213071, - "created_utc": 1594499004, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "starcitizen", - "selftext": "", - "author_fullname": "t2_exlc6", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "A Historical Moment for CIG", - "link_flair_richtext": [{"e": "text", "t": "FLUFF"}], - "subreddit_name_prefixed": "r/starcitizen", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "fluff", - "downs": 0, - "thumbnail_height": 37, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hp9mlw", - "quarantine": False, - "link_flair_text_color": "light", - "upvote_ratio": 0.98, - "author_flair_background_color": "", - "subreddit_type": "public", - "ups": 1444, - "total_awards_received": 0, - "media_embed": {}, - "thumbnail_width": 140, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": True, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "FLUFF", - "can_mod_post": False, - "score": 1444, - "approved_by": None, - "author_premium": False, - "thumbnail": "https://b.thumbs.redditmedia.com/YYdiE2x8fsn0ckVJiGCnBzUIOa1DA03ALh3TJuVlZks.jpg", - "edited": False, - "author_flair_css_class": "carrack", - "author_flair_richtext": [{"e": "text", "t": "AHV Artemis"}], - "gildings": {}, - "post_hint": "image", - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594501406, - "link_flair_type": "richtext", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "richtext", - "domain": "i.redd.it", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://i.redd.it/fdh2ujp388a51.png", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "preview": { - "images": [ - { - "source": { - "url": "https://preview.redd.it/fdh2ujp388a51.png?auto=webp&s=605044c2757c1b5ca9060d3ec448090396a2f0dd", - "width": 424, - "height": 114, - }, - "resolutions": [ - { - "url": "https://preview.redd.it/fdh2ujp388a51.png?width=108&crop=smart&auto=webp&s=9789c6b76d45e46645fe2454555bfbd042a39815", - "width": 108, - "height": 29, - }, - { - "url": "https://preview.redd.it/fdh2ujp388a51.png?width=216&crop=smart&auto=webp&s=3f419183835c883f10b1caab3a7ecbec4ebbf3ec", - "width": 216, - "height": 58, - }, - { - "url": "https://preview.redd.it/fdh2ujp388a51.png?width=320&crop=smart&auto=webp&s=695ff914462b5b9bc253ce26f4a51f5f22641148", - "width": 320, - "height": 86, - }, - ], - "variants": {}, - "id": "XWdU5CBWG0-5mOzBRF65OnvZzQm2Btd2ldGMeJ8u_gI", - } - ], - "enabled": True, - }, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "db099dc4-3538-11e5-97ec-0e7f0fa558f9", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": "AHV Artemis", - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2v94d", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "#007373", - "id": "hp9mlw", - "is_robot_indexable": True, - "report_reasons": None, - "author": "sam00197", - "discussion_type": None, - "num_comments": 194, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": "dark", - "permalink": "/r/starcitizen/comments/hp9mlw/a_historical_moment_for_cig/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://i.redd.it/fdh2ujp388a51.png", - "subreddit_subscribers": 213071, - "created_utc": 1594472606, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "starcitizen", - "selftext": "", - "author_fullname": "t2_4dgjlpn7", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "This view. What's your favorite moon?", - "link_flair_richtext": [{"e": "text", "t": "DISCUSSION"}], - "subreddit_name_prefixed": "r/starcitizen", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "discussion", - "downs": 0, - "thumbnail_height": 78, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hpjn8x", - "quarantine": False, - "link_flair_text_color": "light", - "upvote_ratio": 0.96, - "author_flair_background_color": "", - "subreddit_type": "public", - "ups": 182, - "total_awards_received": 0, - "media_embed": {}, - "thumbnail_width": 140, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": True, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "DISCUSSION", - "can_mod_post": False, - "score": 182, - "approved_by": None, - "author_premium": False, - "thumbnail": "https://a.thumbs.redditmedia.com/tKHL_2fn4Zo9FhrtP3UiJlQA7xkMU7-iN0ntJbhfa80.jpg", - "edited": False, - "author_flair_css_class": "", - "author_flair_richtext": [{"e": "text", "t": "new user/low karma"}], - "gildings": {}, - "post_hint": "image", - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594537150, - "link_flair_type": "richtext", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "richtext", - "domain": "i.redd.it", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://i.redd.it/ovly7f9g6ba51.jpg", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "preview": { - "images": [ - { - "source": { - "url": "https://preview.redd.it/ovly7f9g6ba51.jpg?auto=webp&s=d7051e4c713e39c642c583e5e8ada57c9660fa26", - "width": 2560, - "height": 1440, - }, - "resolutions": [ - { - "url": "https://preview.redd.it/ovly7f9g6ba51.jpg?width=108&crop=smart&auto=webp&s=35f6ebe4531c12bc24532f01741bcf8100d954b2", - "width": 108, - "height": 60, - }, - { - "url": "https://preview.redd.it/ovly7f9g6ba51.jpg?width=216&crop=smart&auto=webp&s=a939922e34cf4ff6a82eeb22e71acb816ccc6d7b", - "width": 216, - "height": 121, - }, - { - "url": "https://preview.redd.it/ovly7f9g6ba51.jpg?width=320&crop=smart&auto=webp&s=9796767ed73e04a774d2f1ba8cf3662bbd4195eb", - "width": 320, - "height": 180, - }, - { - "url": "https://preview.redd.it/ovly7f9g6ba51.jpg?width=640&crop=smart&auto=webp&s=37fe4c262b752cb8dac903daf606be8f0ac3b44f", - "width": 640, - "height": 360, - }, - { - "url": "https://preview.redd.it/ovly7f9g6ba51.jpg?width=960&crop=smart&auto=webp&s=305245fd1d352634c86459131b11238fe09f5d2b", - "width": 960, - "height": 540, - }, - { - "url": "https://preview.redd.it/ovly7f9g6ba51.jpg?width=1080&crop=smart&auto=webp&s=e8438e4b666cf616646ffad09c153d120df1f1d9", - "width": 1080, - "height": 607, - }, - ], - "variants": {}, - "id": "SjRqA5h_B55WLnwAlocF6wcxIHZLgGBMpmb5nV1EQ4E", - } - ], - "enabled": True, - }, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "ca858044-1916-11e2-a9b9-12313d168e98", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": "new user/low karma", - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2v94d", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "#014980", - "id": "hpjn8x", - "is_robot_indexable": True, - "report_reasons": None, - "author": "clericanubis", - "discussion_type": None, - "num_comments": 27, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": "dark", - "permalink": "/r/starcitizen/comments/hpjn8x/this_view_whats_your_favorite_moon/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://i.redd.it/ovly7f9g6ba51.jpg", - "subreddit_subscribers": 213071, - "created_utc": 1594508350, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - ], - "after": "t3_hplinp", - "before": None, - }, -} - -simple_mock_2 = { - "kind": "Listing", - "data": { - "modhash": "y4he8gfzh9f892e2bf3094bc06daba2e02288e617fecf555b5", - "dist": 27, - "children": [ - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "Python", - "selftext": "Top Level comments must be **Job Opportunities.**\n\nPlease include **Location** or any other **Requirements** in your comment. If you require people to work on site in San Francisco, *you must note that in your post.* If you require an Engineering degree, *you must note that in your post*.\n\nPlease include as much information as possible.\n\nIf you are looking for jobs, send a PM to the poster.", - "author_fullname": "t2_628u", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "/r/Python Job Board for May, June, July", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/Python", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_gdfaip", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.98, - "author_flair_background_color": "", - "subreddit_type": "public", - "ups": 108, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 108, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": "", - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1588640187, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.Python", - "allow_live_comments": True, - "selftext_html": '<!-- SC_OFF --><div class="md"><p>Top Level comments must be <strong>Job Opportunities.</strong></p>\n\n<p>Please include <strong>Location</strong> or any other <strong>Requirements</strong> in your comment. If you require people to work on site in San Francisco, <em>you must note that in your post.</em> If you require an Engineering degree, <em>you must note that in your post</em>.</p>\n\n<p>Please include as much information as possible.</p>\n\n<p>If you are looking for jobs, send a PM to the poster.</p>\n</div><!-- SC_ON -->', - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": "reticulated", - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh0y", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "gdfaip", - "is_robot_indexable": True, - "report_reasons": None, - "author": "aphoenix", - "discussion_type": None, - "num_comments": 38, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": "dark", - "permalink": "/r/Python/comments/gdfaip/rpython_job_board_for_may_june_july/", - "parent_whitelist_status": "all_ads", - "stickied": True, - "url": "https://www.reddit.com/r/Python/comments/gdfaip/rpython_job_board_for_may_june_july/", - "subreddit_subscribers": 616297, - "created_utc": 1588611387, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "Python", - "selftext": "# EDIT: AMA complete. Huge thanks to the PyCharm Team for holding this!\n\nAs mentioned in the comments you can use code `reddit20202` at [https://www.jetbrains.com/store/redeem/](https://www.jetbrains.com/store/redeem/) to try out PyCharm Professional as a new JetBrains customer!\n\nWe will be joined by members of the PyCharm Developer team from JetBrains to answer all sorts of questions on the PyCharm IDE and the Python language!\n\n[PyCharm](https://www.jetbrains.com/pycharm/) is the professional IDE for Python Developers with over 33% of respondents from the [2019 Python Developers Survey](https://www.jetbrains.com/lp/python-developers-survey-2019/) choosing it as their main editor.\n\nPyCharm features smart autocompletion, on-the-fly error checking and quick fixes as well as PEP8 compliance detection and automatic refactoring.\n\nIf you haven't checked out PyCharm then you definitely should, the Community Edition of PyCharm includes many key features such as the debugger, test runners, intelligent code completion and more!\n\nIf you are looking for a professional IDE for Python then the PyCharm Professional edition adds features such as advanced web development tools and database/SQL support, if you are a student or maintain an open source project make sure to take a look at the generous discounts JetBrains offer for their products!\n\nThe AMA will begin at 16:00 UTC on the 9th of July. Feel free to drop questions below for the PyCharm team to answer!\n\nWe will be joined by:\n\n* Nafiul Islam, u/nafiulislamjb (Developer Advocate for PyCharm)\n* Andrey Vlasovskikh, u/vlasovskikh (PyCharm Team Lead)", - "user_reports": [], - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "AMA with PyCharm team from JetBrains on 9th July @ 16:00 UTC", - "event_start": 1594310400, - "subreddit_name_prefixed": "r/Python", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "editors", - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hmd2ez", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.94, - "author_flair_background_color": "", - "subreddit_type": "public", - "ups": 60, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "author_fullname": "t2_145f96", - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "Editors / IDEs", - "can_mod_post": False, - "score": 60, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": 1594321779, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594088635, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.Python", - "allow_live_comments": False, - "selftext_html": '<!-- SC_OFF --><div class="md"><h1>EDIT: AMA complete. Huge thanks to the PyCharm Team for holding this!</h1>\n\n<p>As mentioned in the comments you can use code <code>reddit20202</code> at <a href="https://www.jetbrains.com/store/redeem/">https://www.jetbrains.com/store/redeem/</a> to try out PyCharm Professional as a new JetBrains customer!</p>\n\n<p>We will be joined by members of the PyCharm Developer team from JetBrains to answer all sorts of questions on the PyCharm IDE and the Python language!</p>\n\n<p><a href="https://www.jetbrains.com/pycharm/">PyCharm</a> is the professional IDE for Python Developers with over 33% of respondents from the <a href="https://www.jetbrains.com/lp/python-developers-survey-2019/">2019 Python Developers Survey</a> choosing it as their main editor.</p>\n\n<p>PyCharm features smart autocompletion, on-the-fly error checking and quick fixes as well as PEP8 compliance detection and automatic refactoring.</p>\n\n<p>If you haven&#39;t checked out PyCharm then you definitely should, the Community Edition of PyCharm includes many key features such as the debugger, test runners, intelligent code completion and more!</p>\n\n<p>If you are looking for a professional IDE for Python then the PyCharm Professional edition adds features such as advanced web development tools and database/SQL support, if you are a student or maintain an open source project make sure to take a look at the generous discounts JetBrains offer for their products!</p>\n\n<p>The AMA will begin at 16:00 UTC on the 9th of July. Feel free to drop questions below for the PyCharm team to answer!</p>\n\n<p>We will be joined by:</p>\n\n<ul>\n<li>Nafiul Islam, <a href="/u/nafiulislamjb">u/nafiulislamjb</a> (Developer Advocate for PyCharm)</li>\n<li>Andrey Vlasovskikh, <a href="/u/vlasovskikh">u/vlasovskikh</a> (PyCharm Team Lead)</li>\n</ul>\n</div><!-- SC_ON -->', - "likes": None, - "suggested_sort": "confidence", - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "49f2747c-4114-11ea-b9fe-0e741fe75651", - "link_flair_richtext": [], - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": "Owner of Python Discord", - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": "moderator", - "subreddit_id": "t5_2qh0y", - "event_end": 1594324800, - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "event_is_live": False, - "id": "hmd2ez", - "is_robot_indexable": True, - "report_reasons": None, - "author": "Im__Joseph", - "discussion_type": None, - "num_comments": 65, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": "dark", - "permalink": "/r/Python/comments/hmd2ez/ama_with_pycharm_team_from_jetbrains_on_9th_july/", - "parent_whitelist_status": "all_ads", - "stickied": True, - "url": "https://www.reddit.com/r/Python/comments/hmd2ez/ama_with_pycharm_team_from_jetbrains_on_9th_july/", - "subreddit_subscribers": 616297, - "created_utc": 1594059835, - "num_crossposts": 2, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "Python", - "selftext": "", - "author_fullname": "t2_woll6", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "I am a medical student, and I recently programmed an open-source eye-tracker for brain research", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/Python", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "made-this", - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hpr28u", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.99, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 439, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": "4cc838b8-3159-11e1-83e4-12313d18ad57", - "is_original_content": False, - "user_reports": [], - "secure_media": { - "reddit_video": { - "fallback_url": "https://v.redd.it/tqzx750wzda51/DASH_360.mp4?source=fallback", - "height": 384, - "width": 512, - "scrubber_media_url": "https://v.redd.it/tqzx750wzda51/DASH_96.mp4", - "dash_url": "https://v.redd.it/tqzx750wzda51/DASHPlaylist.mpd?a=1597142191%2CY2JkNmU5Y2FmZGM1NzA5MjhkYTk5NjdmMWRmNWI4M2I2N2Q2MjA5NmIzZWRmODJiMjk0MzY4OTZlYTBiZmZlZg%3D%3D&v=1&f=sd", - "duration": 31, - "hls_url": "https://v.redd.it/tqzx750wzda51/HLSPlaylist.m3u8?a=1597142191%2CZDVhNWNjMGQ0OTBjOTU0Zjk5MDgwZmE2YzA1MGY5YzNlZThmZTAxZTgxODIxMGFjZDdlYzczOWFlYTcyMmMzNg%3D%3D&v=1&f=sd", - "is_gif": False, - "transcoding_status": "completed", - } - }, - "is_reddit_media_domain": True, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "I Made This", - "can_mod_post": False, - "score": 439, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594571350, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "v.redd.it", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://v.redd.it/tqzx750wzda51", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "d7dfae22-4113-11ea-b9fe-0e741fe75651", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": "Neuroscientist", - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh0y", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hpr28u", - "is_robot_indexable": True, - "report_reasons": None, - "author": "Sebaron", - "discussion_type": None, - "num_comments": 33, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": "dark", - "permalink": "/r/Python/comments/hpr28u/i_am_a_medical_student_and_i_recently_programmed/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://v.redd.it/tqzx750wzda51", - "subreddit_subscribers": 616297, - "created_utc": 1594542550, - "num_crossposts": 0, - "media": { - "reddit_video": { - "fallback_url": "https://v.redd.it/tqzx750wzda51/DASH_360.mp4?source=fallback", - "height": 384, - "width": 512, - "scrubber_media_url": "https://v.redd.it/tqzx750wzda51/DASH_96.mp4", - "dash_url": "https://v.redd.it/tqzx750wzda51/DASHPlaylist.mpd?a=1597142191%2CY2JkNmU5Y2FmZGM1NzA5MjhkYTk5NjdmMWRmNWI4M2I2N2Q2MjA5NmIzZWRmODJiMjk0MzY4OTZlYTBiZmZlZg%3D%3D&v=1&f=sd", - "duration": 31, - "hls_url": "https://v.redd.it/tqzx750wzda51/HLSPlaylist.m3u8?a=1597142191%2CZDVhNWNjMGQ0OTBjOTU0Zjk5MDgwZmE2YzA1MGY5YzNlZThmZTAxZTgxODIxMGFjZDdlYzczOWFlYTcyMmMzNg%3D%3D&v=1&f=sd", - "is_gif": False, - "transcoding_status": "completed", - } - }, - "is_video": True, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "Python", - "selftext": "", - "author_fullname": "t2_6zgzj94n", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "I made a filename simplifier which removes unnecessary tags, metadata, dashes, dots, underscores, and non-English characters from filenames (and folders) to give your library a neat look.", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/Python", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "made-this", - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hpps6f", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.95, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 258, - "total_awards_received": 1, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": { - "reddit_video": { - "fallback_url": "https://v.redd.it/jq229anzada51/DASH_1080.mp4?source=fallback", - "height": 1080, - "width": 1920, - "scrubber_media_url": "https://v.redd.it/jq229anzada51/DASH_96.mp4", - "dash_url": "https://v.redd.it/jq229anzada51/DASHPlaylist.mpd?a=1597142191%2CZDU4Y2FmYzI2NjMzZTMxNzJkOThiMzJmYzBlOTMyMmEwNTg3MTFhMmU0OWZjZDljZGQ4MjAwMTgxMGVhYzU1OQ%3D%3D&v=1&f=sd", - "duration": 27, - "hls_url": "https://v.redd.it/jq229anzada51/HLSPlaylist.m3u8?a=1597142191%2CYmY1Y2Q5ZjQ0ZWVmODAxODQ3MGU3YzA1YzIxOTEzODFlNWQyMjE4MzAyYzNiMDM5NTI0N2M5OTRmY2YwN2NlOA%3D%3D&v=1&f=sd", - "is_gif": False, - "transcoding_status": "completed", - } - }, - "is_reddit_media_domain": True, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "I Made This", - "can_mod_post": False, - "score": 258, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594563987, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "v.redd.it", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://v.redd.it/jq229anzada51", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [ - { - "giver_coin_reward": 0, - "subreddit_id": None, - "is_new": False, - "days_of_drip_extension": 0, - "coin_price": 75, - "id": "award_9663243a-e77f-44cf-abc6-850ead2cd18d", - "penny_donate": 0, - "award_sub_type": "PREMIUM", - "coin_reward": 0, - "icon_url": "https://www.redditstatic.com/gold/awards/icon/SnooClappingPremium_512.png", - "days_of_premium": 0, - "resized_icons": [ - { - "url": "https://www.redditstatic.com/gold/awards/icon/SnooClappingPremium_16.png", - "width": 16, - "height": 16, - }, - { - "url": "https://www.redditstatic.com/gold/awards/icon/SnooClappingPremium_32.png", - "width": 32, - "height": 32, - }, - { - "url": "https://www.redditstatic.com/gold/awards/icon/SnooClappingPremium_48.png", - "width": 48, - "height": 48, - }, - { - "url": "https://www.redditstatic.com/gold/awards/icon/SnooClappingPremium_64.png", - "width": 64, - "height": 64, - }, - { - "url": "https://www.redditstatic.com/gold/awards/icon/SnooClappingPremium_128.png", - "width": 128, - "height": 128, - }, - ], - "icon_width": 512, - "static_icon_width": 512, - "start_date": None, - "is_enabled": True, - "description": "For an especially amazing showing.", - "end_date": None, - "subreddit_coin_reward": 0, - "count": 1, - "static_icon_height": 512, - "name": "Bravo Grande!", - "resized_static_icons": [ - { - "url": "https://preview.redd.it/award_images/t5_q0gj4/59e02tmkl4451_BravoGrande-Static.png?width=16&height=16&auto=webp&s=3459bdf1d1777821a831c5bf9834f4365263fcff", - "width": 16, - "height": 16, - }, - { - "url": "https://preview.redd.it/award_images/t5_q0gj4/59e02tmkl4451_BravoGrande-Static.png?width=32&height=32&auto=webp&s=9181d68065ccfccf2b1074e499cd7c1103aa2ce8", - "width": 32, - "height": 32, - }, - { - "url": "https://preview.redd.it/award_images/t5_q0gj4/59e02tmkl4451_BravoGrande-Static.png?width=48&height=48&auto=webp&s=339b368d395219120abc50d54fb3e2cdcad8ca4f", - "width": 48, - "height": 48, - }, - { - "url": "https://preview.redd.it/award_images/t5_q0gj4/59e02tmkl4451_BravoGrande-Static.png?width=64&height=64&auto=webp&s=de4ebbe92f9019de05aaa77f88810d44adbe1e50", - "width": 64, - "height": 64, - }, - { - "url": "https://preview.redd.it/award_images/t5_q0gj4/59e02tmkl4451_BravoGrande-Static.png?width=128&height=128&auto=webp&s=ba6c1add5204ea43e5af010bd9622392a42140e3", - "width": 128, - "height": 128, - }, - ], - "icon_format": "APNG", - "icon_height": 512, - "penny_price": 0, - "award_type": "global", - "static_icon_url": "https://i.redd.it/award_images/t5_q0gj4/59e02tmkl4451_BravoGrande-Static.png", - } - ], - "awarders": [], - "media_only": False, - "link_flair_template_id": "d7dfae22-4113-11ea-b9fe-0e741fe75651", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh0y", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hpps6f", - "is_robot_indexable": True, - "report_reasons": None, - "author": "Hobo-TheGodOfPoverty", - "discussion_type": None, - "num_comments": 25, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/Python/comments/hpps6f/i_made_a_filename_simplifier_which_removes/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://v.redd.it/jq229anzada51", - "subreddit_subscribers": 616297, - "created_utc": 1594535187, - "num_crossposts": 0, - "media": { - "reddit_video": { - "fallback_url": "https://v.redd.it/jq229anzada51/DASH_1080.mp4?source=fallback", - "height": 1080, - "width": 1920, - "scrubber_media_url": "https://v.redd.it/jq229anzada51/DASH_96.mp4", - "dash_url": "https://v.redd.it/jq229anzada51/DASHPlaylist.mpd?a=1597142191%2CZDU4Y2FmYzI2NjMzZTMxNzJkOThiMzJmYzBlOTMyMmEwNTg3MTFhMmU0OWZjZDljZGQ4MjAwMTgxMGVhYzU1OQ%3D%3D&v=1&f=sd", - "duration": 27, - "hls_url": "https://v.redd.it/jq229anzada51/HLSPlaylist.m3u8?a=1597142191%2CYmY1Y2Q5ZjQ0ZWVmODAxODQ3MGU3YzA1YzIxOTEzODFlNWQyMjE4MzAyYzNiMDM5NTI0N2M5OTRmY2YwN2NlOA%3D%3D&v=1&f=sd", - "is_gif": False, - "transcoding_status": "completed", - } - }, - "is_video": True, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "Python", - "selftext": "", - "author_fullname": "t2_1kjpn251", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Concept Art: what might python look like in Japanese, without any English characters?", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/Python", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "discussion", - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hp7uqe", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.94, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 1697, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": True, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "Discussion", - "can_mod_post": False, - "score": 1697, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "crosspost_parent_list": [ - { - "approved_at_utc": None, - "subreddit": "ProgrammingLanguages", - "selftext": "", - "author_fullname": "t2_f4rdtgk", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Concept Art: what might python look like in Japanese, without any English characters?", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/ProgrammingLanguages", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "", - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_g9iu8x", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.96, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 440, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": True, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "Discussion", - "can_mod_post": False, - "score": 440, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1588088407, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "i.redd.it", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://i.redd.it/ulc23n21jiv41.png", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "93811e06-0da7-11e8-a9a2-0e1129ea8e52", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qi8m", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "g9iu8x", - "is_robot_indexable": True, - "report_reasons": None, - "author": "MartialArtTetherball", - "discussion_type": None, - "num_comments": 65, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/ProgrammingLanguages/comments/g9iu8x/concept_art_what_might_python_look_like_in/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://i.redd.it/ulc23n21jiv41.png", - "subreddit_subscribers": 43859, - "created_utc": 1588059607, - "num_crossposts": 2, - "media": None, - "is_video": False, - } - ], - "created": 1594492194, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "i.redd.it", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://i.redd.it/ulc23n21jiv41.png", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "0df42996-1c5e-11ea-b1a0-0e44e1c5b731", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh0y", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hp7uqe", - "is_robot_indexable": True, - "report_reasons": None, - "author": "SubstantialRange", - "discussion_type": None, - "num_comments": 182, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "crosspost_parent": "t3_g9iu8x", - "author_flair_text_color": None, - "permalink": "/r/Python/comments/hp7uqe/concept_art_what_might_python_look_like_in/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://i.redd.it/ulc23n21jiv41.png", - "subreddit_subscribers": 616297, - "created_utc": 1594463394, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - ], - "after": "t3_hozdzo", - "before": None, - }, -} - -empty_mock = { - "kind": "Listing", - "data": { - "modhash": "y4he8gfzh9f892e2bf3094bc06daba2e02288e617fecf555b5", - "dist": 27, - "children": [], - "after": "t3_hozdzo", - "before": None, - }, -} diff --git a/src/newsreader/news/collection/tests/reddit/collector/tests.py b/src/newsreader/news/collection/tests/reddit/collector/tests.py deleted file mode 100644 index c65020d..0000000 --- a/src/newsreader/news/collection/tests/reddit/collector/tests.py +++ /dev/null @@ -1,201 +0,0 @@ -from datetime import datetime, timezone -from unittest.mock import patch -from uuid import uuid4 - -from django.test import TestCase - -from newsreader.news.collection.choices import RuleTypeChoices -from newsreader.news.collection.exceptions import ( - StreamDeniedException, - StreamForbiddenException, - StreamNotFoundException, - StreamTimeOutException, -) -from newsreader.news.collection.reddit import RedditCollector -from newsreader.news.collection.tests.factories import SubredditFactory -from newsreader.news.collection.tests.reddit.collector.mocks import ( - empty_mock, - simple_mock_1, - simple_mock_2, -) -from newsreader.news.core.models import Post - - -class RedditCollectorTestCase(TestCase): - def setUp(self): - self.maxDiff = None - - self.patched_get = patch("newsreader.news.collection.reddit.fetch") - self.mocked_fetch = self.patched_get.start() - - self.patched_parse = patch( - "newsreader.news.collection.reddit.RedditStream.parse" - ) - self.mocked_parse = self.patched_parse.start() - - def tearDown(self): - patch.stopall() - - def test_simple_batch(self): - self.mocked_parse.side_effect = (simple_mock_1, simple_mock_2) - - rules = ( - (subreddit,) - for subreddit in SubredditFactory.create_batch( - user__reddit_access_token=str(uuid4()), - user__reddit_refresh_token=str(uuid4()), - enabled=True, - size=2, - ) - ) - - collector = RedditCollector() - collector.collect(rules=rules) - - self.assertCountEqual( - Post.objects.values_list("remote_identifier", flat=True), - ( - "hm6byg", - "hpkhgj", - "hph00n", - "hp9mlw", - "hpjn8x", - "gdfaip", - "hmd2ez", - "hpr28u", - "hpps6f", - "hp7uqe", - ), - ) - - for subreddit in rules: - with self.subTest(subreddit=subreddit): - self.assertEqual(subreddit.succeeded, True) - self.assertEqual(subreddit.last_run, datetime.now(tz=timezone.utc)) - self.assertEqual(subreddit.error, None) - - post = Post.objects.get( - remote_identifier="hph00n", rule__type=RuleTypeChoices.subreddit - ) - - self.assertEqual( - post.publication_date, - datetime(2020, 7, 11, 22, 23, 24, tzinfo=timezone.utc), - ) - - self.assertEqual(post.author, "HannahB888") - self.assertEqual(post.title, "Drake Interplanetary Smartkey thing that I made!") - self.assertEqual( - post.url, - "https://www.reddit.com/r/starcitizen/comments/hph00n/drake_interplanetary_smartkey_thing_that_i_made/", - ) - - post = Post.objects.get( - remote_identifier="hpr28u", rule__type=RuleTypeChoices.subreddit - ) - - self.assertEqual( - post.publication_date, - datetime(2020, 7, 12, 10, 29, 10, tzinfo=timezone.utc), - ) - - self.assertEqual(post.author, "Sebaron") - self.assertEqual( - post.title, - "I am a medical student, and I recently programmed an open-source eye-tracker for brain research", - ) - self.assertEqual( - post.url, - "https://www.reddit.com/r/Python/comments/hpr28u/i_am_a_medical_student_and_i_recently_programmed/", - ) - - def test_empty_batch(self): - self.mocked_parse.side_effect = (empty_mock, empty_mock) - - rules = ( - (subreddit,) - for subreddit in SubredditFactory.create_batch( - user__reddit_access_token=str(uuid4()), - user__reddit_refresh_token=str(uuid4()), - enabled=True, - size=2, - ) - ) - - collector = RedditCollector() - collector.collect(rules=rules) - - self.assertEqual(Post.objects.count(), 0) - - for subreddit in rules: - with self.subTest(subreddit=subreddit): - self.assertEqual(subreddit.succeeded, True) - self.assertEqual(subreddit.last_run, datetime.now(tz=timezone.utc)) - self.assertEqual(subreddit.error, None) - - def test_not_found(self): - self.mocked_fetch.side_effect = StreamNotFoundException - - rule = SubredditFactory( - user__reddit_access_token=str(uuid4()), - user__reddit_refresh_token=str(uuid4()), - enabled=True, - ) - - collector = RedditCollector() - collector.collect(rules=((rule,),)) - - self.assertEqual(Post.objects.count(), 0) - self.assertEqual(rule.succeeded, False) - self.assertEqual(rule.error, "Stream not found") - - @patch("newsreader.news.collection.reddit.RedditTokenTask") - def test_denied(self, mocked_task): - self.mocked_fetch.side_effect = StreamDeniedException - - rule = SubredditFactory( - user__reddit_access_token=str(uuid4()), - user__reddit_refresh_token=str(uuid4()), - enabled=True, - ) - - collector = RedditCollector() - collector.collect(rules=((rule,),)) - - self.assertEqual(Post.objects.count(), 0) - self.assertEqual(rule.succeeded, False) - self.assertEqual(rule.error, "Stream does not have sufficient permissions") - - mocked_task.delay.assert_called_once_with(rule.user.pk) - - def test_forbidden(self): - self.mocked_fetch.side_effect = StreamForbiddenException - - rule = SubredditFactory( - user__reddit_access_token=str(uuid4()), - user__reddit_refresh_token=str(uuid4()), - enabled=True, - ) - - collector = RedditCollector() - collector.collect(rules=((rule,),)) - - self.assertEqual(Post.objects.count(), 0) - self.assertEqual(rule.succeeded, False) - self.assertEqual(rule.error, "Stream forbidden") - - def test_timed_out(self): - self.mocked_fetch.side_effect = StreamTimeOutException - - rule = SubredditFactory( - user__reddit_access_token=str(uuid4()), - user__reddit_refresh_token=str(uuid4()), - enabled=True, - ) - - collector = RedditCollector() - collector.collect(rules=((rule,),)) - - self.assertEqual(Post.objects.count(), 0) - self.assertEqual(rule.succeeded, False) - self.assertEqual(rule.error, "Stream timed out") diff --git a/src/newsreader/news/collection/tests/reddit/stream/__init__.py b/src/newsreader/news/collection/tests/reddit/stream/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/newsreader/news/collection/tests/reddit/stream/mocks.py b/src/newsreader/news/collection/tests/reddit/stream/mocks.py deleted file mode 100644 index 148b31a..0000000 --- a/src/newsreader/news/collection/tests/reddit/stream/mocks.py +++ /dev/null @@ -1,3289 +0,0 @@ -simple_mock = { - "kind": "Listing", - "data": { - "modhash": "sgq4fdizx94db5c05b57f9957a4b8b2d5e24b712f5a507cffd", - "dist": 27, - "children": [ - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "Welcome to r/linux rants and experiences! This megathread is also to hear opinions from anyone just starting out with Linux or those that have used Linux (GNU or otherwise) for a long time.\n\nLet us know what's annoying you, whats making you happy, or something that you want to get out to r/linux but didn't make the cut into a full post of it's own.\n\nFor those looking for certifications please use this megathread to ask about how to get certified whether it's for the business world or for your own satisfaction. Be sure to check out r/linuxadmin for more discussion in the SysAdmin world!\n\n_Please keep questions in r/linuxquestions, r/linux4noobs, or the Wednesday automod thread._", - "author_fullname": "t2_6l4z3", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Linux Experiences/Rants or Education/Certifications thread - July 06, 2020", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hm0qct", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.65, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 6, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 6, - "approved_by": None, - "author_premium": True, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594037482.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.linux", - "allow_live_comments": False, - "selftext_html": '<!-- SC_OFF --><div class="md"><p>Welcome to <a href="/r/linux">r/linux</a> rants and experiences! This megathread is also to hear opinions from anyone just starting out with Linux or those that have used Linux (GNU or otherwise) for a long time.</p>\n\n<p>Let us know what&#39;s annoying you, whats making you happy, or something that you want to get out to <a href="/r/linux">r/linux</a> but didn&#39;t make the cut into a full post of it&#39;s own.</p>\n\n<p>For those looking for certifications please use this megathread to ask about how to get certified whether it&#39;s for the business world or for your own satisfaction. Be sure to check out <a href="/r/linuxadmin">r/linuxadmin</a> for more discussion in the SysAdmin world!</p>\n\n<p><em>Please keep questions in <a href="/r/linuxquestions">r/linuxquestions</a>, <a href="/r/linux4noobs">r/linux4noobs</a>, or the Wednesday automod thread.</em></p>\n</div><!-- SC_ON -->', - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": True, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": "moderator", - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hm0qct", - "is_robot_indexable": True, - "report_reasons": None, - "author": "AutoModerator", - "discussion_type": None, - "num_comments": 8, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hm0qct/linux_experiencesrants_or_educationcertifications/", - "parent_whitelist_status": "all_ads", - "stickied": True, - "url": "https://www.reddit.com/r/linux/comments/hm0qct/linux_experiencesrants_or_educationcertifications/", - "subreddit_subscribers": 543995, - "created_utc": 1594008682.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "Welcome to r/linux! If you're new to Linux or trying to get started this thread is for you. Get help here or as always, check out r/linuxquestions or r/linux4noobs\n\nThis megathread is for all your question needs. As we don't allow questions on r/linux outside of this megathread, please consider using r/linuxquestions or r/linux4noobs for the best solution to your problem.\n\nAsk your hardware requests here too or try r/linuxhardware!", - "author_fullname": "t2_6l4z3", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Weekly Questions and Hardware Thread - July 08, 2020", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hna75r", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.5, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 0, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 0, - "approved_by": None, - "author_premium": True, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594210138.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.linux", - "allow_live_comments": False, - "selftext_html": '<!-- SC_OFF --><div class="md"><p>Welcome to <a href="/r/linux">r/linux</a>! If you&#39;re new to Linux or trying to get started this thread is for you. Get help here or as always, check out <a href="/r/linuxquestions">r/linuxquestions</a> or <a href="/r/linux4noobs">r/linux4noobs</a></p>\n\n<p>This megathread is for all your question needs. As we don&#39;t allow questions on <a href="/r/linux">r/linux</a> outside of this megathread, please consider using <a href="/r/linuxquestions">r/linuxquestions</a> or <a href="/r/linux4noobs">r/linux4noobs</a> for the best solution to your problem.</p>\n\n<p>Ask your hardware requests here too or try <a href="/r/linuxhardware">r/linuxhardware</a>!</p>\n</div><!-- SC_ON -->', - "likes": None, - "suggested_sort": "new", - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": True, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": "moderator", - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hna75r", - "is_robot_indexable": True, - "report_reasons": None, - "author": "AutoModerator", - "discussion_type": None, - "num_comments": 2, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hna75r/weekly_questions_and_hardware_thread_july_08_2020/", - "parent_whitelist_status": "all_ads", - "stickied": True, - "url": "https://www.reddit.com/r/linux/comments/hna75r/weekly_questions_and_hardware_thread_july_08_2020/", - "subreddit_subscribers": 543995, - "created_utc": 1594181338.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "", - "author_fullname": "t2_gr7k5", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Here's a feature Linux could borrow from BSD: in-kernel debugger with built-in hangman game", - "link_flair_richtext": [{"e": "text", "t": "Fluff"}], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "", - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hngs71", - "quarantine": False, - "link_flair_text_color": "light", - "upvote_ratio": 0.9, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 135, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": True, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "Fluff", - "can_mod_post": False, - "score": 135, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594242629.0, - "link_flair_type": "richtext", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "i.redd.it", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://i.redd.it/wmc8tp2ium951.jpg", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "af8918be-6777-11e7-8273-0e925d908786", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "#9a2bff", - "id": "hngs71", - "is_robot_indexable": True, - "report_reasons": None, - "author": "the_humeister", - "discussion_type": None, - "num_comments": 20, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hngs71/heres_a_feature_linux_could_borrow_from_bsd/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://i.redd.it/wmc8tp2ium951.jpg", - "subreddit_subscribers": 543995, - "created_utc": 1594213829.0, - "num_crossposts": 1, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "", - "author_fullname": "t2_k9f35", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "KeePassXC 2.6.0 released", - "link_flair_richtext": [{"e": "text", "t": "Software Release"}], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "", - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hngsj8", - "quarantine": False, - "link_flair_text_color": "light", - "upvote_ratio": 0.97, - "author_flair_background_color": "transparent", - "subreddit_type": "public", - "ups": 126, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": "fa602e36-cdf6-11e8-93c9-0e41ac35f4cc", - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "Software Release", - "can_mod_post": False, - "score": 126, - "approved_by": None, - "author_premium": True, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [ - { - "a": ":ubuntu:", - "e": "emoji", - "u": "https://emoji.redditmedia.com/uwmddx7qqpr11_t5_2qh1a/ubuntu", - } - ], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594242666.0, - "link_flair_type": "richtext", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "richtext", - "domain": "keepassxc.org", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://keepassxc.org/blog/2020-07-07-2.6.0-released/", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "904ea3e4-6748-11e7-b925-0ef3dfbb807a", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": ":ubuntu:", - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "#349e48", - "id": "hngsj8", - "is_robot_indexable": True, - "report_reasons": None, - "author": "nixcraft", - "discussion_type": None, - "num_comments": 42, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": "dark", - "permalink": "/r/linux/comments/hngsj8/keepassxc_260_released/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://keepassxc.org/blog/2020-07-07-2.6.0-released/", - "subreddit_subscribers": 543995, - "created_utc": 1594213866.0, - "num_crossposts": 1, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "", - "author_fullname": "t2_hlv0o", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": 'Board statement on the LibreOffice 7.0 RC "Personal Edition" label', - "link_flair_richtext": [{"e": "text", "t": "Popular Application"}], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hnd7cy", - "quarantine": False, - "link_flair_text_color": "light", - "upvote_ratio": 0.95, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 223, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "Popular Application", - "can_mod_post": False, - "score": 223, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "crosspost_parent_list": [ - { - "approved_at_utc": None, - "subreddit": "libreoffice", - "selftext": "", - "author_fullname": "t2_hlv0o", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": 'Board statement on the LibreOffice 7.0 RC "Personal Edition" label', - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/libreoffice", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "", - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hnd6yo", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.94, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 28, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "News", - "can_mod_post": False, - "score": 28, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594224961.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "blog.documentfoundation.org", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://blog.documentfoundation.org/blog/2020/07/06/board-statement-on-the-libreoffice-7-0rc-personal-edition-label/", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "dc82ac98-bafb-11e4-9f88-22000b310327", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2s4nt", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hnd6yo", - "is_robot_indexable": True, - "report_reasons": None, - "author": "TheQuantumZero", - "discussion_type": None, - "num_comments": 38, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/libreoffice/comments/hnd6yo/board_statement_on_the_libreoffice_70_rc_personal/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://blog.documentfoundation.org/blog/2020/07/06/board-statement-on-the-libreoffice-7-0rc-personal-edition-label/", - "subreddit_subscribers": 4669, - "created_utc": 1594196161.0, - "num_crossposts": 2, - "media": None, - "is_video": False, - } - ], - "created": 1594225018.0, - "link_flair_type": "richtext", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "blog.documentfoundation.org", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://blog.documentfoundation.org/blog/2020/07/06/board-statement-on-the-libreoffice-7-0rc-personal-edition-label/", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "7127ec98-5859-11e8-9488-0e8717893ec8", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "#0aa18f", - "id": "hnd7cy", - "is_robot_indexable": True, - "report_reasons": None, - "author": "TheQuantumZero", - "discussion_type": None, - "num_comments": 109, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "crosspost_parent": "t3_hnd6yo", - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hnd7cy/board_statement_on_the_libreoffice_70_rc_personal/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://blog.documentfoundation.org/blog/2020/07/06/board-statement-on-the-libreoffice-7-0rc-personal-edition-label/", - "subreddit_subscribers": 543995, - "created_utc": 1594196218.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "", - "author_fullname": "t2_6cxnzaq2", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Gentoo Now on Android Platform !!!", - "link_flair_richtext": [{"e": "text", "t": "Mobile Linux"}], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "", - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hnemei", - "quarantine": False, - "link_flair_text_color": "light", - "upvote_ratio": 0.87, - "author_flair_background_color": "transparent", - "subreddit_type": "public", - "ups": 78, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": "a54a7460-cdf6-11e8-b31c-0e89679a2148", - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "Mobile Linux", - "can_mod_post": False, - "score": 78, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [ - { - "a": ":arch:", - "e": "emoji", - "u": "https://emoji.redditmedia.com/tip79drnqpr11_t5_2qh1a/arch", - } - ], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594232773.0, - "link_flair_type": "richtext", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "richtext", - "domain": "gentoo.org", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://www.gentoo.org/news/2020/07/07/gentoo-android.html", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "84162644-5859-11e8-b9ed-0efda312d094", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": ":arch:", - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "#d78216", - "id": "hnemei", - "is_robot_indexable": True, - "report_reasons": None, - "author": "draplon", - "discussion_type": None, - "num_comments": 21, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": "dark", - "permalink": "/r/linux/comments/hnemei/gentoo_now_on_android_platform/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://www.gentoo.org/news/2020/07/07/gentoo-android.html", - "subreddit_subscribers": 543995, - "created_utc": 1594203973.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "", - "author_fullname": "t2_f9vxe", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Google is teaming up with Ubuntu to bring Flutter apps to Linux", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hniojf", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.77, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 31, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 31, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594249580.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "androidpolice.com", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://www.androidpolice.com/2020/07/08/google-is-teaming-up-with-ubuntu-to-bring-flutter-apps-to-linux/", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hniojf", - "is_robot_indexable": True, - "report_reasons": None, - "author": "bilal4hmed", - "discussion_type": None, - "num_comments": 24, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hniojf/google_is_teaming_up_with_ubuntu_to_bring_flutter/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://www.androidpolice.com/2020/07/08/google-is-teaming-up-with-ubuntu-to-bring-flutter-apps-to-linux/", - "subreddit_subscribers": 543995, - "created_utc": 1594220780.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "", - "author_fullname": "t2_k9f35", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Ariane RISC-V CPU \u2013 An open source CPU capable of booting Linux", - "link_flair_richtext": [{"e": "text", "t": "Hardware"}], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "", - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hngr1j", - "quarantine": False, - "link_flair_text_color": "light", - "upvote_ratio": 0.89, - "author_flair_background_color": "transparent", - "subreddit_type": "public", - "ups": 49, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": "fa602e36-cdf6-11e8-93c9-0e41ac35f4cc", - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "Hardware", - "can_mod_post": False, - "score": 49, - "approved_by": None, - "author_premium": True, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [ - { - "a": ":ubuntu:", - "e": "emoji", - "u": "https://emoji.redditmedia.com/uwmddx7qqpr11_t5_2qh1a/ubuntu", - } - ], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594242511.0, - "link_flair_type": "richtext", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "richtext", - "domain": "github.com", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://github.com/openhwgroup/cva6", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "3d48793a-c823-11e8-9a58-0ee3c97eb952", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": ":ubuntu:", - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "#cc5289", - "id": "hngr1j", - "is_robot_indexable": True, - "report_reasons": None, - "author": "nixcraft", - "discussion_type": None, - "num_comments": 15, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": "dark", - "permalink": "/r/linux/comments/hngr1j/ariane_riscv_cpu_an_open_source_cpu_capable_of/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://github.com/openhwgroup/cva6", - "subreddit_subscribers": 543995, - "created_utc": 1594213711.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "", - "author_fullname": "t2_6kt9ukjs", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Canonical enables Linux desktop app support with Flutter", - "link_flair_richtext": [{"e": "text", "t": "Software Release"}], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "", - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hnj1ap", - "quarantine": False, - "link_flair_text_color": "light", - "upvote_ratio": 0.79, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 24, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "Software Release", - "can_mod_post": False, - "score": 24, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594250752.0, - "link_flair_type": "richtext", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "ubuntu.com", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://ubuntu.com/blog/canonical-enables-linux-desktop-app-support-with-flutter", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "904ea3e4-6748-11e7-b925-0ef3dfbb807a", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "#349e48", - "id": "hnj1ap", - "is_robot_indexable": True, - "report_reasons": None, - "author": "hmblhstl", - "discussion_type": None, - "num_comments": 28, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hnj1ap/canonical_enables_linux_desktop_app_support_with/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://ubuntu.com/blog/canonical-enables-linux-desktop-app-support-with-flutter", - "subreddit_subscribers": 543995, - "created_utc": 1594221952.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "", - "author_fullname": "t2_3vf8x", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Sandboxing in Linux with zero lines of code", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hnfzbm", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.83, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 30, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 30, - "approved_by": None, - "author_premium": True, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594239285.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "blog.cloudflare.com", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://blog.cloudflare.com/sandboxing-in-linux-with-zero-lines-of-code/", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hnfzbm", - "is_robot_indexable": True, - "report_reasons": None, - "author": "pimterry", - "discussion_type": None, - "num_comments": 0, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hnfzbm/sandboxing_in_linux_with_zero_lines_of_code/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://blog.cloudflare.com/sandboxing-in-linux-with-zero-lines-of-code/", - "subreddit_subscribers": 543995, - "created_utc": 1594210485.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "", - "author_fullname": "t2_318in", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "SUSE Enters Into Definitive Agreement to Acquire Rancher Labs", - "link_flair_richtext": [ - {"e": "text", "t": "Open Source Organization"} - ], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "", - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hnh5ux", - "quarantine": False, - "link_flair_text_color": "light", - "upvote_ratio": 0.84, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 26, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "Open Source Organization", - "can_mod_post": False, - "score": 26, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594244123.0, - "link_flair_type": "richtext", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "rancher.com", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://rancher.com/blog/2020/suse-to-acquire-rancher/", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "8a1dd4b0-5859-11e8-a2c7-0e5ebdbe24d6", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "#800000", - "id": "hnh5ux", - "is_robot_indexable": True, - "report_reasons": None, - "author": "hjames9", - "discussion_type": None, - "num_comments": 5, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hnh5ux/suse_enters_into_definitive_agreement_to_acquire/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://rancher.com/blog/2020/suse-to-acquire-rancher/", - "subreddit_subscribers": 543995, - "created_utc": 1594215323.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "", - "author_fullname": "t2_j1a5", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Linux Mint drops Ubuntu Snap packages [LWN.net]", - "link_flair_richtext": [{"e": "text", "t": "Distro News"}], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "", - "downs": 0, - "top_awarded_type": None, - "hide_score": True, - "name": "t3_hnlt4l", - "quarantine": False, - "link_flair_text_color": "light", - "upvote_ratio": 0.8, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 9, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "Distro News", - "can_mod_post": False, - "score": 9, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594259641.0, - "link_flair_type": "richtext", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "lwn.net", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://lwn.net/SubscriberLink/825005/6440c82feb745bbe/", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "6888e772-5859-11e8-82ff-0e816ab71260", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "#0dd3bb", - "id": "hnlt4l", - "is_robot_indexable": True, - "report_reasons": None, - "author": "tapo", - "discussion_type": None, - "num_comments": 3, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hnlt4l/linux_mint_drops_ubuntu_snap_packages_lwnnet/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://lwn.net/SubscriberLink/825005/6440c82feb745bbe/", - "subreddit_subscribers": 543995, - "created_utc": 1594230841.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "", - "author_fullname": "t2_4i3yk", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Announcing Flutter Linux Alpha with Canonical", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hniq04", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.6, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 6, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 6, - "approved_by": None, - "author_premium": True, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594249712.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "medium.com", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://medium.com/flutter/announcing-flutter-linux-alpha-with-canonical-19eb824590a9", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hniq04", - "is_robot_indexable": True, - "report_reasons": None, - "author": "popeydc", - "discussion_type": None, - "num_comments": 3, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hniq04/announcing_flutter_linux_alpha_with_canonical/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://medium.com/flutter/announcing-flutter-linux-alpha-with-canonical-19eb824590a9", - "subreddit_subscribers": 543995, - "created_utc": 1594220912.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "", - "author_fullname": "t2_611c0ard", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "New anti-encryption bill worse than EARN IT, would force a backdoor into any US device/software. Act now to stop both.", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hmp66i", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.98, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 3340, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 3340, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594131589.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "tutanota.com", - "allow_live_comments": True, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://tutanota.com/blog/posts/lawful-access-encrypted-data-act-backdoor", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hmp66i", - "is_robot_indexable": True, - "report_reasons": None, - "author": "fossfans", - "discussion_type": None, - "num_comments": 380, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hmp66i/new_antiencryption_bill_worse_than_earn_it_would/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://tutanota.com/blog/posts/lawful-access-encrypted-data-act-backdoor", - "subreddit_subscribers": 543995, - "created_utc": 1594102789.0, - "num_crossposts": 2, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "We have had Freesync \"support\" for quite some time now, but it is extremely restrictive and very picky to get it working. Just the requirements to have Freesync working is no-go for many:\n\n\\-> Single monitor only;\n\n\\-> No video playback or turning it on while on desktop;\n\n\\-> Should only be turned on only while the game/software in question is in fullscreen;\n\n\\-> X11, no Wayland;\n\n\\-> Only tested/working distro is Ubuntu 16.04.3;\n\n\\-> Need of setting it up through some quite cryptic commands;\n\n\\-> Doesn't work after hotplug or system restart;\n\n\\-> No Freesync over HDMI (which isn't a massive problem, but a nice option to have);\n\n\\-> Apparently only OpenGL, no Vulkan (Steam Play/Proton, which is the main purpose for Freesync at the moment, doesn't work);\n\n&#x200B;\n\nI am not really complaining, because I do know that Freesync is hard to get working on Linux, but we have had so many advancements on the gaming side of Linux, and we are still stuck with all of these restrictions to use Freesync, which is quite a useful functionality for almost every gamer. If Mozilla got video decoding working well on Wayland, I hope (Idk anything about this, just hoping) that it could also be easy to implement Freesync on Wayland too.\n\nWe just haven't had that many improvements on this side of the Linux gaming world, and I'd like to know if it is lack of support/interest by AMD, or if it actually is extremely hard to implement it on Linux. Freesync would also be very useful for those who are running monitors over 60Hz, so that those 60FPS videos don't look as weird as they do while playing back on higher refresh rate monitors. It is just a nice thing for everybody, really!", - "author_fullname": "t2_1afv9v8g", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Any evolution on the Freesync situation on Linux?", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hn7agp", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.85, - "author_flair_background_color": "transparent", - "subreddit_type": "public", - "ups": 83, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": "fa602e36-cdf6-11e8-93c9-0e41ac35f4cc", - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 83, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [ - { - "a": ":ubuntu:", - "e": "emoji", - "u": "https://emoji.redditmedia.com/uwmddx7qqpr11_t5_2qh1a/ubuntu", - } - ], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594199056.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "richtext", - "domain": "self.linux", - "allow_live_comments": False, - "selftext_html": '<!-- SC_OFF --><div class="md"><p>We have had Freesync &quot;support&quot; for quite some time now, but it is extremely restrictive and very picky to get it working. Just the requirements to have Freesync working is no-go for many:</p>\n\n<p>-&gt; Single monitor only;</p>\n\n<p>-&gt; No video playback or turning it on while on desktop;</p>\n\n<p>-&gt; Should only be turned on only while the game/software in question is in fullscreen;</p>\n\n<p>-&gt; X11, no Wayland;</p>\n\n<p>-&gt; Only tested/working distro is Ubuntu 16.04.3;</p>\n\n<p>-&gt; Need of setting it up through some quite cryptic commands;</p>\n\n<p>-&gt; Doesn&#39;t work after hotplug or system restart;</p>\n\n<p>-&gt; No Freesync over HDMI (which isn&#39;t a massive problem, but a nice option to have);</p>\n\n<p>-&gt; Apparently only OpenGL, no Vulkan (Steam Play/Proton, which is the main purpose for Freesync at the moment, doesn&#39;t work);</p>\n\n<p>&#x200B;</p>\n\n<p>I am not really complaining, because I do know that Freesync is hard to get working on Linux, but we have had so many advancements on the gaming side of Linux, and we are still stuck with all of these restrictions to use Freesync, which is quite a useful functionality for almost every gamer. If Mozilla got video decoding working well on Wayland, I hope (Idk anything about this, just hoping) that it could also be easy to implement Freesync on Wayland too.</p>\n\n<p>We just haven&#39;t had that many improvements on this side of the Linux gaming world, and I&#39;d like to know if it is lack of support/interest by AMD, or if it actually is extremely hard to implement it on Linux. Freesync would also be very useful for those who are running monitors over 60Hz, so that those 60FPS videos don&#39;t look as weird as they do while playing back on higher refresh rate monitors. It is just a nice thing for everybody, really!</p>\n</div><!-- SC_ON -->', - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": ":ubuntu:", - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hn7agp", - "is_robot_indexable": True, - "report_reasons": None, - "author": "mreich98", - "discussion_type": None, - "num_comments": 36, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": "dark", - "permalink": "/r/linux/comments/hn7agp/any_evolution_on_the_freesync_situation_on_linux/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://www.reddit.com/r/linux/comments/hn7agp/any_evolution_on_the_freesync_situation_on_linux/", - "subreddit_subscribers": 543995, - "created_utc": 1594170256.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "", - "author_fullname": "t2_7ccf", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Running Rosetta@home on a Raspberry Pi with Fedora IoT", - "link_flair_richtext": [{"e": "text", "t": "Popular Application"}], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "", - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hnfw0h", - "quarantine": False, - "link_flair_text_color": "light", - "upvote_ratio": 0.73, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 8, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "Popular Application", - "can_mod_post": False, - "score": 8, - "approved_by": None, - "author_premium": True, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594238884.0, - "link_flair_type": "richtext", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "fedoramagazine.org", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://fedoramagazine.org/running-rosettahome-on-a-raspberry-pi-with-fedora-iot/", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "7127ec98-5859-11e8-9488-0e8717893ec8", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "#0aa18f", - "id": "hnfw0h", - "is_robot_indexable": True, - "report_reasons": None, - "author": "speckz", - "discussion_type": None, - "num_comments": 1, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hnfw0h/running_rosettahome_on_a_raspberry_pi_with_fedora/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://fedoramagazine.org/running-rosettahome-on-a-raspberry-pi-with-fedora-iot/", - "subreddit_subscribers": 543995, - "created_utc": 1594210084.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "", - "author_fullname": "t2_sx11s", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Getting Things GNOME 0.4 released! First release in almost 7 years (Flatpak available).", - "link_flair_richtext": [{"e": "text", "t": "Software Release"}], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hn5wh6", - "quarantine": False, - "link_flair_text_color": "light", - "upvote_ratio": 0.79, - "author_flair_background_color": "transparent", - "subreddit_type": "public", - "ups": 58, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": "2194c338-ce1d-11e8-8ed7-0e20bb1bbc52", - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "Software Release", - "can_mod_post": False, - "score": 58, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [ - { - "a": ":nix:", - "e": "emoji", - "u": "https://emoji.redditmedia.com/ww1ubcjpqpr11_t5_2qh1a/nix", - } - ], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594193982.0, - "link_flair_type": "richtext", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "richtext", - "domain": "flathub.org", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://flathub.org/apps/details/org.gnome.GTG", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "904ea3e4-6748-11e7-b925-0ef3dfbb807a", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": ":nix:", - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "#349e48", - "id": "hn5wh6", - "is_robot_indexable": True, - "report_reasons": None, - "author": "Kanarme", - "discussion_type": None, - "num_comments": 22, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": "dark", - "permalink": "/r/linux/comments/hn5wh6/getting_things_gnome_04_released_first_release_in/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://flathub.org/apps/details/org.gnome.GTG", - "subreddit_subscribers": 543995, - "created_utc": 1594165182.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "", - "author_fullname": "t2_636xx258", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "mpv is not anymore supporting gnome. and the owner reverted the commit again shortly after and then again made a new one, to add the changes", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": True, - "name": "t3_hnnt0v", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 1.0, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 1, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 1, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "crosspost_parent_list": [ - { - "approved_at_utc": None, - "subreddit": "gnome", - "selftext": "", - "author_fullname": "t2_33wgs4m3", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "mpv is not anymore supporting gnome. and the owner reverted the commit again shortly after and then again made a new one, to add the changes", - "link_flair_richtext": [{"e": "text", "t": "News"}], - "subreddit_name_prefixed": "r/gnome", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "", - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hn1s3r", - "quarantine": False, - "link_flair_text_color": "light", - "upvote_ratio": 0.81, - "author_flair_background_color": "transparent", - "subreddit_type": "public", - "ups": 23, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": "1515012e-bed8-11ea-92a7-0eb4e155a177", - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "News", - "can_mod_post": False, - "score": 23, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": "gnome-user", - "author_flair_richtext": [{"e": "text", "t": "GNOMie"}], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594180508.0, - "link_flair_type": "richtext", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "richtext", - "domain": "github.com", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": "confidence", - "banned_at_utc": None, - "url_overridden_by_dest": "https://github.com/mpv-player/mpv/commit/cdaa496314f90412963f2b3211e18df72910066d#commitcomment-40434556", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "7dbe0c80-f9df-11e8-b35e-0e2ae22a2534", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": "GNOMie", - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qjhn", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "#692c52", - "id": "hn1s3r", - "is_robot_indexable": True, - "report_reasons": None, - "author": "idiot10000000", - "discussion_type": None, - "num_comments": 53, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": "dark", - "permalink": "/r/gnome/comments/hn1s3r/mpv_is_not_anymore_supporting_gnome_and_the_owner/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://github.com/mpv-player/mpv/commit/cdaa496314f90412963f2b3211e18df72910066d#commitcomment-40434556", - "subreddit_subscribers": 41350, - "created_utc": 1594151708.0, - "num_crossposts": 1, - "media": None, - "is_video": False, - } - ], - "created": 1594265700.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "github.com", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://github.com/mpv-player/mpv/commit/cdaa496314f90412963f2b3211e18df72910066d#commitcomment-40434556", - "view_count": None, - "archived": False, - "no_follow": True, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hnnt0v", - "is_robot_indexable": True, - "report_reasons": None, - "author": "RetartedTortoise", - "discussion_type": None, - "num_comments": 0, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "crosspost_parent": "t3_hn1s3r", - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hnnt0v/mpv_is_not_anymore_supporting_gnome_and_the_owner/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://github.com/mpv-player/mpv/commit/cdaa496314f90412963f2b3211e18df72910066d#commitcomment-40434556", - "subreddit_subscribers": 543995, - "created_utc": 1594236900.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "", - "author_fullname": "t2_21omsw7y", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Google and Canonical bring Linux apps support to Flutter - 9to5Google", - "link_flair_richtext": [{"e": "text", "t": "Development"}], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "", - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hnj42j", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.59, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 3, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "Development", - "can_mod_post": False, - "score": 3, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594251002.0, - "link_flair_type": "richtext", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "9to5google.com", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://9to5google.com/2020/07/08/google-canonical-partnership-linux-flutter-apps/", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "3cb511e2-7914-11ea-bb33-0ee30ee9d22b", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "#f0db8a", - "id": "hnj42j", - "is_robot_indexable": True, - "report_reasons": None, - "author": "satvikpendem", - "discussion_type": None, - "num_comments": 1, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hnj42j/google_and_canonical_bring_linux_apps_support_to/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://9to5google.com/2020/07/08/google-canonical-partnership-linux-flutter-apps/", - "subreddit_subscribers": 543995, - "created_utc": 1594222202.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": " As far as I understand it, the current options on the Intel Iris/NVIDIA side are:\n\n* Intel or NVIDIA cards only\n\n* Optimus for switching between Intel and Intel+NVIDIA (requires reboot)\n\n* Bumblebee for on-the-fly switching with a performance hit\n\n* nvidia-xrun, which does everything bumblebee can do but requires a second X server\n\n* Prime Rener Offload, a proprietary NVIDIA thing, for switching between Intel and Intel+NVIDIA, which I don't completely understand\n\nDo I have this right? And how do things look on the Amd Vega/Radeon configuration?", - "author_fullname": "t2_tcnt4", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "[Discussion] What's the current status on laptop switchable graphics?", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": True, - "name": "t3_hnmiik", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.67, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 1, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 1, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594261813.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.linux", - "allow_live_comments": False, - "selftext_html": '<!-- SC_OFF --><div class="md"><p>As far as I understand it, the current options on the Intel Iris/NVIDIA side are:</p>\n\n<ul>\n<li><p>Intel or NVIDIA cards only</p></li>\n<li><p>Optimus for switching between Intel and Intel+NVIDIA (requires reboot)</p></li>\n<li><p>Bumblebee for on-the-fly switching with a performance hit</p></li>\n<li><p>nvidia-xrun, which does everything bumblebee can do but requires a second X server</p></li>\n<li><p>Prime Rener Offload, a proprietary NVIDIA thing, for switching between Intel and Intel+NVIDIA, which I don&#39;t completely understand</p></li>\n</ul>\n\n<p>Do I have this right? And how do things look on the Amd Vega/Radeon configuration?</p>\n</div><!-- SC_ON -->', - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": True, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hnmiik", - "is_robot_indexable": True, - "report_reasons": None, - "author": "KoolDude214", - "discussion_type": None, - "num_comments": 4, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hnmiik/discussion_whats_the_current_status_on_laptop/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://www.reddit.com/r/linux/comments/hnmiik/discussion_whats_the_current_status_on_laptop/", - "subreddit_subscribers": 543995, - "created_utc": 1594233013.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "Hello all!\n\nI've created this simple web app as a part of learning web development, to help people select a linux distro for themselves.\n\nIt's a really simple web app, as I've created it as part of learning web development.\n\nIt retrieves data from another API that I've defined and this very API's database is used to store all the releated information that only right now I can store.\n\nAnd this web app is used to get information from that API and display it in an organized way.\n\nHave a look and please let me know about your thoughts and suggestions:\n\nLink: [https://linux-distros-encyclopedia.herokuapp.com/](https://linux-distros-encyclopedia.herokuapp.com/)", - "author_fullname": "t2_4c9tcvx3", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Linux Distributions Encyclopedia Web App", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hnlh54", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.5, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 0, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 0, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594258586.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.linux", - "allow_live_comments": False, - "selftext_html": '<!-- SC_OFF --><div class="md"><p>Hello all!</p>\n\n<p>I&#39;ve created this simple web app as a part of learning web development, to help people select a linux distro for themselves.</p>\n\n<p>It&#39;s a really simple web app, as I&#39;ve created it as part of learning web development.</p>\n\n<p>It retrieves data from another API that I&#39;ve defined and this very API&#39;s database is used to store all the releated information that only right now I can store.</p>\n\n<p>And this web app is used to get information from that API and display it in an organized way.</p>\n\n<p>Have a look and please let me know about your thoughts and suggestions:</p>\n\n<p>Link: <a href="https://linux-distros-encyclopedia.herokuapp.com/">https://linux-distros-encyclopedia.herokuapp.com/</a></p>\n</div><!-- SC_ON -->', - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": True, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hnlh54", - "is_robot_indexable": True, - "report_reasons": None, - "author": "MisterKhJe", - "discussion_type": None, - "num_comments": 2, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hnlh54/linux_distributions_encyclopedia_web_app/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://www.reddit.com/r/linux/comments/hnlh54/linux_distributions_encyclopedia_web_app/", - "subreddit_subscribers": 543995, - "created_utc": 1594229786.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "I would like to turn my old Asus tablet into an ultimate linux-based Ebook reader. It's currently running kali linux due to my netsec background and I can't say that it runs flawlessly. The tablet came with Windows 10 by default. Does anyone have the experience with what distro and pdf reader to use?\n\nIt has to be lightweight due to 1.3Ghz Atom processor and 1Gb of Ram.", - "author_fullname": "t2_y0rlp", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Linux based Ebook reader tablet", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hnecim", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.56, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 2, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 2, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594231304.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.linux", - "allow_live_comments": False, - "selftext_html": '<!-- SC_OFF --><div class="md"><p>I would like to turn my old Asus tablet into an ultimate linux-based Ebook reader. It&#39;s currently running kali linux due to my netsec background and I can&#39;t say that it runs flawlessly. The tablet came with Windows 10 by default. Does anyone have the experience with what distro and pdf reader to use?</p>\n\n<p>It has to be lightweight due to 1.3Ghz Atom processor and 1Gb of Ram.</p>\n</div><!-- SC_ON -->', - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": True, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hnecim", - "is_robot_indexable": True, - "report_reasons": None, - "author": "Kikur", - "discussion_type": None, - "num_comments": 5, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hnecim/linux_based_ebook_reader_tablet/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://www.reddit.com/r/linux/comments/hnecim/linux_based_ebook_reader_tablet/", - "subreddit_subscribers": 543995, - "created_utc": 1594202504.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "", - "author_fullname": "t2_300vb", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Backing up my work-provided Windows laptop with Debian, ZFS and SquashFS", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hn2ro8", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.74, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 23, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 23, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594183686.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "thanassis.space", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://www.thanassis.space/backupCOVID.html", - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hn2ro8", - "is_robot_indexable": True, - "report_reasons": None, - "author": "ttsiodras", - "discussion_type": None, - "num_comments": 5, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hn2ro8/backing_up_my_workprovided_windows_laptop_with/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://www.thanassis.space/backupCOVID.html", - "subreddit_subscribers": 543995, - "created_utc": 1594154886.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "", - "author_fullname": "t2_2ccbdhht", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Debian influences everywhere", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": True, - "name": "t3_hnndj2", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.36, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 0, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": True, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 0, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "crosspost_parent_list": [ - { - "approved_at_utc": None, - "subreddit": "ramen", - "selftext": "", - "author_fullname": "t2_1e5jztuf", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "My 1st Attempt for Tori Paitan", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/ramen", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "", - "downs": 0, - "top_awarded_type": None, - "hide_score": True, - "name": "t3_hnn89u", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 1.0, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 2, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": True, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "Homemade", - "can_mod_post": False, - "score": 2, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": False, - "mod_note": None, - "created": 1594263979.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "i.redd.it", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://i.redd.it/ai9r2wu5mo951.jpg", - "view_count": None, - "archived": False, - "no_follow": True, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "28b48e48-ce25-11e8-94f2-0e1ed223bf48", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qykd", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "#ffd635", - "id": "hnn89u", - "is_robot_indexable": True, - "report_reasons": None, - "author": "cheesychicken80", - "discussion_type": None, - "num_comments": 1, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/ramen/comments/hnn89u/my_1st_attempt_for_tori_paitan/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://i.redd.it/ai9r2wu5mo951.jpg", - "subreddit_subscribers": 257000, - "created_utc": 1594235179.0, - "num_crossposts": 1, - "media": None, - "is_video": False, - } - ], - "created": 1594264403.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "i.redd.it", - "allow_live_comments": False, - "selftext_html": None, - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "url_overridden_by_dest": "https://i.redd.it/ai9r2wu5mo951.jpg", - "view_count": None, - "archived": False, - "no_follow": True, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hnndj2", - "is_robot_indexable": True, - "report_reasons": None, - "author": "dracardOner", - "discussion_type": None, - "num_comments": 0, - "send_replies": False, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "crosspost_parent": "t3_hnn89u", - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hnndj2/debian_influences_everywhere/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://i.redd.it/ai9r2wu5mo951.jpg", - "subreddit_subscribers": 543995, - "created_utc": 1594235603.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "There is an open issue in Electron-Builder to add option to easily create flatpak repo. This results in many electron apps not officially/easily supporting flatpak, thus solving this would help flatpak adoption and make it easier for users to install their favourite apps. See the issue on github for more info [https://github.com/electron-userland/electron-builder/issues/512](https://github.com/electron-userland/electron-builder/issues/512)\n\nSince there are no technical obstacles that prevent completing this task, I made a small bounty on gitpay [https://gitpay.me/#/task/352](https://gitpay.me/#/task/352) to motivate developers, and if you care about this issue, consider chiming in too, spreading the word or even giving a try at implementing this :)", - "author_fullname": "t2_5hgjidqm", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Crowdsource Flatpak support in Electron-Builder", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hmytic", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.76, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 37, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 37, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594171301.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.linux", - "allow_live_comments": False, - "selftext_html": '<!-- SC_OFF --><div class="md"><p>There is an open issue in Electron-Builder to add option to easily create flatpak repo. This results in many electron apps not officially/easily supporting flatpak, thus solving this would help flatpak adoption and make it easier for users to install their favourite apps. See the issue on github for more info <a href="https://github.com/electron-userland/electron-builder/issues/512">https://github.com/electron-userland/electron-builder/issues/512</a></p>\n\n<p>Since there are no technical obstacles that prevent completing this task, I made a small bounty on gitpay <a href="https://gitpay.me/#/task/352">https://gitpay.me/#/task/352</a> to motivate developers, and if you care about this issue, consider chiming in too, spreading the word or even giving a try at implementing this :)</p>\n</div><!-- SC_ON -->', - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hmytic", - "is_robot_indexable": True, - "report_reasons": None, - "author": "ignapk", - "discussion_type": None, - "num_comments": 23, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hmytic/crowdsource_flatpak_support_in_electronbuilder/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://www.reddit.com/r/linux/comments/hmytic/crowdsource_flatpak_support_in_electronbuilder/", - "subreddit_subscribers": 543995, - "created_utc": 1594142501.0, - "num_crossposts": 5, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "I was experiencing graphic issues and glitches in some games while using Linux Ubuntu 20.04 LTS with my Ryzen 3 3250u CPU and I wanted to share how I fixed this issue for anyone else with this same problem.\n\nFirst thing you should try is setting 'AMD_DEBUG=nodmacopyimage' as an environmental variable. This only partly fixed the issue for me as most of the in-game textures were still glitchy and messed up. However this method seemed to work for some other people https://gitlab.freedesktop.org/mesa/mesa/-/issues/2814\n\nThe second method I tried was downgrading from Ubuntu 20.04 to Ubuntu 19.10. This fixed my problem instantly and the glitchy in-game textures were no longer an issue.\n\n\nIm still new to Linux and not very tech savvy so I can't provide a detailed explanation of what causes this problem and why these methods seem to fix it however I'm pretty sure its something to do with the AMD graphics drivers. Hopefully this issue will be fixed in the next Ubuntu update\n\nHope this helped ;)", - "author_fullname": "t2_6qntnayu", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Linux Graphical Glitches on Ryzen CPUs", - "link_flair_richtext": [{"e": "text", "t": "Tips and Tricks"}], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": "", - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hmxiyt", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.79, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 20, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": "Tips and Tricks", - "can_mod_post": False, - "score": 20, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594167246.0, - "link_flair_type": "richtext", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.linux", - "allow_live_comments": False, - "selftext_html": '<!-- SC_OFF --><div class="md"><p>I was experiencing graphic issues and glitches in some games while using Linux Ubuntu 20.04 LTS with my Ryzen 3 3250u CPU and I wanted to share how I fixed this issue for anyone else with this same problem.</p>\n\n<p>First thing you should try is setting &#39;AMD_DEBUG=nodmacopyimage&#39; as an environmental variable. This only partly fixed the issue for me as most of the in-game textures were still glitchy and messed up. However this method seemed to work for some other people <a href="https://gitlab.freedesktop.org/mesa/mesa/-/issues/2814">https://gitlab.freedesktop.org/mesa/mesa/-/issues/2814</a></p>\n\n<p>The second method I tried was downgrading from Ubuntu 20.04 to Ubuntu 19.10. This fixed my problem instantly and the glitchy in-game textures were no longer an issue.</p>\n\n<p>Im still new to Linux and not very tech savvy so I can&#39;t provide a detailed explanation of what causes this problem and why these methods seem to fix it however I&#39;m pretty sure its something to do with the AMD graphics drivers. Hopefully this issue will be fixed in the next Ubuntu update</p>\n\n<p>Hope this helped ;)</p>\n</div><!-- SC_ON -->', - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "link_flair_template_id": "de62f716-76df-11ea-802c-0e7469f68f6b", - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "#00a6a5", - "id": "hmxiyt", - "is_robot_indexable": True, - "report_reasons": None, - "author": "Inolicious_", - "discussion_type": None, - "num_comments": 9, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hmxiyt/linux_graphical_glitches_on_ryzen_cpus/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://www.reddit.com/r/linux/comments/hmxiyt/linux_graphical_glitches_on_ryzen_cpus/", - "subreddit_subscribers": 543995, - "created_utc": 1594138446.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - { - "kind": "t3", - "data": { - "approved_at_utc": None, - "subreddit": "linux", - "selftext": "Well, alright, at various points in my life I may have been more pleased, but Windows has been losing my support for years one small nitpick at a time. Just wanted to share the change for whoever cares.\n\n* I liked the look and massive size of the windows less and less \n* As a programmer using bash and zsh on cygwin became more and more annoying\n* Windows keeps randomly changing stuff that I never wanted, like my downloads folder becoming a date-sorted list instead of an actual folder (and switching it back when I changed it!)\n* Adding cortana and the like and making it difficult to disable\n* Windows update.\n* Almost every bit of software I have at this point is also on linux or through a browser!\n\nI switched to Manjaro-Gnome and never looked back.\n\n* It's sleeker/runs faster.\n* Uses less RAM\n* Uses rolling updates\n* I can finally just use a built-in terminal\n* Has an easier to understand file structure, despite its complexity.\n* Is surprisingly easy to use. The only difficult part really was finding the wifi driver, and that was actually because it was mislabeled by the manufacturer.\n* Gnome is definitely nicer to use than Windows 10.\n* Searching for files and programs works well! I really didn't need windows to fail to find a program I had installed and instead offer to search for it online... through Bing on Edge.\n\nI never knew how much bloat Windows had until I switched over. This is so damn nice. I don't know why I didn't consider Linux as a serious alternative until recently. Steam Proton has also come a long, long way, I haven't had issues with a game yet.\n\nAnyways, I just wanted to rant, and I'm probably going to install an Manjaro-xfce on a bunch of old laptops.", - "author_fullname": "t2_8zm4y", - "saved": False, - "mod_reason_title": None, - "gilded": 0, - "clicked": False, - "title": "Switched from Windows 10 to Manjaro, never been happier", - "link_flair_richtext": [], - "subreddit_name_prefixed": "r/linux", - "hidden": False, - "pwls": 6, - "link_flair_css_class": None, - "downs": 0, - "top_awarded_type": None, - "hide_score": False, - "name": "t3_hmgujt", - "quarantine": False, - "link_flair_text_color": "dark", - "upvote_ratio": 0.92, - "author_flair_background_color": None, - "subreddit_type": "public", - "ups": 598, - "total_awards_received": 0, - "media_embed": {}, - "author_flair_template_id": None, - "is_original_content": False, - "user_reports": [], - "secure_media": None, - "is_reddit_media_domain": False, - "is_meta": False, - "category": None, - "secure_media_embed": {}, - "link_flair_text": None, - "can_mod_post": False, - "score": 598, - "approved_by": None, - "author_premium": False, - "thumbnail": "", - "edited": False, - "author_flair_css_class": None, - "author_flair_richtext": [], - "gildings": {}, - "content_categories": None, - "is_self": True, - "mod_note": None, - "created": 1594099445.0, - "link_flair_type": "text", - "wls": 6, - "removed_by_category": None, - "banned_by": None, - "author_flair_type": "text", - "domain": "self.linux", - "allow_live_comments": False, - "selftext_html": '<!-- SC_OFF --><div class="md"><p>Well, alright, at various points in my life I may have been more pleased, but Windows has been losing my support for years one small nitpick at a time. Just wanted to share the change for whoever cares.</p>\n\n<ul>\n<li>I liked the look and massive size of the windows less and less </li>\n<li>As a programmer using bash and zsh on cygwin became more and more annoying</li>\n<li>Windows keeps randomly changing stuff that I never wanted, like my downloads folder becoming a date-sorted list instead of an actual folder (and switching it back when I changed it!)</li>\n<li>Adding cortana and the like and making it difficult to disable</li>\n<li>Windows update.</li>\n<li>Almost every bit of software I have at this point is also on linux or through a browser!</li>\n</ul>\n\n<p>I switched to Manjaro-Gnome and never looked back.</p>\n\n<ul>\n<li>It&#39;s sleeker/runs faster.</li>\n<li>Uses less RAM</li>\n<li>Uses rolling updates</li>\n<li>I can finally just use a built-in terminal</li>\n<li>Has an easier to understand file structure, despite its complexity.</li>\n<li>Is surprisingly easy to use. The only difficult part really was finding the wifi driver, and that was actually because it was mislabeled by the manufacturer.</li>\n<li>Gnome is definitely nicer to use than Windows 10.</li>\n<li>Searching for files and programs works well! I really didn&#39;t need windows to fail to find a program I had installed and instead offer to search for it online... through Bing on Edge.</li>\n</ul>\n\n<p>I never knew how much bloat Windows had until I switched over. This is so damn nice. I don&#39;t know why I didn&#39;t consider Linux as a serious alternative until recently. Steam Proton has also come a long, long way, I haven&#39;t had issues with a game yet.</p>\n\n<p>Anyways, I just wanted to rant, and I&#39;m probably going to install an Manjaro-xfce on a bunch of old laptops.</p>\n</div><!-- SC_ON -->', - "likes": None, - "suggested_sort": None, - "banned_at_utc": None, - "view_count": None, - "archived": False, - "no_follow": False, - "is_crosspostable": True, - "pinned": False, - "over_18": False, - "all_awardings": [], - "awarders": [], - "media_only": False, - "can_gild": True, - "spoiler": False, - "locked": False, - "author_flair_text": None, - "treatment_tags": [], - "visited": False, - "removed_by": None, - "num_reports": None, - "distinguished": None, - "subreddit_id": "t5_2qh1a", - "mod_reason_by": None, - "removal_reason": None, - "link_flair_background_color": "", - "id": "hmgujt", - "is_robot_indexable": True, - "report_reasons": None, - "author": "ForShotgun", - "discussion_type": None, - "num_comments": 213, - "send_replies": True, - "whitelist_status": "all_ads", - "contest_mode": False, - "mod_reports": [], - "author_patreon_flair": False, - "author_flair_text_color": None, - "permalink": "/r/linux/comments/hmgujt/switched_from_windows_10_to_manjaro_never_been/", - "parent_whitelist_status": "all_ads", - "stickied": False, - "url": "https://www.reddit.com/r/linux/comments/hmgujt/switched_from_windows_10_to_manjaro_never_been/", - "subreddit_subscribers": 543995, - "created_utc": 1594070645.0, - "num_crossposts": 0, - "media": None, - "is_video": False, - }, - }, - ], - "after": "t3_hmgujt", - "before": None, - }, -} diff --git a/src/newsreader/news/collection/tests/reddit/stream/tests.py b/src/newsreader/news/collection/tests/reddit/stream/tests.py deleted file mode 100644 index 19aff61..0000000 --- a/src/newsreader/news/collection/tests/reddit/stream/tests.py +++ /dev/null @@ -1,144 +0,0 @@ -from json.decoder import JSONDecodeError -from unittest.mock import patch -from uuid import uuid4 - -from django.test import TestCase - -from newsreader.accounts.tests.factories import UserFactory -from newsreader.news.collection.exceptions import ( - StreamDeniedException, - StreamException, - StreamForbiddenException, - StreamNotFoundException, - StreamParseException, - StreamTimeOutException, -) -from newsreader.news.collection.reddit import RedditStream -from newsreader.news.collection.tests.factories import SubredditFactory -from newsreader.news.collection.tests.reddit.stream.mocks import simple_mock - - -class RedditStreamTestCase(TestCase): - def setUp(self): - self.maxDiff = None - - self.patched_fetch = patch("newsreader.news.collection.reddit.fetch") - self.mocked_fetch = self.patched_fetch.start() - - def tearDown(self): - patch.stopall() - - def test_simple_stream(self): - self.mocked_fetch.return_value.json.return_value = simple_mock - - access_token = str(uuid4()) - user = UserFactory(reddit_access_token=access_token) - - subreddit = SubredditFactory(user=user) - stream = RedditStream(subreddit) - - data, stream = stream.read() - - self.assertEquals(data, simple_mock) - self.assertEquals(stream, stream) - self.mocked_fetch.assert_called_once_with( - subreddit.url, headers={"Authorization": f"bearer {access_token}"} - ) - - def test_stream_raises_exception(self): - self.mocked_fetch.side_effect = StreamException - - access_token = str(uuid4()) - user = UserFactory(reddit_access_token=access_token) - - subreddit = SubredditFactory(user=user) - stream = RedditStream(subreddit) - - with self.assertRaises(StreamException): - stream.read() - - self.mocked_fetch.assert_called_once_with( - subreddit.url, headers={"Authorization": f"bearer {access_token}"} - ) - - def test_stream_raises_denied_exception(self): - self.mocked_fetch.side_effect = StreamDeniedException - - access_token = str(uuid4()) - user = UserFactory(reddit_access_token=access_token) - - subreddit = SubredditFactory(user=user) - stream = RedditStream(subreddit) - - with self.assertRaises(StreamDeniedException): - stream.read() - - self.mocked_fetch.assert_called_once_with( - subreddit.url, headers={"Authorization": f"bearer {access_token}"} - ) - - def test_stream_raises_not_found_exception(self): - self.mocked_fetch.side_effect = StreamNotFoundException - - access_token = str(uuid4()) - user = UserFactory(reddit_access_token=access_token) - - subreddit = SubredditFactory(user=user) - stream = RedditStream(subreddit) - - with self.assertRaises(StreamNotFoundException): - stream.read() - - self.mocked_fetch.assert_called_once_with( - subreddit.url, headers={"Authorization": f"bearer {access_token}"} - ) - - def test_stream_raises_time_out_exception(self): - self.mocked_fetch.side_effect = StreamTimeOutException - - access_token = str(uuid4()) - user = UserFactory(reddit_access_token=access_token) - - subreddit = SubredditFactory(user=user) - stream = RedditStream(subreddit) - - with self.assertRaises(StreamTimeOutException): - stream.read() - - self.mocked_fetch.assert_called_once_with( - subreddit.url, headers={"Authorization": f"bearer {access_token}"} - ) - - def test_stream_raises_forbidden_exception(self): - self.mocked_fetch.side_effect = StreamForbiddenException - - access_token = str(uuid4()) - user = UserFactory(reddit_access_token=access_token) - - subreddit = SubredditFactory(user=user) - stream = RedditStream(subreddit) - - with self.assertRaises(StreamForbiddenException): - stream.read() - - self.mocked_fetch.assert_called_once_with( - subreddit.url, headers={"Authorization": f"bearer {access_token}"} - ) - - def test_stream_raises_parse_exception(self): - self.mocked_fetch.return_value.json.side_effect = JSONDecodeError( - "No json found", "{}", 5 - ) - - access_token = str(uuid4()) - user = UserFactory(reddit_access_token=access_token) - - subreddit = SubredditFactory(user=user) - stream = RedditStream(subreddit) - - with self.assertRaises(StreamParseException): - stream.read() - - self.mocked_fetch.assert_called_once_with( - subreddit.url, headers={"Authorization": f"bearer {access_token}"} - ) diff --git a/src/newsreader/news/collection/tests/reddit/test_scheduler.py b/src/newsreader/news/collection/tests/reddit/test_scheduler.py deleted file mode 100644 index 0f04d53..0000000 --- a/src/newsreader/news/collection/tests/reddit/test_scheduler.py +++ /dev/null @@ -1,142 +0,0 @@ -from datetime import timedelta - -from django.test import TestCase -from django.utils import timezone - -from freezegun import freeze_time - -from newsreader.accounts.tests.factories import UserFactory -from newsreader.news.collection.choices import RuleTypeChoices -from newsreader.news.collection.reddit import RedditScheduler -from newsreader.news.collection.tests.factories import CollectionRuleFactory - - -@freeze_time("2019-10-30 12:30:00") -class RedditSchedulerTestCase(TestCase): - def test_simple(self): - user_1 = UserFactory( - reddit_access_token="1231414", reddit_refresh_token="5235262" - ) - user_2 = UserFactory( - reddit_access_token="3414777", reddit_refresh_token="3423425" - ) - - user_1_rules = [ - CollectionRuleFactory( - user=user_1, - type=RuleTypeChoices.subreddit, - last_run=timezone.now() - timedelta(days=4), - enabled=True, - ), - CollectionRuleFactory( - user=user_1, - type=RuleTypeChoices.subreddit, - last_run=timezone.now() - timedelta(days=3), - enabled=True, - ), - CollectionRuleFactory( - user=user_1, - type=RuleTypeChoices.subreddit, - last_run=timezone.now() - timedelta(days=2), - enabled=True, - ), - ] - - user_2_rules = [ - CollectionRuleFactory( - user=user_2, - type=RuleTypeChoices.subreddit, - last_run=timezone.now() - timedelta(days=4), - enabled=True, - ), - CollectionRuleFactory( - user=user_2, - type=RuleTypeChoices.subreddit, - last_run=timezone.now() - timedelta(days=3), - enabled=True, - ), - CollectionRuleFactory( - user=user_2, - type=RuleTypeChoices.subreddit, - last_run=timezone.now() - timedelta(days=2), - enabled=True, - ), - ] - - scheduler = RedditScheduler() - scheduled_subreddits = scheduler.get_scheduled_rules() - - user_1_batch = [subreddit.pk for subreddit in scheduled_subreddits[0]] - - self.assertIn(user_1_rules[0].pk, user_1_batch) - self.assertIn(user_1_rules[1].pk, user_1_batch) - self.assertIn(user_1_rules[2].pk, user_1_batch) - - user_2_batch = [subreddit.pk for subreddit in scheduled_subreddits[1]] - - self.assertIn(user_2_rules[0].pk, user_2_batch) - self.assertIn(user_2_rules[1].pk, user_2_batch) - self.assertIn(user_2_rules[2].pk, user_2_batch) - - def test_max_amount(self): - users = UserFactory.create_batch( - reddit_access_token="1231414", reddit_refresh_token="5235262", size=5 - ) - - nested_rules = [ - CollectionRuleFactory.create_batch( - name=f"rule-{index}", - type=RuleTypeChoices.subreddit, - last_run=timezone.now() - timedelta(seconds=index), - enabled=True, - user=user, - size=15, - ) - for index, user in enumerate(users) - ] - - rules = [rule for rule_list in nested_rules for rule in rule_list] - - scheduler = RedditScheduler() - scheduled_subreddits = [ - subreddit.pk - for batch in scheduler.get_scheduled_rules() - for subreddit in batch - ] - - for rule in rules[16:76]: - with self.subTest(rule=rule): - self.assertIn(rule.pk, scheduled_subreddits) - - for rule in rules[0:15]: - with self.subTest(rule=rule): - self.assertNotIn(rule.pk, scheduled_subreddits) - - def test_max_user_amount(self): - user = UserFactory( - reddit_access_token="1231414", reddit_refresh_token="5235262" - ) - - rules = [ - CollectionRuleFactory( - name=f"rule-{index}", - type=RuleTypeChoices.subreddit, - last_run=timezone.now() - timedelta(seconds=index), - enabled=True, - user=user, - ) - for index in range(1, 17) - ] - - scheduler = RedditScheduler() - scheduled_subreddits = [ - subreddit.pk - for batch in scheduler.get_scheduled_rules() - for subreddit in batch - ] - - for rule in rules[1:16]: - with self.subTest(rule=rule): - self.assertIn(rule.pk, scheduled_subreddits) - - self.assertNotIn(rules[0].pk, scheduled_subreddits) diff --git a/src/newsreader/news/collection/tests/views/test_crud.py b/src/newsreader/news/collection/tests/views/test_crud.py index ceeb40b..d4bd731 100644 --- a/src/newsreader/news/collection/tests/views/test_crud.py +++ b/src/newsreader/news/collection/tests/views/test_crud.py @@ -88,17 +88,3 @@ class FeedUpdateViewTestCase(CollectionRuleViewTestCase, TestCase): self.rule.refresh_from_db() self.assertEqual(self.rule.category, None) - - def test_rules_only(self): - rule = FeedFactory( - name="Python", - url="https://reddit.com/r/python", - user=self.user, - category=self.category, - type=RuleTypeChoices.subreddit, - ) - url = reverse("news:collection:feed-update", kwargs={"pk": rule.pk}) - - response = self.client.get(url) - - self.assertEqual(response.status_code, 404) diff --git a/src/newsreader/news/collection/tests/views/test_subreddit_views.py b/src/newsreader/news/collection/tests/views/test_subreddit_views.py deleted file mode 100644 index 4eac3b4..0000000 --- a/src/newsreader/news/collection/tests/views/test_subreddit_views.py +++ /dev/null @@ -1,133 +0,0 @@ -from django.test import TestCase -from django.urls import reverse -from django.utils.translation import gettext as _ - -from newsreader.news.collection.choices import RuleTypeChoices -from newsreader.news.collection.models import CollectionRule -from newsreader.news.collection.reddit import REDDIT_API_URL, REDDIT_URL -from newsreader.news.collection.tests.factories import SubredditFactory -from newsreader.news.collection.tests.views.base import CollectionRuleViewTestCase -from newsreader.news.core.tests.factories import CategoryFactory - - -class SubRedditCreateViewTestCase(CollectionRuleViewTestCase, TestCase): - def setUp(self): - super().setUp() - - self.form_data = { - "name": "new rule", - "url": f"{REDDIT_API_URL}/r/aww", - "category": str(self.category.pk), - "reddit_allow_nfsw": False, - "reddit_allow_spoiler": False, - "reddit_allow_viewed": True, - "reddit_upvotes_min": 0, - "reddit_comments_min": 0, - } - - self.url = reverse("news:collection:subreddit-create") - - def test_creation(self): - response = self.client.post(self.url, self.form_data) - - self.assertEqual(response.status_code, 302) - - rule = CollectionRule.objects.get(name="new rule") - - self.assertEqual(rule.type, RuleTypeChoices.subreddit) - self.assertEqual(rule.url, f"{REDDIT_API_URL}/r/aww") - self.assertEqual(rule.favicon, None) - self.assertEqual(rule.category.pk, self.category.pk) - self.assertEqual(rule.user.pk, self.user.pk) - - def test_regular_reddit_url(self): - self.form_data.update(url=f"{REDDIT_URL}/r/aww") - - response = self.client.post(self.url, self.form_data) - - self.assertContains(response, _("This does not look like an Reddit API URL")) - - -class SubRedditUpdateViewTestCase(CollectionRuleViewTestCase, TestCase): - def setUp(self): - super().setUp() - - self.rule = SubredditFactory( - name="Python", - url=f"{REDDIT_API_URL}/r/python.json", - user=self.user, - category=self.category, - type=RuleTypeChoices.subreddit, - ) - self.url = reverse( - "news:collection:subreddit-update", kwargs={"pk": self.rule.pk} - ) - - self.form_data = { - "name": self.rule.name, - "url": self.rule.url, - "category": str(self.category.pk), - "reddit_allow_nfsw": False, - "reddit_allow_spoiler": False, - "reddit_allow_viewed": True, - "reddit_upvotes_min": 0, - "reddit_comments_min": 0, - } - - def test_name_change(self): - self.form_data.update(name="Python 2") - - response = self.client.post(self.url, self.form_data) - self.assertEqual(response.status_code, 302) - - self.rule.refresh_from_db() - - self.assertEqual(self.rule.name, "Python 2") - - def test_category_change(self): - new_category = CategoryFactory(user=self.user) - - self.form_data.update(category=new_category.pk) - - response = self.client.post(self.url, self.form_data) - self.assertEqual(response.status_code, 302) - - self.rule.refresh_from_db() - - self.assertEqual(self.rule.category.pk, new_category.pk) - - def test_subreddit_rules_only(self): - rule = SubredditFactory( - name="Fake subreddit", - url="https://leddit.com/r/python", - user=self.user, - category=self.category, - type=RuleTypeChoices.feed, - ) - url = reverse("news:collection:subreddit-update", kwargs={"pk": rule.pk}) - - response = self.client.get(url) - - self.assertEqual(response.status_code, 404) - - def test_url_change(self): - self.form_data.update(name="aww", url=f"{REDDIT_API_URL}/r/aww") - - response = self.client.post(self.url, self.form_data) - - self.assertEqual(response.status_code, 302) - - rule = CollectionRule.objects.get(name="aww") - - self.assertEqual(rule.type, RuleTypeChoices.subreddit) - self.assertEqual(rule.url, f"{REDDIT_API_URL}/r/aww") - self.assertEqual(rule.favicon, None) - self.assertEqual(rule.category.pk, self.category.pk) - self.assertEqual(rule.user.pk, self.user.pk) - - def test_regular_reddit_url(self): - self.form_data.update(url=f"{REDDIT_URL}/r/aww") - - response = self.client.post(self.url, self.form_data) - - self.assertContains(response, _("This does not look like an Reddit API URL")) diff --git a/src/newsreader/news/collection/urls.py b/src/newsreader/news/collection/urls.py index e482002..a57a00e 100644 --- a/src/newsreader/news/collection/urls.py +++ b/src/newsreader/news/collection/urls.py @@ -14,8 +14,6 @@ from newsreader.news.collection.views import ( FeedCreateView, FeedUpdateView, OPMLImportView, - SubRedditCreateView, - SubRedditUpdateView, ) @@ -49,15 +47,4 @@ urlpatterns = [ name="rules-disable", ), path("rules/import/", login_required(OPMLImportView.as_view()), name="import"), - # Reddit - path( - "subreddits/create/", - login_required(SubRedditCreateView.as_view()), - name="subreddit-create", - ), - path( - "subreddits//", - login_required(SubRedditUpdateView.as_view()), - name="subreddit-update", - ), ] diff --git a/src/newsreader/news/collection/views/__init__.py b/src/newsreader/news/collection/views/__init__.py index 95d7b32..f4009db 100644 --- a/src/newsreader/news/collection/views/__init__.py +++ b/src/newsreader/news/collection/views/__init__.py @@ -3,10 +3,7 @@ from newsreader.news.collection.views.feed import ( FeedUpdateView, OPMLImportView, ) -from newsreader.news.collection.views.reddit import ( - SubRedditCreateView, - SubRedditUpdateView, -) + from newsreader.news.collection.views.rules import ( CollectionRuleBulkDeleteView, CollectionRuleBulkDisableView, @@ -19,8 +16,6 @@ __all__ = [ "FeedCreateView", "FeedUpdateView", "OPMLImportView", - "SubRedditCreateView", - "SubRedditUpdateView", "CollectionRuleBulkDeleteView", "CollectionRuleBulkDisableView", "CollectionRuleBulkEnableView", diff --git a/src/newsreader/news/collection/views/reddit.py b/src/newsreader/news/collection/views/reddit.py deleted file mode 100644 index 4e44e3f..0000000 --- a/src/newsreader/news/collection/views/reddit.py +++ /dev/null @@ -1,27 +0,0 @@ -from django.views.generic.edit import CreateView, UpdateView - -from newsreader.news.collection.choices import RuleTypeChoices -from newsreader.news.collection.forms import SubRedditForm -from newsreader.news.collection.views.base import ( - CollectionRuleDetailMixin, - CollectionRuleViewMixin, -) - - -class SubRedditCreateView( - CollectionRuleViewMixin, CollectionRuleDetailMixin, CreateView -): - form_class = SubRedditForm - template_name = "news/collection/views/subreddit-create.html" - - -class SubRedditUpdateView( - CollectionRuleViewMixin, CollectionRuleDetailMixin, UpdateView -): - form_class = SubRedditForm - template_name = "news/collection/views/subreddit-update.html" - context_object_name = "subreddit" - - def get_queryset(self): - queryset = super().get_queryset() - return queryset.filter(type=RuleTypeChoices.subreddit) diff --git a/src/newsreader/news/core/tests/factories.py b/src/newsreader/news/core/tests/factories.py index d3b62f0..88ce45e 100644 --- a/src/newsreader/news/core/tests/factories.py +++ b/src/newsreader/news/core/tests/factories.py @@ -4,7 +4,6 @@ import factory import factory.fuzzy from newsreader.accounts.tests.factories import UserFactory -from newsreader.news.collection.reddit import REDDIT_API_URL from newsreader.news.core.models import Category, Post @@ -36,10 +35,3 @@ class PostFactory(factory.django.DjangoModelFactory): class FeedPostFactory(PostFactory): rule = factory.SubFactory("newsreader.news.collection.tests.factories.FeedFactory") - - -class RedditPostFactory(PostFactory): - url = factory.fuzzy.FuzzyText(length=10, prefix=f"{REDDIT_API_URL}/") - rule = factory.SubFactory( - "newsreader.news.collection.tests.factories.SubredditFactory" - ) diff --git a/src/newsreader/news/core/views.py b/src/newsreader/news/core/views.py index d05603a..e7fc237 100644 --- a/src/newsreader/news/core/views.py +++ b/src/newsreader/news/core/views.py @@ -20,9 +20,6 @@ class NewsView(NavListMixin, TemplateView): **context, "homepageSettings": { "feedUrl": reverse_lazy("news:collection:feed-update", args=(0,)), - "subredditUrl": reverse_lazy( - "news:collection:subreddit-update", args=(0,) - ), "categoriesUrl": reverse_lazy("news:core:category-update", args=(0,)), "timezone": settings.TIME_ZONE, "autoMarking": self.request.user.auto_mark_read, diff --git a/src/newsreader/scss/components/index.scss b/src/newsreader/scss/components/index.scss index dba0131..c8a933a 100644 --- a/src/newsreader/scss/components/index.scss +++ b/src/newsreader/scss/components/index.scss @@ -18,8 +18,6 @@ @import './sidebar/index'; @import './table/index'; -@import './integrations/index'; - @import './rules/index'; @import './post/index'; diff --git a/src/newsreader/scss/components/integrations/_integrations.scss b/src/newsreader/scss/components/integrations/_integrations.scss deleted file mode 100644 index 3fbb593..0000000 --- a/src/newsreader/scss/components/integrations/_integrations.scss +++ /dev/null @@ -1,13 +0,0 @@ -.integrations { - display: flex; - flex-direction: column; - gap: 15px; - - padding: 15px; - - &__controls { - display: flex; - flex-wrap: wrap; - gap: 10px; - } -} diff --git a/src/newsreader/scss/components/integrations/index.scss b/src/newsreader/scss/components/integrations/index.scss deleted file mode 100644 index 7f9e759..0000000 --- a/src/newsreader/scss/components/integrations/index.scss +++ /dev/null @@ -1 +0,0 @@ -@import './integrations'; diff --git a/src/newsreader/scss/elements/button/_button.scss b/src/newsreader/scss/elements/button/_button.scss index 96ee2c8..237e37d 100644 --- a/src/newsreader/scss/elements/button/_button.scss +++ b/src/newsreader/scss/elements/button/_button.scss @@ -13,12 +13,14 @@ cursor: pointer; } - &--success, &--confirm { + &--success, + &--confirm { background-color: var(--confirm-color); color: $white !important; } - &--error, &--cancel { + &--error, + &--cancel { color: $white !important; background-color: var(--danger-color); } @@ -28,15 +30,6 @@ background-color: var(--info-color); } - &--reddit { - color: $white !important; - background-color: $reddit-orange; - - &:hover { - background-color: lighten($reddit-orange, 5%); - } - } - &--disabled { color: var(--font-color) !important; background-color: var(--background-color-secondary) !important; diff --git a/src/newsreader/scss/pages/index.scss b/src/newsreader/scss/pages/index.scss index 2ac0bb2..44ca8a7 100644 --- a/src/newsreader/scss/pages/index.scss +++ b/src/newsreader/scss/pages/index.scss @@ -12,4 +12,3 @@ @import './rules/index'; @import './settings/index'; -@import './integrations/index'; diff --git a/src/newsreader/scss/pages/integrations/index.scss b/src/newsreader/scss/pages/integrations/index.scss deleted file mode 100644 index ccf52c3..0000000 --- a/src/newsreader/scss/pages/integrations/index.scss +++ /dev/null @@ -1,5 +0,0 @@ -#integrations--page { - .section { - width: 70%; - } -} diff --git a/src/newsreader/scss/partials/_colors.scss b/src/newsreader/scss/partials/_colors.scss index 1807a85..d2433f6 100644 --- a/src/newsreader/scss/partials/_colors.scss +++ b/src/newsreader/scss/partials/_colors.scss @@ -59,6 +59,3 @@ $dark-info-color: $blue; $dark-info-font-color: $white; $dark-sidebar-background-color: $dark-background-color-secondary; - -// Third party -$reddit-orange: rgba(255, 69, 0, 1); From bfd081337b287bcdf567eba7252e1bbab4e0595e Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Fri, 28 Mar 2025 21:41:47 +0100 Subject: [PATCH 235/253] Run formatting / fix lint errors --- ...emove_user_reddit_access_token_and_more.py | 11 +++--- ...llectionrule_reddit_allow_nfsw_and_more.py | 39 ++++++++++--------- src/newsreader/news/collection/tasks.py | 1 - .../tests/favicon/collector/mocks.py | 6 +-- .../collection/tests/feed/client/mocks.py | 2 +- .../collection/tests/feed/collector/mocks.py | 18 ++++----- .../collection/tests/feed/stream/mocks.py | 10 ++--- src/newsreader/news/collection/utils.py | 2 +- .../news/collection/views/__init__.py | 1 - 9 files changed, 44 insertions(+), 46 deletions(-) diff --git a/src/newsreader/accounts/migrations/0018_remove_user_reddit_access_token_and_more.py b/src/newsreader/accounts/migrations/0018_remove_user_reddit_access_token_and_more.py index 19bda0c..cf8816b 100644 --- a/src/newsreader/accounts/migrations/0018_remove_user_reddit_access_token_and_more.py +++ b/src/newsreader/accounts/migrations/0018_remove_user_reddit_access_token_and_more.py @@ -4,18 +4,17 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ - ('accounts', '0017_auto_20240906_0914'), + ("accounts", "0017_auto_20240906_0914"), ] operations = [ migrations.RemoveField( - model_name='user', - name='reddit_access_token', + model_name="user", + name="reddit_access_token", ), migrations.RemoveField( - model_name='user', - name='reddit_refresh_token', + model_name="user", + name="reddit_refresh_token", ), ] diff --git a/src/newsreader/news/collection/migrations/0018_remove_collectionrule_reddit_allow_nfsw_and_more.py b/src/newsreader/news/collection/migrations/0018_remove_collectionrule_reddit_allow_nfsw_and_more.py index 39bdb8b..cc61aee 100644 --- a/src/newsreader/news/collection/migrations/0018_remove_collectionrule_reddit_allow_nfsw_and_more.py +++ b/src/newsreader/news/collection/migrations/0018_remove_collectionrule_reddit_allow_nfsw_and_more.py @@ -4,43 +4,44 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('collection', '0017_remove_collectionrule_timezone'), + ("collection", "0017_remove_collectionrule_timezone"), ] operations = [ migrations.RemoveField( - model_name='collectionrule', - name='reddit_allow_nfsw', + model_name="collectionrule", + name="reddit_allow_nfsw", ), migrations.RemoveField( - model_name='collectionrule', - name='reddit_allow_spoiler', + model_name="collectionrule", + name="reddit_allow_spoiler", ), migrations.RemoveField( - model_name='collectionrule', - name='reddit_allow_viewed', + model_name="collectionrule", + name="reddit_allow_viewed", ), migrations.RemoveField( - model_name='collectionrule', - name='reddit_comments_min', + model_name="collectionrule", + name="reddit_comments_min", ), migrations.RemoveField( - model_name='collectionrule', - name='reddit_downvotes_max', + model_name="collectionrule", + name="reddit_downvotes_max", ), migrations.RemoveField( - model_name='collectionrule', - name='reddit_upvotes_min', + model_name="collectionrule", + name="reddit_upvotes_min", ), migrations.RemoveField( - model_name='collectionrule', - name='screen_name', + model_name="collectionrule", + name="screen_name", ), migrations.AlterField( - model_name='collectionrule', - name='type', - field=models.CharField(choices=[('feed', 'Feed')], default='feed', max_length=20), + model_name="collectionrule", + name="type", + field=models.CharField( + choices=[("feed", "Feed")], default="feed", max_length=20 + ), ), ] diff --git a/src/newsreader/news/collection/tasks.py b/src/newsreader/news/collection/tasks.py index f397244..b61936a 100644 --- a/src/newsreader/news/collection/tasks.py +++ b/src/newsreader/news/collection/tasks.py @@ -1,5 +1,4 @@ from django.core.exceptions import ObjectDoesNotExist -from django.utils.translation import gettext as _ from celery.exceptions import Reject from celery.utils.log import get_task_logger diff --git a/src/newsreader/news/collection/tests/favicon/collector/mocks.py b/src/newsreader/news/collection/tests/favicon/collector/mocks.py index ca06c2f..d9b65f1 100644 --- a/src/newsreader/news/collection/tests/favicon/collector/mocks.py +++ b/src/newsreader/news/collection/tests/favicon/collector/mocks.py @@ -44,7 +44,7 @@ feed_mock = { "base": "http://feeds.bbci.co.uk/news/rss.xml", "language": None, "type": "text/plain", - "value": "Trump's genocidal taunts will not " "end Iran - Zarif", + "value": "Trump's genocidal taunts will not end Iran - Zarif", }, }, { @@ -83,7 +83,7 @@ feed_mock = { "base": "http://feeds.bbci.co.uk/news/rss.xml", "language": None, "type": "text/plain", - "value": "Huawei's Android loss: How it " "affects you", + "value": "Huawei's Android loss: How it affects you", }, }, { @@ -124,7 +124,7 @@ feed_mock = { "base": "http://feeds.bbci.co.uk/news/rss.xml", "language": None, "type": "text/plain", - "value": "Birmingham head teacher threatened " "over LGBT lessons", + "value": "Birmingham head teacher threatened over LGBT lessons", }, }, ], diff --git a/src/newsreader/news/collection/tests/feed/client/mocks.py b/src/newsreader/news/collection/tests/feed/client/mocks.py index 25742fe..185f03d 100644 --- a/src/newsreader/news/collection/tests/feed/client/mocks.py +++ b/src/newsreader/news/collection/tests/feed/client/mocks.py @@ -42,7 +42,7 @@ simple_mock = { "base": "http://feeds.bbci.co.uk/news/rss.xml", "language": None, "type": "text/plain", - "value": "Trump's 'genocidal taunts' will not " "end Iran - Zarif", + "value": "Trump's 'genocidal taunts' will not end Iran - Zarif", }, } ], diff --git a/src/newsreader/news/collection/tests/feed/collector/mocks.py b/src/newsreader/news/collection/tests/feed/collector/mocks.py index 96fab4b..7999f99 100644 --- a/src/newsreader/news/collection/tests/feed/collector/mocks.py +++ b/src/newsreader/news/collection/tests/feed/collector/mocks.py @@ -42,7 +42,7 @@ multiple_mock = { "base": "http://feeds.bbci.co.uk/news/rss.xml", "language": None, "type": "text/plain", - "value": "Trump's 'genocidal taunts' will not " "end Iran - Zarif", + "value": "Trump's 'genocidal taunts' will not end Iran - Zarif", }, }, { @@ -81,7 +81,7 @@ multiple_mock = { "base": "http://feeds.bbci.co.uk/news/rss.xml", "language": None, "type": "text/plain", - "value": "Huawei's Android loss: How it " "affects you", + "value": "Huawei's Android loss: How it affects you", }, }, { @@ -122,7 +122,7 @@ multiple_mock = { "base": "http://feeds.bbci.co.uk/news/rss.xml", "language": None, "type": "text/plain", - "value": "Birmingham head teacher threatened " "over LGBT lessons", + "value": "Birmingham head teacher threatened over LGBT lessons", }, }, ], @@ -212,7 +212,7 @@ duplicate_mock = { "base": "http://feeds.bbci.co.uk/news/rss.xml", "language": None, "type": "text/plain", - "value": "Trump's 'genocidal taunts' will not " "end Iran - Zarif", + "value": "Trump's 'genocidal taunts' will not end Iran - Zarif", }, }, { @@ -250,7 +250,7 @@ duplicate_mock = { "base": "http://feeds.bbci.co.uk/news/rss.xml", "language": None, "type": "text/plain", - "value": "Huawei's Android loss: How it " "affects you", + "value": "Huawei's Android loss: How it affects you", }, }, { @@ -290,7 +290,7 @@ duplicate_mock = { "base": "http://feeds.bbci.co.uk/news/rss.xml", "language": None, "type": "text/plain", - "value": "Birmingham head teacher threatened " "over LGBT lessons", + "value": "Birmingham head teacher threatened over LGBT lessons", }, }, ], @@ -356,7 +356,7 @@ multiple_update_mock = { "base": "http://feeds.bbci.co.uk/news/rss.xml", "language": None, "type": "text/plain", - "value": "Trump's 'genocidal taunts' will not " "end Iran - Zarif", + "value": "Trump's 'genocidal taunts' will not end Iran - Zarif", }, }, { @@ -395,7 +395,7 @@ multiple_update_mock = { "base": "http://feeds.bbci.co.uk/news/rss.xml", "language": None, "type": "text/plain", - "value": "Huawei's Android loss: How it " "affects you", + "value": "Huawei's Android loss: How it affects you", }, }, { @@ -436,7 +436,7 @@ multiple_update_mock = { "base": "http://feeds.bbci.co.uk/news/rss.xml", "language": None, "type": "text/plain", - "value": "Birmingham head teacher threatened " "over LGBT lessons", + "value": "Birmingham head teacher threatened over LGBT lessons", }, }, ], diff --git a/src/newsreader/news/collection/tests/feed/stream/mocks.py b/src/newsreader/news/collection/tests/feed/stream/mocks.py index 7084641..e8d6856 100644 --- a/src/newsreader/news/collection/tests/feed/stream/mocks.py +++ b/src/newsreader/news/collection/tests/feed/stream/mocks.py @@ -73,12 +73,12 @@ simple_mock_parsed = { "not think face coverings should be " "mandatory in shops in England.", }, - "title": "Coronavirus: I trust people's sense on face masks - " "Gove", + "title": "Coronavirus: I trust people's sense on face masks - Gove", "title_detail": { "base": "", "language": None, "type": "text/plain", - "value": "Coronavirus: I trust people's sense " "on face masks - Gove", + "value": "Coronavirus: I trust people's sense on face masks - Gove", }, }, { @@ -109,7 +109,7 @@ simple_mock_parsed = { "base": "", "language": None, "type": "text/plain", - "value": "Farm outbreak leads 200 to self " "isolate", + "value": "Farm outbreak leads 200 to self isolate", }, }, { @@ -137,12 +137,12 @@ simple_mock_parsed = { "talks on tackling people " "smuggling.", }, - "title": "English Channel search operation after migrant " "crossings", + "title": "English Channel search operation after migrant crossings", "title_detail": { "base": "", "language": None, "type": "text/plain", - "value": "English Channel search operation " "after migrant crossings", + "value": "English Channel search operation after migrant crossings", }, }, ], diff --git a/src/newsreader/news/collection/utils.py b/src/newsreader/news/collection/utils.py index 827d446..36a3b9e 100644 --- a/src/newsreader/news/collection/utils.py +++ b/src/newsreader/news/collection/utils.py @@ -60,6 +60,6 @@ def truncate_text(cls, field_name, value): return value if len(value) > max_length: - return f"{value[:max_length - 1]}…" + return f"{value[: max_length - 1]}…" return value diff --git a/src/newsreader/news/collection/views/__init__.py b/src/newsreader/news/collection/views/__init__.py index f4009db..dc92557 100644 --- a/src/newsreader/news/collection/views/__init__.py +++ b/src/newsreader/news/collection/views/__init__.py @@ -3,7 +3,6 @@ from newsreader.news.collection.views.feed import ( FeedUpdateView, OPMLImportView, ) - from newsreader.news.collection.views.rules import ( CollectionRuleBulkDeleteView, CollectionRuleBulkDisableView, From 1417c5200724996777e55721ae3a2aa7ed3f9e65 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Fri, 28 Mar 2025 21:55:35 +0100 Subject: [PATCH 236/253] Apply prettier formatting --- package-lock.json | 4 ++-- src/newsreader/js/components/Messages.js | 4 ++-- src/newsreader/js/components/Selector.js | 4 ++-- src/newsreader/js/pages/categories/App.js | 10 +++++----- .../js/pages/homepage/components/PostModal.js | 6 +++--- .../js/pages/homepage/components/ScrollTop.js | 2 +- .../js/pages/homepage/components/postlist/PostList.js | 4 ++-- .../js/pages/homepage/components/sidebar/ReadButton.js | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index 82a511b..59e4d2b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "newsreader", - "version": "0.4.4", + "version": "0.5.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "newsreader", - "version": "0.4.4", + "version": "0.5.3", "license": "GPL-3.0-or-later", "dependencies": { "@fortawesome/fontawesome-free": "^5.15.2", diff --git a/src/newsreader/js/components/Messages.js b/src/newsreader/js/components/Messages.js index e3d776e..dd3b2f8 100644 --- a/src/newsreader/js/components/Messages.js +++ b/src/newsreader/js/components/Messages.js @@ -3,13 +3,13 @@ import React from 'react'; class Messages extends React.Component { state = { messages: this.props.messages }; - close = (index) => { + close = index => { const newMessages = this.state.messages.filter((message, currentIndex) => { return currentIndex != index; }); this.setState({ messages: newMessages }); - } + }; render() { const messages = this.state.messages.map((message, index) => { diff --git a/src/newsreader/js/components/Selector.js b/src/newsreader/js/components/Selector.js index c6b117a..8933a59 100644 --- a/src/newsreader/js/components/Selector.js +++ b/src/newsreader/js/components/Selector.js @@ -9,13 +9,13 @@ class Selector { selectAllInput.onchange = this.onClick; } - onClick = (e) => { + onClick = e => { const targetValue = e.target.checked; this.inputs.forEach(input => { input.checked = targetValue; }); - } + }; } export default Selector; diff --git a/src/newsreader/js/pages/categories/App.js b/src/newsreader/js/pages/categories/App.js index ac237c3..db81a73 100644 --- a/src/newsreader/js/pages/categories/App.js +++ b/src/newsreader/js/pages/categories/App.js @@ -20,15 +20,15 @@ class App extends React.Component { }; } - selectCategory = (categoryId) => { + selectCategory = categoryId => { this.setState({ selectedCategoryId: categoryId }); - } + }; deselectCategory = () => { this.setState({ selectedCategoryId: null }); - } + }; - deleteCategory = (categoryId) => { + deleteCategory = categoryId => { const url = `/api/categories/${categoryId}/`; const options = { method: 'DELETE', @@ -56,7 +56,7 @@ class App extends React.Component { text: 'Unable to remove category, try again later', }; return this.setState({ selectedCategoryId: null, message: message }); - } + }; render() { const { categories } = this.state; diff --git a/src/newsreader/js/pages/homepage/components/PostModal.js b/src/newsreader/js/pages/homepage/components/PostModal.js index 5dacdf8..e319e10 100644 --- a/src/newsreader/js/pages/homepage/components/PostModal.js +++ b/src/newsreader/js/pages/homepage/components/PostModal.js @@ -31,13 +31,13 @@ class PostModal extends React.Component { window.removeEventListener('click', this.modalListener); } - modalListener = (e) => { + modalListener = e => { const targetClassName = e.target.className; if (this.props.post && targetClassName == 'modal post-modal') { this.props.unSelectPost(); } - } + }; render() { const post = this.props.post; @@ -66,7 +66,7 @@ class PostModal extends React.Component {