Skip to content

Commit 218fd4b

Browse files
authored
Merge pull request #131 from sandiegopython/davidfischer/run-ci-on-prs
Run CI on PRs / fix tests
2 parents 1cb1e33 + fcbe10f commit 218fd4b

File tree

4 files changed

+39
-24
lines changed

4 files changed

+39
-24
lines changed

.github/workflows/ci.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
12
name: Continuous Integration Checks
23

3-
# All branches
4-
on: push
4+
# All PRs as well as pushes to main
5+
on:
6+
push:
7+
branches:
8+
- main
9+
pull_request:
510

611
jobs:
712
build:

pythonsd/sitemap.py

+18-18
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@
33

44

55
class IndexSitemap(Sitemap):
6-
changefreq = 'weekly'
7-
protocol = 'https'
8-
priority = 1.0
6+
changefreq = "weekly"
7+
protocol = "https"
8+
priority = 1.0
99

10-
def items(self):
11-
return [
12-
'index',
13-
]
10+
def items(self):
11+
return [
12+
"index",
13+
]
1414

15-
def location(self, item):
16-
return reverse(item)
15+
def location(self, item):
16+
return reverse(item)
1717

1818

1919
class StaticViewSitemap(Sitemap):
20-
changefreq = 'monthly'
21-
protocol = 'https'
22-
priority = 0.8
20+
changefreq = "monthly"
21+
protocol = "https"
22+
priority = 0.8
2323

24-
def items(self):
25-
return [
26-
'code-of-conduct',
27-
]
24+
def items(self):
25+
return [
26+
"code-of-conduct",
27+
]
2828

29-
def location(self, item):
30-
return reverse(item)
29+
def location(self, item):
30+
return reverse(item)

pythonsd/tests/__init__.py

+6
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,12 @@ def test_api_error(self):
214214
self.assertContains(response, "Check out our")
215215

216216

217+
class TestSitemap(test.TestCase):
218+
def test_sitemap(self):
219+
resp = self.client.get("/sitemap.xml")
220+
self.assertEqual(resp.status_code, 200)
221+
222+
217223
class TestWSGIApp(unittest.TestCase):
218224
@classmethod
219225
def setUpClass(cls):

pythonsd/urls.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
from .sitemap import IndexSitemap, StaticViewSitemap
88

99
sitemaps = {
10-
"index": IndexSitemap,
11-
"static": StaticViewSitemap,
10+
"index": IndexSitemap,
11+
"static": StaticViewSitemap,
1212
}
1313

1414

@@ -26,8 +26,12 @@
2626
# XHR/Async requests
2727
path(r"xhr/events/", views.UpcomingEventsView.as_view(), name="upcoming_events"),
2828
path(r"xhr/videos/", views.RecentVideosView.as_view(), name="recent_videos"),
29-
path(r"sitemap.xml", sitemap, {"sitemaps": sitemaps},
30-
name="django.contrib.sitemaps.views.sitemap"),
29+
path(
30+
r"sitemap.xml",
31+
sitemap,
32+
{"sitemaps": sitemaps},
33+
name="django.contrib.sitemaps.views.sitemap",
34+
),
3135
]
3236

3337
# These redirects handle redirecting URLs from the old static site to the new Django site

0 commit comments

Comments
 (0)