| Index: app_test.py
|
| diff --git a/app_test.py b/app_test.py
|
| index 5aaaf4d5d47bcffdf8fb350265c59b07b86c3f10..664fec6f464ee14cea57d63f039680ac77f55a3b 100644
|
| --- a/app_test.py
|
| +++ b/app_test.py
|
| @@ -5,10 +5,12 @@
|
|
|
| import ast
|
| import datetime
|
| +import json
|
| import os
|
| import unittest
|
|
|
| import app
|
| +from third_party.BeautifulSoup.BeautifulSoup import BeautifulSoup
|
|
|
|
|
| TEST_DIR = os.path.join(os.path.dirname(__file__), 'tests')
|
| @@ -473,3 +475,38 @@ class FetchTestCase(GaeTestCase):
|
| 'http://build.chromium.org/p/chromium/console/../',
|
| page['offsite_base'])
|
| self.assertEquals('BuildBot: Chromium', page['title'])
|
| +
|
| +
|
| +class MailTestCase(GaeTestCase):
|
| + def test_html_format(self):
|
| + import gatekeeper_mailer
|
| + test_dir = os.path.join(TEST_DIR, 'test_mailer')
|
| + with open(os.path.join(test_dir, 'input.json')) as f:
|
| + input_json = json.load(f)
|
| + build_data = json.loads(input_json['message'])
|
| + template = gatekeeper_mailer.MailTemplate(build_data['waterfall_url'],
|
| + build_data['build_url'],
|
| + build_data['project_name'],
|
| + 'test@chromium.org')
|
| +
|
| + _, html_content, _ = template.genMessageContent(build_data)
|
| +
|
| + with open(os.path.join(test_dir, 'expected.html')) as f:
|
| + expected_html = ' '.join(f.read().splitlines())
|
| +
|
| + self.assertEquals(' '.join(str(BeautifulSoup(html_content)).split()),
|
| + ' '.join(str(BeautifulSoup(expected_html)).split()))
|
| +
|
| + def test_hmac_validation(self):
|
| + pass
|
| +
|
| + def test_blob(self):
|
| + from webtest import TestApp
|
| + import handler
|
| + localpath = 'test' # The app prepends /p/.
|
| + content = 'Test.'
|
| + self.save_page(localpath=localpath, content=content)
|
| + testapp = TestApp(handler.application)
|
| + response = testapp.get('/p/test')
|
| + self.assertEquals('200 OK', response.status)
|
| + self.assertEquals('Test.', response.body)
|
|
|