aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Leon Sandøy <[email protected]>2019-04-20 01:16:13 +0200
committerGravatar Leon Sandøy <[email protected]>2019-04-20 01:16:13 +0200
commita27b3a313c64a264e0b52043f41fd28b684cc654 (patch)
tree4455327209658bfcea26a98c1e77a2f61ee9f693
parentAddressing volcyys third review. (diff)
Adding a Discord menu item to the hamburger, and upping test coverage back to 100%
-rw-r--r--pydis_site/apps/home/models/__init__.py2
-rw-r--r--pydis_site/apps/home/tests/test_repodata_helpers.py15
-rw-r--r--pydis_site/templates/base/navbar.html9
3 files changed, 23 insertions, 3 deletions
diff --git a/pydis_site/apps/home/models/__init__.py b/pydis_site/apps/home/models/__init__.py
index f327795a..6c68df9c 100644
--- a/pydis_site/apps/home/models/__init__.py
+++ b/pydis_site/apps/home/models/__init__.py
@@ -1,3 +1,3 @@
-from .repo_data import RepositoryMetadata
+from .repository_metadata import RepositoryMetadata
__all__ = ["RepositoryMetadata"]
diff --git a/pydis_site/apps/home/tests/test_repodata_helpers.py b/pydis_site/apps/home/tests/test_repodata_helpers.py
index 8ab2a467..be51dce4 100644
--- a/pydis_site/apps/home/tests/test_repodata_helpers.py
+++ b/pydis_site/apps/home/tests/test_repodata_helpers.py
@@ -72,7 +72,7 @@ class TestRepositoryMetadataHelpers(TestCase):
forks=42,
stargazers=42,
language="English",
- last_updated=timezone.now() - timedelta(seconds=121), # Make the data 2 minutes old.
+ last_updated=timezone.now() - timedelta(seconds=HomeView.repository_cache_ttl + 1),
)
repo_data.save()
metadata = self.home_view._get_repo_data()
@@ -90,3 +90,16 @@ class TestRepositoryMetadataHelpers(TestCase):
self.assertEquals(len(api_data), len(self.home_view.repos))
self.assertIn(repo, api_data.keys())
self.assertIn("stargazers_count", api_data[repo])
+
+ @mock.patch('requests.get', side_effect=mocked_requests_get)
+ def test_mocked_requests_get(self, mock_get):
+ """Tests if our mocked_requests_get is returning what it should."""
+
+ success_data = mock_get(HomeView.github_api)
+ fail_data = mock_get("failtest")
+
+ self.assertEqual(success_data.status_code, 200)
+ self.assertEqual(fail_data.status_code, 404)
+
+ self.assertIsNotNone(success_data.json_data)
+ self.assertIsNone(fail_data.json_data)
diff --git a/pydis_site/templates/base/navbar.html b/pydis_site/templates/base/navbar.html
index ed6ae118..5e76b3a6 100644
--- a/pydis_site/templates/base/navbar.html
+++ b/pydis_site/templates/base/navbar.html
@@ -19,6 +19,13 @@
{# Content on the right side of the navbar #}
<div class="navbar-menu is-paddingless" id="navbar_menu">
<div class="navbar-end">
+
+ {# Discord invite - only visible in the hamburger on mobile sizes. #}
+ <a class="navbar-item is-hidden-desktop" href="https://discord.gg/python">
+ <span class="icon is-size-4 is-medium"><i class="fab fa-discord"></i></span>
+ <span>&nbsp;Discord</span>
+ </a>
+
{# GitHub #}
<a class="navbar-item" href="https://github.com/python-discord">
<span class="icon is-size-4 is-medium"><i class="fab fa-github"></i></span>
@@ -43,7 +50,7 @@
<span>&nbsp;Patreon</span>
</a>
- {# RedBubble #}
+ {# Merch #}
<a class="navbar-item" href="https://www.redbubble.com/people/PythonDiscord/shop">
<span class="icon is-size-4 is-medium"><i class="fas fa-tshirt"></i></span>
<span>&nbsp;Merch</span>