test_management.py 614 B

1234567891011121314151617
  1. from unittest import mock
  2. from django.core.management import call_command
  3. from .base import SitemapTestsBase
  4. @mock.patch('django.contrib.sitemaps.management.commands.ping_google.ping_google')
  5. class PingGoogleTests(SitemapTestsBase):
  6. def test_default(self, ping_google_func):
  7. call_command('ping_google')
  8. ping_google_func.assert_called_with(sitemap_url=None, sitemap_uses_https=True)
  9. def test_args(self, ping_google_func):
  10. call_command('ping_google', 'foo.xml', '--sitemap-uses-http')
  11. ping_google_func.assert_called_with(sitemap_url='foo.xml', sitemap_uses_https=False)