var assert = require('assert');
var helix_web_services_client = require('../index.js');
var test_methods = require('./util/test_methods');
var string_methods = require('./util/string_methods');
var done = false;
test_methods.clientAsJdoe(function (err, c) {
if (err) {
console.log("ERROR", err);
assert(false, "login failed");
return;
}
var api = c.createDefaultApi();
var rand = string_methods.randomString();
var clientName = "test-client-" + rand;
var clientCommand = new helix_web_services_client.models.ClientCommand({
client: clientName,
host: null,
altRoots: ['/alt/1', '/alt/2']
});
api.serverClientsPost("localhost", clientCommand, function(err) {
if (err) {
console.log("ERROR", err);
assert(false);
}
api.serverClientsGet("localhost", function(err, clients) {
if (err) {
console.log("ERROR", err);
assert(false);
}
assert(clients.find(function(b) { return b.client == clientName; }) != null,
"did not locate new client");
api.serverClientsClientGet("localhost", clientName, function(err, saved) {
if (err) {
console.log("ERROR", err);
assert(false);
}
assert(saved.client == clientCommand.client);
assert(saved.altRoots.length == clientCommand.altRoots.length);
for (var idx = 0; idx < saved.altRoots.length; ++idx) {
assert(saved.altRoots[idx] == clientCommand.altRoots[idx]);
}
var toUpdate = new helix_web_services_client.models.ClientCommand({
description: "test " + rand
});
api.serverClientsClientPatch("localhost", clientName, toUpdate, function (err) {
if (err) {
console.log("ERROR", err);
assert(false);
}
api.serverClientsClientGet("localhost", clientName, function(err, updated) {
if (err) {
console.log("ERROR", err);
assert(false);
}
assert(toUpdate.description.trim() == updated.description.trim());
api.serverClientsClientDelete("localhost", clientName, function(err) {
if (err) {
console.log("ERROR", err);
assert(false);
}
api.serverClientsGet("localhost", function (err, clients2) {
if (err) {
console.log("ERROR", err);
assert(false);
}
assert(clients2.find(function(b) { return b.client == clientName; }) == null,
"client was not deleted");
done = true;
});
});
});
})
});
});
});
});
function checkForDone() {
if (!done) {
setTimeout(checkForDone, 500);
}
}
setTimeout(checkForDone, 0);
# |
Change |
User |
Description |
Committed |
|
#1
|
19553 |
swellard |
Move and rename clients |
|
|
//guest/perforce_software/helix-web-services/main/source/clients/2016.1.0/javascript/test/default_api.server_clients.crud.js |
#1
|
19097 |
tjuricek |
JavaScript Client SDK tests for client and depot specs |
|
|