304 lines
8.1 KiB
JavaScript
304 lines
8.1 KiB
JavaScript
/*
|
|
* Copyright 2012 Cloud9 IDE, Inc.
|
|
*
|
|
* This product includes software developed by
|
|
* Cloud9 IDE, Inc (http://c9.io).
|
|
*
|
|
* Author: Mike de Boer <info@mikedeboer.nl>
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
var Assert = require("assert");
|
|
var Client = require("./../../index");
|
|
|
|
describe("[user]", function() {
|
|
var client;
|
|
var token = "c286e38330e15246a640c2cf32a45ea45d93b2ba";
|
|
|
|
beforeEach(function() {
|
|
client = new Client({
|
|
version: "3.0.0"
|
|
});
|
|
client.authenticate({
|
|
type: "oauth",
|
|
token: token
|
|
});
|
|
});
|
|
|
|
it("should successfully execute GET /users/:user (getFrom)", function(next) {
|
|
client.user.getFrom(
|
|
{
|
|
user: "String"
|
|
},
|
|
function(err, res) {
|
|
Assert.equal(err, null);
|
|
// other assertions go here
|
|
next();
|
|
}
|
|
);
|
|
});
|
|
|
|
it("should successfully execute GET /user (get)", function(next) {
|
|
client.user.get(
|
|
{},
|
|
function(err, res) {
|
|
Assert.equal(err, null);
|
|
// other assertions go here
|
|
next();
|
|
}
|
|
);
|
|
});
|
|
|
|
it("should successfully execute PATCH /user (update)", function(next) {
|
|
client.user.update(
|
|
{
|
|
name: "String",
|
|
email: "String",
|
|
blog: "String",
|
|
company: "String",
|
|
location: "String",
|
|
hireable: "Boolean",
|
|
bio: "String"
|
|
},
|
|
function(err, res) {
|
|
Assert.equal(err, null);
|
|
// other assertions go here
|
|
next();
|
|
}
|
|
);
|
|
});
|
|
|
|
it("should successfully execute GET /user/orgs (getOrgs)", function(next) {
|
|
client.user.getOrgs(
|
|
{
|
|
page: "Number",
|
|
per_page: "Number"
|
|
},
|
|
function(err, res) {
|
|
Assert.equal(err, null);
|
|
// other assertions go here
|
|
next();
|
|
}
|
|
);
|
|
});
|
|
|
|
it("should successfully execute GET /user/teams (getTeams)", function(next) {
|
|
client.user.getTeams(
|
|
{
|
|
page: "Number",
|
|
per_page: "Number"
|
|
},
|
|
function(err, res) {
|
|
Assert.equal(err, null);
|
|
// other assertions go here
|
|
next();
|
|
}
|
|
);
|
|
});
|
|
|
|
it("should successfully execute GET /user/emails (getEmails)", function(next) {
|
|
client.user.getEmails(
|
|
{
|
|
page: "Number",
|
|
per_page: "Number"
|
|
},
|
|
function(err, res) {
|
|
Assert.equal(err, null);
|
|
// other assertions go here
|
|
next();
|
|
}
|
|
);
|
|
});
|
|
|
|
it("should successfully execute POST /user/emails (addEmails)", function(next) {
|
|
client.user.addEmails(
|
|
{},
|
|
function(err, res) {
|
|
Assert.equal(err, null);
|
|
// other assertions go here
|
|
next();
|
|
}
|
|
);
|
|
});
|
|
|
|
it("should successfully execute DELETE /user/emails (deleteEmails)", function(next) {
|
|
client.user.deleteEmails(
|
|
{},
|
|
function(err, res) {
|
|
Assert.equal(err, null);
|
|
// other assertions go here
|
|
next();
|
|
}
|
|
);
|
|
});
|
|
|
|
it("should successfully execute GET /users/:user/followers (getFollowers)", function(next) {
|
|
client.user.getFollowers(
|
|
{
|
|
user: "String",
|
|
page: "Number",
|
|
per_page: "Number"
|
|
},
|
|
function(err, res) {
|
|
Assert.equal(err, null);
|
|
// other assertions go here
|
|
next();
|
|
}
|
|
);
|
|
});
|
|
|
|
it("should successfully execute GET /users/:user/following (getFollowingFromUser)", function(next) {
|
|
client.user.getFollowingFromUser(
|
|
{
|
|
user: "String",
|
|
page: "Number",
|
|
per_page: "Number"
|
|
},
|
|
function(err, res) {
|
|
Assert.equal(err, null);
|
|
// other assertions go here
|
|
next();
|
|
}
|
|
);
|
|
});
|
|
|
|
it("should successfully execute GET /user/following (getFollowing)", function(next) {
|
|
client.user.getFollowing(
|
|
{
|
|
page: "Number",
|
|
per_page: "Number"
|
|
},
|
|
function(err, res) {
|
|
Assert.equal(err, null);
|
|
// other assertions go here
|
|
next();
|
|
}
|
|
);
|
|
});
|
|
|
|
it("should successfully execute GET /user/following/:user (getFollowUser)", function(next) {
|
|
client.user.getFollowUser(
|
|
{
|
|
user: "String",
|
|
page: "Number",
|
|
per_page: "Number"
|
|
},
|
|
function(err, res) {
|
|
Assert.equal(err, null);
|
|
// other assertions go here
|
|
next();
|
|
}
|
|
);
|
|
});
|
|
|
|
it("should successfully execute PUT /user/following/:user (followUser)", function(next) {
|
|
client.user.followUser(
|
|
{
|
|
user: "String"
|
|
},
|
|
function(err, res) {
|
|
Assert.equal(err, null);
|
|
// other assertions go here
|
|
next();
|
|
}
|
|
);
|
|
});
|
|
|
|
it("should successfully execute DELETE /user/following/:user (unFollowUser)", function(next) {
|
|
client.user.unFollowUser(
|
|
{
|
|
user: "String"
|
|
},
|
|
function(err, res) {
|
|
Assert.equal(err, null);
|
|
// other assertions go here
|
|
next();
|
|
}
|
|
);
|
|
});
|
|
|
|
it("should successfully execute GET /user/keys (getKeys)", function(next) {
|
|
client.user.getKeys(
|
|
{
|
|
page: "Number",
|
|
per_page: "Number"
|
|
},
|
|
function(err, res) {
|
|
Assert.equal(err, null);
|
|
// other assertions go here
|
|
next();
|
|
}
|
|
);
|
|
});
|
|
|
|
it("should successfully execute GET /users/:user/keys (getKeysFromUser)", function(next) {
|
|
client.user.getKeysFromUser(
|
|
{
|
|
user: "String",
|
|
page: "Number",
|
|
per_page: "Number"
|
|
},
|
|
function(err, res) {
|
|
Assert.equal(err, null);
|
|
// other assertions go here
|
|
next();
|
|
}
|
|
);
|
|
});
|
|
|
|
it("should successfully execute GET /user/keys/:id (getKey)", function(next) {
|
|
client.user.getKey(
|
|
{
|
|
id: "String"
|
|
},
|
|
function(err, res) {
|
|
Assert.equal(err, null);
|
|
// other assertions go here
|
|
next();
|
|
}
|
|
);
|
|
});
|
|
|
|
it("should successfully execute POST /user/keys (createKey)", function(next) {
|
|
client.user.createKey(
|
|
{
|
|
title: "String",
|
|
key: "String"
|
|
},
|
|
function(err, res) {
|
|
Assert.equal(err, null);
|
|
// other assertions go here
|
|
next();
|
|
}
|
|
);
|
|
});
|
|
|
|
it("should successfully execute PATCH /user/keys/:id (updateKey)", function(next) {
|
|
client.user.updateKey(
|
|
{
|
|
id: "String",
|
|
title: "String",
|
|
key: "String"
|
|
},
|
|
function(err, res) {
|
|
Assert.equal(err, null);
|
|
// other assertions go here
|
|
next();
|
|
}
|
|
);
|
|
});
|
|
|
|
it("should successfully execute DELETE /user/keys/:id (deleteKey)", function(next) {
|
|
client.user.deleteKey(
|
|
{
|
|
id: "String"
|
|
},
|
|
function(err, res) {
|
|
Assert.equal(err, null);
|
|
// other assertions go here
|
|
next();
|
|
}
|
|
);
|
|
});
|
|
});
|