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.clientAsSuper(function (err, c) {
if (err) {
console.log("ERROR", err);
assert(false);
}
var api = c.createDefaultApi();
var rand = string_methods.randomString();
var serverId = "test-server-" + rand;
var serverCommand = new helix_web_services_client.models.ServerCommand({
serverID: serverId,
description: "test " + rand,
type: "server",
services: "standard"
});
api.serverServersPost("localhost", serverCommand, function(err) {
if (err) {
console.log("ERROR", err);
assert(false);
}
api.serverServersGet("localhost", function(err, servers) {
if (err) {
console.log("ERROR", err);
assert(false);
}
assert(servers.find(function(b) { return b.serverID == serverId; }) != null,
"did not locate new server");
api.serverServersServerIdGet("localhost", serverId, function(err, saved) {
if (err) {
console.log("ERROR", err);
assert(false);
}
assert(saved.description.trim() == serverCommand.description.trim());
var toUpdate = new helix_web_services_client.models.ServerCommand({
description: "updated " + rand
});
api.serverServersServerIdPatch("localhost", serverId, toUpdate, function (err) {
if (err) {
console.log("ERROR", err);
assert(false);
}
api.serverServersServerIdGet("localhost", serverId, function(err, updated) {
if (err) {
console.log("ERROR", err);
assert(false);
}
assert(toUpdate.description.trim() == updated.description.trim());
api.serverServersServerIdDelete("localhost", serverId, function(err) {
if (err) {
console.log("ERROR", err);
assert(false);
}
api.serverServersGet("localhost", function (err, servers2) {
if (err) {
console.log("ERROR", err);
assert(false);
}
assert(servers2.find(function(b) { return b.serverID == serverId; }) == null,
"server 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_servers.crud.js |
#1
|
19184 |
tjuricek |
JavaScript Client SDK tests for paths, protections, servers, triggers, users |
|
|