Example #1
0
 def read(self, iprot):
     if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(
             iprot.trans, TTransport.CReadableTransport
     ) and self.thrift_spec is not None and fastbinary is not None:
         fastbinary.decode_binary(self, iprot.trans,
                                  (self.__class__, self.thrift_spec))
         return
     iprot.readStructBegin()
     while True:
         (fname, ftype, fid) = iprot.readFieldBegin()
         if ftype == TType.STOP:
             break
         if fid == 0:
             if ftype == TType.STRING:
                 self.success = iprot.readString()
             else:
                 iprot.skip(ftype)
         elif fid == 1:
             if ftype == TType.STRUCT:
                 self.userException = EDAMUserException()
                 self.userException.read(iprot)
             else:
                 iprot.skip(ftype)
         elif fid == 2:
             if ftype == TType.STRUCT:
                 self.systemException = EDAMSystemException()
                 self.systemException.read(iprot)
             else:
                 iprot.skip(ftype)
         else:
             iprot.skip(ftype)
         iprot.readFieldEnd()
     iprot.readStructEnd()
Example #2
0
 def authenticateLongSessionV2(
     self,
     username,
     password,
     ssoLoginToken,
     consumerKey,
     consumerSecret,
     deviceIdentifier,
     deviceDescription,
     supportsTwoFactor,
     supportsBusinessOnlyAccounts,
 ):
     if self.fake_values.fake_auth_unexpected_error:
         raise EDAMUserException()
     if self.fake_values.fake_auth_invalid_pass or (
         self.fake_values.fake_valid_password
         and self.fake_values.fake_valid_password != password
     ):
         raise EDAMUserException(
             errorCode=EDAMErrorCode.INVALID_AUTH, parameter="password"
         )
     if self.fake_values.fake_auth_invalid_name or (
         self.fake_values.fake_valid_username
         and self.fake_values.fake_valid_username != username
     ):
         raise EDAMUserException(
             errorCode=EDAMErrorCode.INVALID_AUTH, parameter="username"
         )
     return MagicMock(
         secondFactorRequired=self.fake_values.fake_twofactor_req,
         secondFactorDeliveryHint=self.fake_values.fake_twofactor_hint,
         authenticationToken=self.fake_values.fake_auth_token,
     )
Example #3
0
 def completeTwoFactorAuthentication(
     self,
     authenticationToken,
     oneTimeCode,
     deviceIdentifier,
     deviceDescription,
 ):
     if self.fake_values.fake_auth_twofactor_unexpected_error:
         raise EDAMUserException()
     if self.fake_values.fake_auth_invalid_ota:
         raise EDAMUserException(errorCode=EDAMErrorCode.INVALID_AUTH,
                                 parameter="oneTimeCode")
     return MagicMock(
         authenticationToken=self.fake_values.fake_auth_token, )
Example #4
0
 def read(self, iprot):
     if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
         fastbinary.decode_binary(self, iprot.trans,
                                  (self.__class__, self.thrift_spec))
         return
     iprot.readStructBegin()
     while True:
         (fname, ftype, fid) = iprot.readFieldBegin()
         if ftype == TType.STOP:
             break
         if fid == 0:
             if ftype == TType.STRING:
                 self.success = iprot.readString()
             else:
                 iprot.skip(ftype)
         elif fid == 1:
             if ftype == TType.STRUCT:
                 self.userException = EDAMUserException()
                 self.userException.read(iprot)
             else:
                 iprot.skip(ftype)
         elif fid == 2:
             if ftype == TType.STRUCT:
                 self.systemException = EDAMSystemException()
                 self.systemException.read(iprot)
             else:
                 iprot.skip(ftype)
         else:
             iprot.skip(ftype)
         iprot.readFieldEnd()
     iprot.readStructEnd()
Example #5
0
    def getUser(self, authenticationToken):
        if self.fake_values.fake_network_counter > 0:
            self.fake_values.fake_network_counter -= 1
            raise ConnectionError

        if self.fake_values.fake_auth_verify_unexpected_error:
            raise EDAMUserException()
        if self.fake_values.fake_is_token_expired:
            raise EDAMUserException(errorCode=EDAMErrorCode.AUTH_EXPIRED,
                                    parameter="authenticationToken")
        if self.fake_values.fake_is_token_invalid:
            raise EDAMUserException(errorCode=EDAMErrorCode.INVALID_AUTH,
                                    parameter="authenticationToken")
        if self.fake_values.fake_is_token_bad:
            raise EDAMSystemException(errorCode=EDAMErrorCode.BAD_DATA_FORMAT,
                                      message="authenticationToken")
        return MagicMock(username=self.fake_values.fake_user)
Example #6
0
class getNoteStoreUrl_result(object):
    """
    Attributes:
     - success
     - userException
     - systemException
    """

    thrift_spec = ((
        0,
        TType.STRING,
        'success',
        None,
        None,
    ), (
        1,
        TType.STRUCT,
        'userException',
        (EDAMUserException, EDAMUserException.thrift_spec),
        None,
    ), (
        2,
        TType.STRUCT,
        'systemException',
        (EDAMSystemException, EDAMSystemException.thrift_spec),
        None,
    ))

    def __init__(
        self,
        success=None,
        userException=None,
        systemException=None,
    ):
        self.success = success
        self.userException = userException
        self.systemException = systemException

    def read(self, iprot):
        if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(
                iprot.trans, TTransport.CReadableTransport
        ) and self.thrift_spec is not None and fastbinary is not None:
            fastbinary.decode_binary(self, iprot.trans,
                                     (self.__class__, self.thrift_spec))
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 0:
                if ftype == TType.STRING:
                    self.success = iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 1:
                if ftype == TType.STRUCT:
                    self.userException = EDAMUserException()
                    self.userException.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRUCT:
                    self.systemException = EDAMSystemException()
                    self.systemException.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated:
            if self.thrift_spec is not None and fastbinary is not None:
                oprot.trans.write(
                    fastbinary.encode_binary(
                        self, (self.__class__, self.thrift_spec)))
                return
        oprot.writeStructBegin('getNoteStoreUrl_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.STRING, 0)
            oprot.writeString(self.success)
            oprot.writeFieldEnd()
        if self.userException is not None:
            oprot.writeFieldBegin('userException', TType.STRUCT, 1)
            self.userException.write(oprot)
            oprot.writeFieldEnd()
        if self.systemException is not None:
            oprot.writeFieldBegin('systemException', TType.STRUCT, 2)
            self.systemException.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value) for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other,
                          self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
Example #7
0
class getNoteStoreUrl_result(object):
    """
    Attributes:
     - success
     - userException
     - systemException
    """

    thrift_spec = (
        (0, TType.STRING, 'success', None, None,),
        (1, TType.STRUCT, 'userException', (EDAMUserException,
                                            EDAMUserException.thrift_spec), None,),
        (2, TType.STRUCT, 'systemException', (EDAMSystemException, EDAMSystemException.thrift_spec), None,)
    )

    def __init__(self, success=None, userException=None, systemException=None,):
        self.success = success
        self.userException = userException
        self.systemException = systemException

    def read(self, iprot):
        if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
            fastbinary.decode_binary(self, iprot.trans,
                                     (self.__class__, self.thrift_spec))
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 0:
                if ftype == TType.STRING:
                    self.success = iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 1:
                if ftype == TType.STRUCT:
                    self.userException = EDAMUserException()
                    self.userException.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRUCT:
                    self.systemException = EDAMSystemException()
                    self.systemException.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated:
            if self.thrift_spec is not None and fastbinary is not None:
                oprot.trans.write(fastbinary.encode_binary(self, (self.__class__,
                                                                  self.thrift_spec)))
                return
        oprot.writeStructBegin('getNoteStoreUrl_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.STRING, 0)
            oprot.writeString(self.success)
            oprot.writeFieldEnd()
        if self.userException is not None:
            oprot.writeFieldBegin('userException', TType.STRUCT, 1)
            self.userException.write(oprot)
            oprot.writeFieldEnd()
        if self.systemException is not None:
            oprot.writeFieldBegin('systemException', TType.STRUCT, 2)
            self.systemException.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.iteritems()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)