Skip to content

Commit 81e26e6

Browse files
committed
Test
1 parent fd58784 commit 81e26e6

File tree

5 files changed

+155
-19
lines changed

5 files changed

+155
-19
lines changed

readthedocs/payments/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ def delete_customer(customer_id):
2929
def cancel_subscription(subscription_id):
3030
"""Cancel Stripe subscription, if it exists."""
3131
try:
32+
log.info(
33+
"Canceling stripe subscription.",
34+
stripe_subscription=subscription_id,
35+
)
3236
return stripe.Subscription.delete(subscription_id)
3337
except stripe.error.StripeError:
3438
log.exception(
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<!DOCTYPE html>
2+
3+
<!--
4+
Default pelican theme.
5+
From https://blog.getpelican.com/pelican-4.7-released.html
6+
-->
7+
8+
<html lang="en">
9+
<head>
10+
<meta charset="utf-8">
11+
<title>Pelican 4.7 released</title>
12+
<link rel="stylesheet" href="https://blog.getpelican.com/theme/css/A.main.css.pagespeed.cf.zFbdR40MwZ.css" type="text/css"/>
13+
<link href="https://blog.getpelican.com/feeds/all.atom.xml" type="application/atom+xml" rel="alternate" title="Pelican Development Blog Atom Feed"/>
14+
15+
<!--[if IE]>
16+
<script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
17+
<![endif]-->
18+
</head>
19+
20+
<body id="index" class="home">
21+
<header id="banner" class="body">
22+
<h1><a href="https://blog.getpelican.com/">Pelican Development Blog </a></h1>
23+
<nav><ul>
24+
<li class="active"><a href="https://blog.getpelican.com/category/news.html">news</a></li>
25+
<li><a href="https://docs.getpelican.com">documentation</a></li>
26+
<li><a href="https://donate.getpelican.com">contribute</a></li>
27+
<li><a href="/pages/gratitude.html">gratitude</a></li>
28+
</ul></nav>
29+
</header><!-- /#banner -->
30+
<section id="content" class="body">
31+
<article>
32+
<header>
33+
<h1 class="entry-title">
34+
<a href="https://blog.getpelican.com/pelican-4.7-released.html" rel="bookmark" title="Permalink to Pelican 4.7 released">Pelican 4.7 released</a></h1>
35+
</header>
36+
37+
<div class="entry-content">
38+
<footer class="post-info">
39+
<abbr class="published" title="2021-10-01T00:00:00+02:00">
40+
Fri 01 October 2021
41+
</abbr>
42+
43+
<address class="vcard author">
44+
By <a class="url fn" href="https://blog.getpelican.com/author/pelican-contributors.html">Pelican Contributors</a>
45+
</address>
46+
<p>In <a href="https://blog.getpelican.com/category/news.html">news</a>. </p>
47+
48+
</footer><!-- /.post-info --> <p>Pelican 4.7 is now available. This new release includes the following enhancements, fixes, and tweaks:</p>
49+
<ul class="simple">
50+
<li>Improve default theme rendering on mobile and other small screen devices <a class="reference external" href="https://github.com/getpelican/pelican/pull/2914">(#2914)</a></li>
51+
</ul>
52+
<p>For more info, please refer to the release page.</p>
53+
<div class="section" id="upgrading-from-previous-releases">
54+
<h2>Upgrading from previous releases</h2>
55+
<p>Upgrading from Pelican 4.6.x should be smooth and require few (if any) changes to
56+
your environment.</p>
57+
<p>If you run into problems, please see the <a class="reference external" href="https://docs.getpelican.com/en/latest/contribute.html#how-to-get-help">How to Get Help</a> section
58+
of the documentation, and we will update this post with any upgrade tips
59+
contributed by the Pelican community.</p>
60+
</div>
61+
62+
</div><!-- /.entry-content -->
63+
64+
</article>
65+
</section>
66+
<section id="extras" class="body">
67+
<div class="blogroll">
68+
<h2>links</h2>
69+
<ul>
70+
<li><a href="https://docs.getpelican.com/">Pelican Docs</a></li>
71+
<li><a href="https://donate.getpelican.com/">Support Pelican</a></li>
72+
<li><a href="https://justinmayer.com/">Justin Mayer</a></li>
73+
</ul>
74+
</div><!-- /.blogroll -->
75+
<div class="social">
76+
<h2>follow</h2>
77+
<ul>
78+
<li><a href="https://blog.getpelican.com/feeds/all.atom.xml" type="application/atom+xml" rel="alternate">atom feed</a></li>
79+
80+
<li><a href="https://twitter.com/getpelican">@getpelican</a></li>
81+
<li><a href="https://twitter.com/jmayer">@jmayer</a></li>
82+
<li><a href="https://github.com/getpelican">github</a></li>
83+
</ul>
84+
</div><!-- /.social -->
85+
</section><!-- /#extras -->
86+
87+
<footer id="contentinfo" class="body">
88+
<address id="about" class="vcard body">
89+
Proudly powered by <a href="http://getpelican.com/">Pelican</a>, which takes great advantage of <a href="http://python.org">Python</a>.
90+
</address><!-- /#about -->
91+
92+
<p>The theme is by <a href="http://coding.smashingmagazine.com/2009/08/04/designing-a-html-5-layout-from-scratch/">Smashing Magazine</a>, thanks!</p>
93+
</footer><!-- /#contentinfo -->
94+
95+
<script>(function(f,a,t,h,o,m){a[h]=a[h]||function(){(a[h].q=a[h].q||[]).push(arguments)};o=f.createElement('script'),m=f.getElementsByTagName('script')[0];o.async=1;o.src=t;o.id='fathom-script';m.parentNode.insertBefore(o,m)})(document,window,'https://stats.justinmayer.com/tracker.js','fathom');fathom('set','siteId','EWNWB');fathom('trackPageview');</script>
96+
<script type="text/javascript">var _gaq=_gaq||[];_gaq.push(['_setAccount','UA-295694-7']);_gaq.push(['_trackPageview']);(function(){var ga=document.createElement('script');ga.type='text/javascript';ga.async=true;ga.src=('https:'==document.location.protocol?'https://ssl':'http://www')+'.google-analytics.com/ga.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga,s);})();</script>
97+
</body>
98+
</html>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[
2+
{
3+
"path": "index.html",
4+
"title": "Pelican Development Blog",
5+
"sections": [
6+
{
7+
"id": "banner",
8+
"title": "Pelican Development Blog",
9+
"content": ""
10+
},
11+
{
12+
"id": "",
13+
"title": "Pelican 4.7 released",
14+
"content": "Fri 01 October 2021 By Pelican Contributors In news. Pelican 4.7 is now available. This new release includes the following enhancements, fixes, and tweaks: Improve default theme rendering on mobile and other small screen devices (#2914) For more info, please refer to the release page."
15+
},
16+
{
17+
"id": "upgrading-from-previous-releases",
18+
"title": "Upgrading from previous releases",
19+
"content": "Upgrading from Pelican 4.6.x should be smooth and require few (if any) changes to your environment. If you run into problems, please see the How to Get Help section of the documentation, and we will update this post with any upgrade tips contributed by the Pelican community."
20+
},
21+
{
22+
"id": "",
23+
"title": "links",
24+
"content": "Pelican Docs Support Pelican Justin Mayer"
25+
},
26+
{
27+
"id": "",
28+
"title": "follow",
29+
"content": "atom feed @getpelican @jmayer github"
30+
}
31+
],
32+
"domain_data": {}
33+
}
34+
]

readthedocs/search/tests/test_parsers.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,3 +303,22 @@ def test_generic_simple_page(self, storage_open, storage_exists):
303303
parsed_json = [file.processed_json]
304304
expected_json = json.load(open(data_path / "generic/out/basic.json"))
305305
assert parsed_json == expected_json
306+
307+
@mock.patch.object(BuildMediaFileSystemStorage, "exists")
308+
@mock.patch.object(BuildMediaFileSystemStorage, "open")
309+
def test_generic_pelican_default_theme(self, storage_open, storage_exists):
310+
file = data_path / "pelican/in/default/index.html"
311+
storage_exists.return_value = True
312+
self.version.documentation_type = GENERIC
313+
self.version.save()
314+
315+
storage_open.side_effect = self._mock_open(file.open().read())
316+
file = get(
317+
HTMLFile,
318+
project=self.project,
319+
version=self.version,
320+
path="index.html",
321+
)
322+
parsed_json = [file.processed_json]
323+
expected_json = json.load(open(data_path / "pelican/out/default.json"))
324+
assert parsed_json == expected_json

readthedocs/subscriptions/signals.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,3 @@ def update_billing_information(sender, instance, created, **kwargs):
5151
log.exception('Unable to update the Organization billing email on Stripe.')
5252
except Exception:
5353
log.exception('Unknown error when updating Organization billing email on Stripe.')
54-
55-
56-
# pylint: disable=unused-argument
57-
@receiver(pre_delete, sender=Organization)
58-
def remove_subscription(sender, instance, using, **kwargs):
59-
"""
60-
Deletes the subscription object and cancels it from Stripe.
61-
62-
This is used as complement to ``remove_organization_completely``.
63-
"""
64-
organization = instance
65-
try:
66-
subscription = organization.subscription
67-
subscription.delete()
68-
except Subscription.DoesNotExist:
69-
log.error(
70-
"Organization doesn't have a subscription to cancel.",
71-
organization_slug=organization.slug,
72-
)

0 commit comments

Comments
 (0)