Esempio n. 1
0
    def test_get_person(self):
        self.assertRaises(PersonNotFoundException, person_info.get_person,
                          "wrong-id")
        person = person_info.get_person(self.person_id)
        self.assertEqual(self.person_id, person.id)
        person.delete()

        self.assertRaises(PersonNotFoundException, person_info.get_person,
                          self.person_id)
Esempio n. 2
0
    def post(self):
        (email, password) = self.get_arguments()
        try:
            auth.check_credentials(email, password)

            user = auth.get_user_by_email(email)
            login_user(user)

            person = person_info.get_person(current_user.id)
            return {"login": True, "user": person.serialize()}
        except PersonNotFoundException:
            print("not registered")
            return {"login": False}, 400
        except auth.WrongPasswordException:
            print("wrong password")
            return {"login": False}, 400
Esempio n. 3
0
 def assign_task(self, task_id, person_id):
     task = task_info.get_task(task_id)
     person = person_info.get_person(person_id)
     return task_info.assign_task(task, person)
Esempio n. 4
0
 def is_exist(self, person_id):
     return person_info.get_person(person_id) is not None
Esempio n. 5
0
 def get(self):
     person = person_info.get_person(current_user.id)
     return {"authenticated": True, "user": person.serialize()}
Esempio n. 6
0
def load_user(user_id):
    try:
        person = person_info.get_person(user_id)
        return person_to_user(person)
    except PersonNotFoundException:
        return None
Esempio n. 7
0
 def test_load_user(self):
     person = person_info.get_person(self.person.id)
     self.assertEqual(person.id, self.person.id)
     person.delete()
     self.assertRaises(PersonNotFoundException, person_info.get_person,
                       self.person.id)