def test_save_and_retrieve_all_urls_for_c(self): """ Test get_all_urls function, for new language - c, after adding it to DB """ data = {"urls": ["c_url1", "c_url2"], "c_url1": {"type": "class", "name": "section"}, "c_url2": {"type": "id", "name": "content"}} ce = ContributionEngine("C", "") ce.add_urls_for_language(data) res = get_urls_for_language("C") self.assertEqual(data["urls"], res)
def test_save_and_retrieve_all_details_for_url_c(self): """ Test get all details about url, after saving it in DB using 'add_urls_for_language' function """ data = {"urls": ["c_url1", "c_url2"], "c_url1": {"type": "class", "name": "section"}, "c_url2": {"type": "id", "name": "content"}} ce = ContributionEngine("C", "") ce.add_urls_for_language(data) _type, name = get_details_about_url("c_url1") self.assertEqual(_type, "class") self.assertEqual(name, "section") _type, name = get_details_about_url("c_url2") self.assertEqual(_type, "id") self.assertEqual(name, "content") _type, name = get_details_about_url("https://wiki.python.org") self.assertEqual(_type, "id") self.assertEqual(name, "content")