def test_process_single_image(self): self.save_picture() mood_service = MoodService() mood_process = mood_service.perfom_mood_detection("12345") mood_process_get = mood_service.get_mood("12345") self.assertEqual(1, len(mood_process.faces)) self.assertEqual(1, len(mood_process_get.faces)) self.assertEqual(mood_process.faces[0].mood, mood_process_get.faces[0].mood)
class Mood(Resource): def __init__(self): self.mood_service = MoodService() def get(self, uid): mood_process = self.mood_service.get_mood(uid) return mood_process.to_json() def put(self, uid): mood_process = self.mood_service.perfom_mood_detection(uid) return mood_process.to_json()
def test_get_mood_process(self): self.save_picture() mood_service = MoodService() mood_process = mood_service.get_mood("12345") self.assertEqual(2, len(mood_process.faces))