CartoDB-SQL-API/test/unit/metadata.test.js

30 lines
772 B
JavaScript
Raw Normal View History

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 = {};
2012-07-13 04:54:12 +08:00
suite('metadata', function() {
test('test can retrieve database name from header and redis', function(done){
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');
2012-07-13 04:54:12 +08:00
done();
2011-08-24 20:46:36 +08:00
});
2012-07-13 04:54:12 +08:00
});
2011-08-24 20:46:36 +08:00
2012-07-13 04:54:12 +08:00
test('test can retrieve id from header and redis', function(done){
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');
2012-07-13 04:54:12 +08:00
done();
2011-08-24 20:46:36 +08:00
});
2012-07-13 04:54:12 +08:00
});
});