def testSomeContent(self): some_content = { "lang": "bad", "somevar": True, "Othervar": 1, "langage": "en", "profile": "story", "has": "audio", } with self.assertRaises(BadQuery): make_query(self.test_template, some_content)
def testGoodContent(self): good_content = {"language": "en", "profile": "story", "has": "audio"} result = make_query(self.test_template, good_content) self.assertIn("language=en", result) self.assertIn("profile=story", result) self.assertIn("has=audio", result) self.assertIn("?", result)
def testBadContent(self): bad_content = {"lang": "bad", "somevar": True, "Othervar": 1} with self.assertRaises(BadQuery): make_query(self.test_template, bad_content)
def testNoContent(self): no_content = {} expected = self.test_template.split("{?")[0] self.assertEqual(make_query(self.test_template, no_content), expected)