2011-08-24 20:46:36 +08:00
|
|
|
require('../helper');
|
|
|
|
|
2012-06-02 03:47:14 +08:00
|
|
|
var _ = require('underscore')
|
|
|
|
, redis = require("redis")
|
2011-08-24 20:46:36 +08:00
|
|
|
, MetaData = require('../../app/models/metadata')
|
2012-06-02 03:47:14 +08:00
|
|
|
, assert = require('assert')
|
2011-08-24 20:46:36 +08:00
|
|
|
, tests = module.exports = {};
|
|
|
|
|
|
|
|
tests['test can retrieve database name from header and redis'] = function(){
|
2012-06-02 03:46:38 +08:00
|
|
|
var req = {headers: {host: 'vizzuality.cartodb.com'}};
|
2011-08-24 20:46:36 +08:00
|
|
|
|
|
|
|
MetaData.getDatabase(req, function(err, data){
|
2012-06-02 03:46:38 +08:00
|
|
|
assert.equal(data, 'cartodb_test_user_1_db');
|
2011-08-24 20:46:36 +08:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
tests['test can retrieve id from header and redis'] = function(){
|
2012-06-02 03:46:38 +08:00
|
|
|
var req = {headers: {host: 'vizzuality.cartodb.com'}};
|
2011-08-24 20:46:36 +08:00
|
|
|
|
|
|
|
MetaData.getId(req, function(err, data){
|
2012-06-02 03:46:38 +08:00
|
|
|
assert.equal(data, '1');
|
2011-08-24 20:46:36 +08:00
|
|
|
});
|
|
|
|
};
|