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