|
1 | 1 | # Healthcheck Bot
|
2 | 2 | # Copyright (C) 2018 Dmitry Berezovsky
|
3 |
| -# |
| 3 | +# |
4 | 4 | # HealthcheckBot is free software: you can redistribute it and/or modify
|
5 | 5 | # it under the terms of the GNU General Public License as published by
|
6 | 6 | # the Free Software Foundation, either version 3 of the License, or
|
7 | 7 | # (at your option) any later version.
|
8 |
| -# |
| 8 | +# |
9 | 9 | # HealthcheckBot is distributed in the hope that it will be useful,
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 | 12 | # GNU General Public License for more details.
|
13 |
| -# |
| 13 | +# |
14 | 14 | # You should have received a copy of the GNU General Public License
|
15 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16 | 16 |
|
|
22 | 22 |
|
23 | 23 |
|
24 | 24 | class TitleAssert(WatcherAssert):
|
25 |
| - |
26 | 25 | def __init__(self, application):
|
27 | 26 | super().__init__(application)
|
28 | 27 | self.expected_title = None
|
29 | 28 |
|
30 |
| - def do_assert(self, state: requests.Response, reporter: ValidationReporter, assertion_name: str): |
31 |
| - soup = BeautifulSoup(state.content, 'html.parser') |
| 29 | + def do_assert( |
| 30 | + self, |
| 31 | + state: requests.Response, |
| 32 | + reporter: ValidationReporter, |
| 33 | + assertion_name: str, |
| 34 | + ): |
| 35 | + soup = BeautifulSoup(state.content, "html.parser") |
32 | 36 | actual_title = soup.title.string if soup.title else None
|
33 | 37 | if actual_title != self.expected_title:
|
34 |
| - reporter.error(assertion_name, |
35 |
| - 'Expected title is "{}" but actual is "{}"'.format(self.expected_title, actual_title)) |
| 38 | + reporter.error( |
| 39 | + assertion_name, |
| 40 | + 'Expected title is "{}" but actual is "{}"'.format(self.expected_title, actual_title), |
| 41 | + ) |
36 | 42 |
|
37 |
| - PARAMS = ( |
38 |
| - ParameterDef('expected_title', is_required=True, validators=(validators.string,)), |
39 |
| - ) |
| 43 | + PARAMS = (ParameterDef("expected_title", is_required=True, validators=(validators.string,)),) |
0 commit comments