Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

tests and redis

  • Loading branch information...
commit 08bda973d3d40d03aa58945be170c64c0a631fbf 1 parent e17a160
@tiankongldp tiankongldp authored
View
2  index.js
@@ -1 +1 @@
-module.exports = require('lib/carta');
+module.exports = require('./lib/carta');
View
6 lib/carta.js
@@ -1,4 +1,6 @@
var carta = exports;
-carta.Provider = require('./provider');
-carta.Client = require('./client');
+var Client = require('./engines/redis-client'),
+ Provider = require('./engines/redis-provider');
+
+carta.createClient = Client.createClient;
View
26 lib/engines/redis-client.js
@@ -0,0 +1,26 @@
+var redis = require('redis'),
+ async = require('async');
+
+var client = redis.createClient();
+
+var Db = exports;
+
+Db.createClient = function(id, options, callback) {
+ async.series([
+ function(cbl) {
+ client.set('client:' + id + ':client_type', options.client_type, function(err, res) {
+ console.log(err+'1');
+ cbl(err, res);
+ });
+ },
+ function(cbl) {
+ client.set('client:' + id + ':redirection_uri', options.redirection_uri, function(err, res) {
+ console.log(err+'2');
+ cbl(err, res);
+ });
+ }
+ ], function(err) {
+ console.log(arguments);
+ callback(err || null);
+ });
+};
View
0  lib/engines/redis-provider.js
No changes.
View
7 package.json
@@ -1,20 +1,21 @@
{
"name": "carta",
"version": "0.0.1",
- "author": "yawn <yawn.localhost@gmail.com",
+ "author": "yawn <yawn.localhost@gmail.com>",
"repository": {
"type": "git",
"url": "http://github.com/yawnt/carta.git"
},
"dependencies": {
"redis": ">= 0.0.0",
- "validator": ">= 0.0.0"
+ "validator": ">= 0.0.0",
+ "async": ">= 0.0.0"
},
"devDependencies": {
"vows": "0.6.x"
},
"scripts": {
- "test": "vows --spec --isolate"
+ "test": "vows --spec --isolate test/test-*.js"
},
"main": "./lib/carta.js"
}
View
17 test/test-createClient.js
@@ -0,0 +1,17 @@
+var vows = require('vows'),
+ assert = require('assert'),
+ carta = require('../index');
+
+vows.describe('Creating a client').addBatch({
+ 'createClient': {
+ topic: function() {
+ carta.createClient('fooo', {
+ client_type: 'confidential',
+ redirection_uri: 'http://www.google.com'
+ }, this.callback);
+ },
+ 'should not fail': function(err) {
+ assert.isUndefined(err);
+ }
+ }
+}).export(module);
Please sign in to comment.
Something went wrong with that request. Please try again.