|
1 | 1 | """docstring"""
|
| 2 | +import unittest |
2 | 3 | from bs4 import BeautifulSoup
|
3 | 4 |
|
4 | 5 |
|
5 |
| -with open("tests/test_cuckoo.html") as f: |
6 |
| - soup = BeautifulSoup(f.read(), 'html.parser') |
7 |
| - information = soup.find(id="information") |
8 |
| - print("--------------informations--------------") |
9 |
| - for ch in information.find(class_="panel-body"): |
10 |
| - if len(ch.string.strip()) > 0: |
| 6 | +def test_cuckoo(): |
| 7 | + with open("tests/test_cuckoo.html") as f: |
| 8 | + soup = BeautifulSoup(f.read(), 'html.parser') |
| 9 | + information = soup.find(id="information") |
| 10 | + print("--------------informations--------------") |
| 11 | + for ch in information.find(class_="panel-body"): |
| 12 | + if len(ch.string.strip()) > 0: |
| 13 | + print(ch.string.strip()) |
| 14 | + all_sig = soup.find(id="signatures") |
| 15 | + print("----------------warnings----------------") |
| 16 | + for ch in all_sig.find_all("div", class_="alert-warning"): |
11 | 17 | print(ch.string.strip())
|
12 |
| - all_sig = soup.find(id="signatures") |
13 |
| - print("----------------warnings----------------") |
14 |
| - for ch in all_sig.find_all("div", class_="alert-warning"): |
15 |
| - print(ch.string.strip()) |
16 |
| - print("-----------------errors-----------------") |
17 |
| - for ch in all_sig.find_all("div", class_="alert-danger"): |
18 |
| - print(ch.string.strip()) |
| 18 | + print("-----------------errors-----------------") |
| 19 | + for ch in all_sig.find_all("div", class_="alert-danger"): |
| 20 | + print(ch.string.strip()) |
| 21 | + |
| 22 | +if __name__ == "__main__": |
| 23 | + testcase = unittest.FunctionTestCase(test_cuckoo) |
| 24 | + unittest.main() |
0 commit comments