Skip to content

Commit 56b8707

Browse files
mozillazgberkerpeksag
authored andcommitted
Fix typos in dump_pep_pages command (#1283)
* Base class of Command should read BaseCommand * URLs of PEP pages start with /dev/peps/
1 parent c1f726b commit 56b8707

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

peps/management/commands/dump_pep_pages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
from pages.models import Page
55

66

7-
class Command(BaeeCommand):
7+
class Command(BaseCommand):
88
"""
99
Dump PEP related Pages as indented JSON
1010
"""
1111
help = "Dump PEP related Pages as indented JSON"
1212

1313
def handle(self, **options):
14-
qs = Page.objects.filter(path__startswith='peps/')
14+
qs = Page.objects.filter(path__startswith='dev/peps/')
1515

1616
serializers.serialize(
1717
format='json',

peps/tests/test_commands.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
import io
2+
13
from bs4 import BeautifulSoup
24

35
from django.test import TestCase, override_settings
46
from django.conf import settings
7+
from django.core import serializers
58
from django.core.management import call_command
69
from django.core.exceptions import ImproperlyConfigured
710

@@ -33,3 +36,12 @@ def test_image_generated(self):
3336
img = Image.objects.get(page__path='dev/peps/pep-3001/')
3437
soup = BeautifulSoup(img.page.content.raw, 'lxml')
3538
self.assertIn(settings.MEDIA_URL, soup.find('img')['src'])
39+
40+
@override_settings(PEP_REPO_PATH=FAKE_PEP_REPO)
41+
def test_dump_pep_pages(self):
42+
call_command('generate_pep_pages')
43+
stdout = io.StringIO()
44+
call_command('dump_pep_pages', stdout=stdout)
45+
output = stdout.getvalue()
46+
result = list(serializers.deserialize('json', output))
47+
self.assertGreater(len(result), 0)

0 commit comments

Comments
 (0)