Skip to content

Run CI on PRs / fix tests #131

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
name: Continuous Integration Checks

# All branches
on: push
# All PRs as well as pushes to main
on:
push:
branches:
- main
pull_request:

jobs:
build:
Expand Down
36 changes: 18 additions & 18 deletions pythonsd/sitemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@


class IndexSitemap(Sitemap):
changefreq = 'weekly'
protocol = 'https'
priority = 1.0
changefreq = "weekly"
protocol = "https"
priority = 1.0

def items(self):
return [
'index',
]
def items(self):
return [
"index",
]

def location(self, item):
return reverse(item)
def location(self, item):
return reverse(item)


class StaticViewSitemap(Sitemap):
changefreq = 'monthly'
protocol = 'https'
priority = 0.8
changefreq = "monthly"
protocol = "https"
priority = 0.8

def items(self):
return [
'code-of-conduct',
]
def items(self):
return [
"code-of-conduct",
]

def location(self, item):
return reverse(item)
def location(self, item):
return reverse(item)
6 changes: 6 additions & 0 deletions pythonsd/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ def test_api_error(self):
self.assertContains(response, "Check out our")


class TestSitemap(test.TestCase):
def test_sitemap(self):
resp = self.client.get("/sitemap.xml")
self.assertEqual(resp.status_code, 200)


class TestWSGIApp(unittest.TestCase):
@classmethod
def setUpClass(cls):
Expand Down
12 changes: 8 additions & 4 deletions pythonsd/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from .sitemap import IndexSitemap, StaticViewSitemap

sitemaps = {
"index": IndexSitemap,
"static": StaticViewSitemap,
"index": IndexSitemap,
"static": StaticViewSitemap,
}


Expand All @@ -26,8 +26,12 @@
# XHR/Async requests
path(r"xhr/events/", views.UpcomingEventsView.as_view(), name="upcoming_events"),
path(r"xhr/videos/", views.RecentVideosView.as_view(), name="recent_videos"),
path(r"sitemap.xml", sitemap, {"sitemaps": sitemaps},
name="django.contrib.sitemaps.views.sitemap"),
path(
r"sitemap.xml",
sitemap,
{"sitemaps": sitemaps},
name="django.contrib.sitemaps.views.sitemap",
),
]

# These redirects handle redirecting URLs from the old static site to the new Django site
Expand Down
Loading