def test_school_fail(self): schoolData = DBProcessing() result = schoolData.getSchoolInfo('ineverwentthere') self.assertTrue(result is not None, "expected a result object") self.assertTrue(type(result) == dict, "expected a dictionary") self.assertTrue('degree' in result, "expected a degree tag") self.assertTrue('description' in result, "expected a description tag") self.assertTrue('date' in result, "expected a date tag") self.assertTrue('location' in result, "expected a location tag") self.assertTrue('name' in result, "expected a name tag") self.assertEqual( result['name'], 'ineverwentthere', 'expected "ineverwentthere" instead got %s' % result['name'])
def test_school_success_rpi(self): schoolData = DBProcessing() result = schoolData.getSchoolInfo('rpi') self.assertTrue(result is not None, "expected a result object") self.assertTrue(type(result) == dict, "expected a dictionary") self.assertTrue('degree' in result, "expected a degree tag") self.assertTrue('description' in result, "expected a description tag") self.assertTrue('date' in result, "expected a date tag") self.assertTrue('location' in result, "expected a location tag") self.assertTrue('name' in result, "expected a name tag") self.assertEqual( result['name'], 'Rensselaer Polytechnic Institute', 'expected "Rensselaer Polytechnic Institute" instead got %s' % result['name'])
def test_school_success_cmu(self): schoolData = DBProcessing() result = schoolData.getSchoolInfo('cmu') self.assertTrue(result is not None, "expected a result object") self.assertTrue(type(result) == dict, "expected a dictionary") self.assertTrue('degree' in result, "expected a degree tag") self.assertTrue('description' in result, "expected a description tag") self.assertTrue('date' in result, "expected a date tag") self.assertTrue('location' in result, "expected a location tag") self.assertTrue('name' in result, "expected a name tag") self.assertEqual( result['name'], 'Carnegie-Mellon University', 'expected "Carnegie-Mellon University" instead got %s' % result['name'])
def getSchoolInfo(schoolname): schoolData = DBProcessing() return dumps(schoolData.getSchoolInfo(schoolname))