Skip to content
Cedric Brancourt edited this page Jun 19, 2014 · 3 revisions

Behaviour specifications

OpenObject
  for common context
    .common_client
      build new XMLRPC connection client Proxy
    .login
      with wrong database name
        response.success : false
        response.errors : FATAL:  database "dbname" does not exist
      with wrong user name and/or password
        response.success : false
      on successful authentication request
        response.content.class = Fixnum (user id)
        response.content == 2 (expected user id)
        behaves like any successful request
          response.success : true
          behaves like any request
            response.class == OpenObject::BackendResponse

reciever model
  should respond to .open_object_model
  .open_object_model_name
    when not defined in model
      should be a string
      should be humanized model name
    .set_open_object_mode('another_name')
      should set the open_object model name with the given string
  .connection(user_context:{dbname:String,uid:Fixnum,pwd:String})
    should build a new XMLRPC connection
  .search(user_context, args = [], limit:Fixnum, offset:Fixnum)
    with offset and limit parameters
      invokes execute with model_name, search, [params], offset,limit
    with limit parameter (missing offset)
      invokes execute with model_name, search, [params], offset :0, limit
    with offset parameter (missing limit)
      invokes execute with model_name, search, [params], offset, limit: 0
    without limit and offset
      invokes execute with model_name, search, [params], 0, 0
      behaves like any object request
        creates connection with context
    with order parameter
      invokes execute with model_name, search, [params], 0, 0, order
    successful request
      response.content should be an Array
      behaves like any successful request
        response.success : true
        behaves like any request
          response.class == OpenObject::BackendResponse
    failed request
      behaves like any failed request
        response.success : false
        response.errors[:faultCode] Server faultCode
        response.errors[:faultString] Server faultString
        behaves like any request
          response.class == OpenObject::BackendResponse
  .read(user_context,[ids],[fields])
    invokes execute with model_name, read, [ids], [fields]
    behaves like any object request
      creates connection with context
    successful request
      response.content should be Array
      reponse.content.first should be {:id=>1, :name=>"un"}
      behaves like any successful request
        response.success : true
        behaves like any request
          response.class == OpenObject::BackendResponse
    failed request
      behaves like any failed request
        response.success : false
        response.errors[:faultCode] Server faultCode
        response.errors[:faultString] Server faultString
        behaves like any request
          response.class == OpenObject::BackendResponse
  .write(user_context,[ids],{field:'value'})
    invokes execute with model_name, 'write', [ids], {field:'value'}
    behaves like any object request
      creates connection with context
    successful request
      response.content should be nil
      behaves like any successful request
        response.success : true
        behaves like any request
          response.class == OpenObject::BackendResponse
    failed request
      behaves like any failed request
        response.success : false
        response.errors[:faultCode] Server faultCode
        response.errors[:faultString] Server faultString
        behaves like any request
          response.class == OpenObject::BackendResponse
  .create(user_context,{field:value})
    invokes execute with model_name, 'create', {field:'value'}
    behaves like any object request
      creates connection with context
    successful request
      reponse.content should be 1
      behaves like any successful request
        response.success : true
        behaves like any request
          response.class == OpenObject::BackendResponse
    failed request
      behaves like any failed request
        response.success : false
        response.errors[:faultCode] Server faultCode
        response.errors[:faultString] Server faultString
        behaves like any request
          response.class == OpenObject::BackendResponse
Clone this wiki locally