Skip to content
Snippets Groups Projects
Commit b592868b authored by borzechof99's avatar borzechof99 :whale2:
Browse files

Move Course Scraper into quiz

parent 909a747e
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@ for http://www.buchsys.de for SWP UniSport-O-Mat.
import requests
from bs4 import BeautifulSoup
from collections import OrderedDict
def fetch_website(url):
......@@ -27,14 +28,14 @@ def fetch_website(url):
raise
def scraping(site=None) -> dict:
def scraping(site=None) -> OrderedDict:
"""
Returns a dictionary of the form {name: link},
containing the scraped content of
https://www.buchsys.de/fu-berlin/angebote/aktueller_zeitraum/index.html,
unless another URL is given as an argument.
"""
courses = {}
courses = OrderedDict()
if site is None:
site = "https://www.buchsys.de/fu-berlin/angebote/aktueller_zeitraum/"
......
......@@ -3,6 +3,7 @@ Testing module, yo. Just for the course_scraper.py.
"""
from django.test import TestCase
from course_scraper import scraping # , fetch_website
from collections import OrderedDict
class ScraperTestCase(TestCase):
......@@ -15,7 +16,7 @@ class ScraperTestCase(TestCase):
"""
Testing return type of scraping().
"""
self.assertIsInstance(scraping(), dict)
self.assertIsInstance(scraping(), OrderedDict)
def test_dict_not_empty(self):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment