53 lines
2 KiB
Python
53 lines
2 KiB
Python
import unittest
|
|
|
|
from app.terraform.block_external import BlockExternalAutomation
|
|
|
|
|
|
class TestBlockExternalAutomation(unittest.TestCase):
|
|
def test_parse(self):
|
|
content = b"""
|
|
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<!-- Required meta tags -->
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
|
|
<title>Mirrors Availability</title>
|
|
</head>
|
|
<body>
|
|
<div class="col-lg-8 mx-auto p-3 py-md-5">
|
|
<main>
|
|
<div class="text-center">
|
|
<h1>RFE/RL Mirror Sites Availability</h1>
|
|
<h2 class="mt-4">Farajaland</h2>
|
|
<p class="text-muted">Updated at 2023-03-30 15:46:03 CET</p>
|
|
<div class="overflow-auto mb-5">
|
|
<table class="table table-striped table-responsive-sm">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">Service</th>
|
|
<th scope="col">Hostname</th>
|
|
<th scope="col">Error</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>example.com</td>
|
|
<td><a href="http://example.net" target="_blank">example.net</a></td>
|
|
<td>Connection Error</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
</div>
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
|
|
</body>
|
|
</html>
|
|
"""
|
|
block_external = BlockExternalAutomation()
|
|
block_external._content = content
|
|
block_external.parse()
|
|
self.assertEqual(block_external.patterns, ['https://example.net'])
|