From ad12eb982dc318f796a6ae19a58b348aeacf7c6a Mon Sep 17 00:00:00 2001 From: Lingamuneni Santhosh Siddhardha <103999924+Santhosh-Siddhardha@users.noreply.github.com> Date: Thu, 6 Jun 2024 12:00:15 +0530 Subject: [PATCH] Added banners_test.py Added test file for banners module --- src/test/banners_test.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/test/banners_test.py diff --git a/src/test/banners_test.py b/src/test/banners_test.py new file mode 100644 index 00000000..288b86d4 --- /dev/null +++ b/src/test/banners_test.py @@ -0,0 +1,33 @@ +import unittest +from src.scrape_up.banners import Scraper88x31 + + +class TestScraper88x31(unittest.TestCase): + + def setUp(self): + """ + Initialize a Scraper88x31 instance before each test method. + """ + self.scraper = Scraper88x31() + + def test_get_all(self): + """ + | Methods | Details | + | ------------------ | -------------------------------------------------------- | + | `get_all()` | Returns the list of all available 88x31 banners | + """ + try: + banners = self.scraper.get_all() + + # Check if banners is a list of URLs + self.assertIsInstance(banners, list) + for banner in banners: + self.assertIsInstance(banner, str) + self.assertTrue(banner.startswith("https://cyber.dabamos.de/88x31/")) + self.assertTrue(banner.endswith(".gif")) + except: + return None + + +if __name__ == "__main__": + unittest.main()