Exemplo n.º 1
0
 def delete(self, user_id):
     user = MinespaceUser.find_by_id(user_id)
     if not user:
         raise NotFound("user not found")
     for um in user.mines:
         db.session.delete(um)
     db.session.commit()
     db.session.delete(user)
     db.session.commit()
     return ('', 204)
Exemplo n.º 2
0
 def delete(self, user_id=None, mine_guid=None):
     if not user_id or not mine_guid:
         raise BadRequest("user_guid or mine_guid not found")
     user = MinespaceUser.find_by_id(user_id)
     if not user:
         raise NotFound("user not found")
     found = False
     for mum in user.mines:
         if str(mum.mine_guid) == mine_guid:
             db.session.delete(mum)
             found = True
             break
     if not found:
         raise NotFound('user is not related to the provided mine')
     user.save()
     return ('', 204)
Exemplo n.º 3
0
 def get(self, user_id):
     user = MinespaceUser.find_by_id(user_id)
     if not user:
         raise NotFound("user not found")
     return user
Exemplo n.º 4
0
def test_minespace_user_model_find_by_id(db_session):
    user = MinespaceUserFactory()

    mu = MinespaceUser.find_by_id(user.user_id)
    assert mu.email == user.email