Exemplo n.º 1
0
def post():
    user = None
    try:
        user = Util.getUserObject(request.json)
    except:
        abort(400, description=f"Request not give a valid user object: {request.json}")

    utility.storage.addUser(user)

    data = {"success": True}
    return jsonify(data)
Exemplo n.º 2
0
    def from_dict(cls, tokenDict: dict):
        """
        Returns a token object from a dict.
        """
        from RDS import Util

        return cls(
            Util.getUserObject(tokenDict["user"]),
            Util.getServiceObject(tokenDict["service"]),
            tokenDict["access_token"],
        )
Exemplo n.º 3
0
 def test_init_objects(self):
     self.assertEqual(Util.getServiceObject(json.dumps(self.oauthservice1)),
                      self.oauthservice1)
     svc1 = LoginService("MusterService", ["fileStorage"])
     self.assertEqual(Util.getServiceObject(json.dumps(svc1)), svc1)
     self.assertNotEqual(
         Util.getServiceObject(json.dumps(svc1)).__class__,
         self.oauthservice1.__class__)
     self.assertEqual(Util.getUserObject(json.dumps(self.user1)),
                      self.user1)
     self.assertEqual(Util.getTokenObject(json.dumps(self.token1)),
                      self.token1)