var request = require('supertest');
var app = require(__dirname+'/../../lib/app.js');
var gateway = require(__dirname+'/../../');

describe('set ripple rest url', function(){

  it('should return unauthorized without credentials', function(done){
    request(app)
      .post('/v1/config/ripple/rest')
      .expect(401)
      .end(function(err, res){
        if (err) throw err;
        done();
      });
  });

  it('should return successfully with credentials', function(done){
    request(app)
      .post('/v1/config/ripple/rest')
      .send({ ripple_rest_api: 'http://localhost:5990/' })
      .auth('admin@'+gateway.config.get('DOMAIN'), gateway.config.get('KEY'))
      .expect(200)
      .end(function(err, res){
        if (err) throw err;
        done();
      });
  });

});


var request = require('supertest');
var app = require(__dirname+'/../../lib/app.js');
var gateway = require(__dirname+'/../../');

describe('set ripple rest url', function(){

  it('should return unauthorized without credentials', function(done){
    request(app)
      .post('/v1/config/ripple/rest')
      .expect(401)
      .end(function(err, res){
        if (err) throw err;
        done();
      });
  });

  it('should return successfully with credentials', function(done){
    request(app)
      .post('/v1/config/ripple/rest')
      .send({ url: 'http://localhost:5990/' })
      .auth('admin@'+gateway.config.get('DOMAIN'), gateway.config.get('KEY'))
      .expect(200)
      .end(function(err, res){
        if (err) throw err;
        done();
      });
  });

});


update passed object property name.