Merge pull request #186 from mozilla/182-release-notes-handle-coming-soon

Handle the coming soon state for release notes.
This commit is contained in:
Rémy HUBSCHER 2018-01-31 18:02:36 +01:00 коммит произвёл GitHub
Родитель 6e0bb1f674 bcf12419cf
Коммит 2779318048
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 42 добавлений и 2 удалений

Просмотреть файл

@ -6,7 +6,7 @@ CHANGELOG
- Order checks putting non actionable checks at the end. (#163)
- Use main_summary instead of update_parquet for the Telemetry uptake (#172)
- Handle `coming soon` release notes status (#182)
0.6.1 (2017-12-20)

Просмотреть файл

@ -32,8 +32,13 @@ async def release_notes(product, full_version):
localized_count = 0
http_count = 0
coming_soon = False
if body:
if 'are coming soon!' in body:
coming_soon = True
d = pq(body)
domains = ['https://addons.mozilla.org',
@ -63,7 +68,10 @@ async def release_notes(product, full_version):
'links' if localized_count > 1 else 'link')
status = Status.INCOMPLETE
if localized_count and http_count:
if coming_soon:
exists_message += ' but show a `coming soon` message.'
status = Status.INCOMPLETE
elif localized_count and http_count:
exists_message += ' and '
elif http_count:
exists_message += ' but '
@ -75,6 +83,7 @@ async def release_notes(product, full_version):
exists_message = exists_message.format(http_count,
'links' if localized_count > 1 else 'link')
status = Status.INCOMPLETE
return build_task_response(status, url, exists_message, missing_message)

Просмотреть файл

@ -146,6 +146,37 @@ class DeliveryTasksTest(asynctest.TestCase):
"the URL and 1 link should use the HTTPS protocol "
"rather than HTTP.")
async def test_releasenotes_tasks_returns_incomplete_if_coming_soon(self):
url = ('https://hg.mozilla.org/mozilla-central/raw-file/tip/browser/locales/all-locales')
self.mocked.get(url, status=200, body=SHIPPED_LOCALES_BODY)
url = 'https://www.mozilla.org/en-US/firefox/60.0a1/releasenotes/'
self.mocked.get(url, status=200,
body='''
<html>
<body>
<div id="main-content">
<div class="latest-release" >
<div class="container">
<div class="version">
<h2>60.0a1</h2>
<h3>Firefox Nightly</h3>
</div>
<div class="description">
<h2>The notes for this release are not yet publicly available,
but are coming soon! Please check this page again later.</h2>
</div>
</div>
</div>
</div>
</body>
</html>
''')
received = await release_notes('firefox', '60.0a1')
assert received["status"] == Status.INCOMPLETE.value
assert received["message"] == ("Release notes were found for version 60.0a1 "
"but show a `coming soon` message.")
async def test_releasenotes_tasks_strip_esr_from_version_number(self):
url = 'https://www.mozilla.org/en-US/firefox/52.3.0/releasenotes/'
self.mocked.get(url, status=200)