mirror of https://gitee.com/bigwinds/arangodb
Feature 3.5/convert gharial test to arangoclient (#10259)
* use the default arangosh client connection instead of the simple http client to test the gharial API * refrain using globals, as sugested by @goedderz * add method to check whether there already is a reply present * fix result handling, return errors & set results * the mock also needs to implement the 'isEmpty' function * Update arangod/RestHandler/RestGraphHandler.cpp Co-Authored-By: Michael Hackstein <michael@arangodb.com> * Update arangod/RestHandler/RestGraphHandler.cpp Co-Authored-By: Michael Hackstein <michael@arangodb.com> * Update lib/Rest/VstResponse.h Co-Authored-By: Michael Hackstein <michael@arangodb.com> * Update lib/Rest/HttpResponse.h Co-Authored-By: Michael Hackstein <michael@arangodb.com> * changelog * backport: fix variable name * adjust test to corrected API * make it private * fix indention * Update CHANGELOG
This commit is contained in:
parent
7fd3b3c390
commit
810f34e120
|
@ -1,6 +1,10 @@
|
||||||
v3.5.2 (XXXX-XX-XX)
|
v3.5.2 (XXXX-XX-XX)
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
* The General Graph document API is now persistent with the document API in its
|
||||||
|
errormessages. When attempting to create / modify edges pointing to non
|
||||||
|
existing vertex collections HTTP 400 is returned instead of 404.
|
||||||
|
|
||||||
* Disallow the usage of subqueries inside AQL traversal PRUNE conditions.
|
* Disallow the usage of subqueries inside AQL traversal PRUNE conditions.
|
||||||
Using subqueries inside PRUNE conditions causes undefined behavior,
|
Using subqueries inside PRUNE conditions causes undefined behavior,
|
||||||
so such queries will now be aborted early on with a parse error
|
so such queries will now be aborted early on with a parse error
|
||||||
|
|
|
@ -47,13 +47,25 @@ RestGraphHandler::RestGraphHandler(GeneralRequest* request, GeneralResponse* res
|
||||||
RestStatus RestGraphHandler::execute() {
|
RestStatus RestGraphHandler::execute() {
|
||||||
Result res = executeGharial();
|
Result res = executeGharial();
|
||||||
if (res.fail()) {
|
if (res.fail()) {
|
||||||
generateError(res);
|
TRI_ASSERT(!_response->isResponseEmpty());
|
||||||
return RestStatus::FAIL;
|
return RestStatus::FAIL;
|
||||||
}
|
}
|
||||||
// The url is required to properly generate the result!
|
// The url is required to properly generate the result!
|
||||||
return RestStatus::DONE;
|
return RestStatus::DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result RestGraphHandler::returnError(int errorNumber) {
|
||||||
|
auto res = Result(errorNumber);
|
||||||
|
generateError(res);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result RestGraphHandler::returnError(int errorNumber, char const* message) {
|
||||||
|
auto res = Result(errorNumber, message);
|
||||||
|
generateError(res);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
Result RestGraphHandler::executeGharial() {
|
Result RestGraphHandler::executeGharial() {
|
||||||
auto suffix = request()->suffixes().begin();
|
auto suffix = request()->suffixes().begin();
|
||||||
auto end = request()->suffixes().end();
|
auto end = request()->suffixes().end();
|
||||||
|
@ -86,7 +98,7 @@ Result RestGraphHandler::executeGharial() {
|
||||||
const char* vertex = "vertex";
|
const char* vertex = "vertex";
|
||||||
const char* edge = "edge";
|
const char* edge = "edge";
|
||||||
if (collType != vertex && collType != edge) {
|
if (collType != vertex && collType != edge) {
|
||||||
return {TRI_ERROR_HTTP_NOT_FOUND};
|
return returnError(TRI_ERROR_HTTP_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (noMoreSuffixes()) {
|
if (noMoreSuffixes()) {
|
||||||
|
@ -152,7 +164,7 @@ Result RestGraphHandler::executeGharial() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {TRI_ERROR_HTTP_NOT_FOUND};
|
return returnError(TRI_ERROR_HTTP_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RestGraphHandler::graphAction(Graph& graph) {
|
Result RestGraphHandler::graphAction(Graph& graph) {
|
||||||
|
@ -163,7 +175,7 @@ Result RestGraphHandler::graphAction(Graph& graph) {
|
||||||
return graphActionRemoveGraph(graph);
|
return graphActionRemoveGraph(graph);
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
return {TRI_ERROR_HTTP_METHOD_NOT_ALLOWED};
|
return returnError(TRI_ERROR_HTTP_METHOD_NOT_ALLOWED);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RestGraphHandler::graphsAction() {
|
Result RestGraphHandler::graphsAction() {
|
||||||
|
@ -174,7 +186,7 @@ Result RestGraphHandler::graphsAction() {
|
||||||
return graphActionCreateGraph();
|
return graphActionCreateGraph();
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
return {TRI_ERROR_HTTP_METHOD_NOT_ALLOWED};
|
return returnError(TRI_ERROR_HTTP_METHOD_NOT_ALLOWED);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RestGraphHandler::vertexSetsAction(Graph& graph) {
|
Result RestGraphHandler::vertexSetsAction(Graph& graph) {
|
||||||
|
@ -185,7 +197,7 @@ Result RestGraphHandler::vertexSetsAction(Graph& graph) {
|
||||||
return modifyVertexDefinition(graph, VertexDefinitionAction::CREATE, "");
|
return modifyVertexDefinition(graph, VertexDefinitionAction::CREATE, "");
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
return {TRI_ERROR_HTTP_METHOD_NOT_ALLOWED};
|
return returnError(TRI_ERROR_HTTP_METHOD_NOT_ALLOWED);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RestGraphHandler::edgeSetsAction(Graph& graph) {
|
Result RestGraphHandler::edgeSetsAction(Graph& graph) {
|
||||||
|
@ -196,7 +208,7 @@ Result RestGraphHandler::edgeSetsAction(Graph& graph) {
|
||||||
return createEdgeDefinition(graph);
|
return createEdgeDefinition(graph);
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
return {TRI_ERROR_HTTP_METHOD_NOT_ALLOWED};
|
return returnError(TRI_ERROR_HTTP_METHOD_NOT_ALLOWED);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RestGraphHandler::edgeSetAction(Graph& graph, const std::string& edgeDefinitionName) {
|
Result RestGraphHandler::edgeSetAction(Graph& graph, const std::string& edgeDefinitionName) {
|
||||||
|
@ -209,7 +221,7 @@ Result RestGraphHandler::edgeSetAction(Graph& graph, const std::string& edgeDefi
|
||||||
return removeEdgeDefinition(graph, edgeDefinitionName);
|
return removeEdgeDefinition(graph, edgeDefinitionName);
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
return {TRI_ERROR_HTTP_METHOD_NOT_ALLOWED};
|
return returnError(TRI_ERROR_HTTP_METHOD_NOT_ALLOWED);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RestGraphHandler::vertexSetAction(Graph& graph, const std::string& vertexCollectionName) {
|
Result RestGraphHandler::vertexSetAction(Graph& graph, const std::string& vertexCollectionName) {
|
||||||
|
@ -220,7 +232,7 @@ Result RestGraphHandler::vertexSetAction(Graph& graph, const std::string& vertex
|
||||||
return modifyVertexDefinition(graph, VertexDefinitionAction::REMOVE, vertexCollectionName);
|
return modifyVertexDefinition(graph, VertexDefinitionAction::REMOVE, vertexCollectionName);
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
return {TRI_ERROR_HTTP_METHOD_NOT_ALLOWED};
|
return returnError(TRI_ERROR_HTTP_METHOD_NOT_ALLOWED);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RestGraphHandler::vertexAction(Graph& graph, const std::string& vertexCollectionName,
|
Result RestGraphHandler::vertexAction(Graph& graph, const std::string& vertexCollectionName,
|
||||||
|
@ -238,7 +250,7 @@ Result RestGraphHandler::vertexAction(Graph& graph, const std::string& vertexCol
|
||||||
return vertexActionRemove(graph, vertexCollectionName, vertexKey);
|
return vertexActionRemove(graph, vertexCollectionName, vertexKey);
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
return {TRI_ERROR_HTTP_METHOD_NOT_ALLOWED};
|
return returnError(TRI_ERROR_HTTP_METHOD_NOT_ALLOWED);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RestGraphHandler::edgeAction(Graph& graph, const std::string& edgeDefinitionName,
|
Result RestGraphHandler::edgeAction(Graph& graph, const std::string& edgeDefinitionName,
|
||||||
|
@ -255,7 +267,7 @@ Result RestGraphHandler::edgeAction(Graph& graph, const std::string& edgeDefinit
|
||||||
return edgeActionReplace(graph, edgeDefinitionName, edgeKey);
|
return edgeActionReplace(graph, edgeDefinitionName, edgeKey);
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
return {TRI_ERROR_HTTP_METHOD_NOT_ALLOWED};
|
return returnError(TRI_ERROR_HTTP_METHOD_NOT_ALLOWED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RestGraphHandler::vertexActionRead(Graph& graph, std::string const& collectionName,
|
void RestGraphHandler::vertexActionRead(Graph& graph, std::string const& collectionName,
|
||||||
|
@ -713,7 +725,7 @@ Result RestGraphHandler::modifyVertexDefinition(graph::Graph& graph,
|
||||||
bool parseSuccess = false;
|
bool parseSuccess = false;
|
||||||
VPackSlice body = this->parseVPackBody(parseSuccess);
|
VPackSlice body = this->parseVPackBody(parseSuccess);
|
||||||
if (!parseSuccess) {
|
if (!parseSuccess) {
|
||||||
return {TRI_ERROR_BAD_PARAMETER, "unable to parse body"};
|
return returnError(TRI_ERROR_BAD_PARAMETER, "unable to parse body");
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO maybe merge this function with modifyEdgeDefinition?
|
// TODO maybe merge this function with modifyEdgeDefinition?
|
||||||
|
@ -751,7 +763,6 @@ Result RestGraphHandler::modifyVertexDefinition(graph::Graph& graph,
|
||||||
|
|
||||||
return Result();
|
return Result();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RestGraphHandler::removeEdgeDefinition(graph::Graph& graph,
|
Result RestGraphHandler::removeEdgeDefinition(graph::Graph& graph,
|
||||||
const std::string& edgeDefinitionName) {
|
const std::string& edgeDefinitionName) {
|
||||||
return modifyEdgeDefinition(graph, EdgeDefinitionAction::REMOVE, edgeDefinitionName);
|
return modifyEdgeDefinition(graph, EdgeDefinitionAction::REMOVE, edgeDefinitionName);
|
||||||
|
@ -769,7 +780,7 @@ Result RestGraphHandler::documentModify(graph::Graph& graph, const std::string&
|
||||||
bool parseSuccess = false;
|
bool parseSuccess = false;
|
||||||
VPackSlice body = this->parseVPackBody(parseSuccess);
|
VPackSlice body = this->parseVPackBody(parseSuccess);
|
||||||
if (!parseSuccess) {
|
if (!parseSuccess) {
|
||||||
return {TRI_ERROR_BAD_PARAMETER, "unable to parse body"};
|
return returnError(TRI_ERROR_BAD_PARAMETER, "unable to parse body");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool waitForSync = _request->parsedValue(StaticStrings::WaitForSyncString, false);
|
bool waitForSync = _request->parsedValue(StaticStrings::WaitForSyncString, false);
|
||||||
|
@ -830,7 +841,7 @@ Result RestGraphHandler::documentCreate(graph::Graph& graph, std::string const&
|
||||||
bool parseSuccess = false;
|
bool parseSuccess = false;
|
||||||
VPackSlice body = this->parseVPackBody(parseSuccess);
|
VPackSlice body = this->parseVPackBody(parseSuccess);
|
||||||
if (!parseSuccess) {
|
if (!parseSuccess) {
|
||||||
return {TRI_ERROR_BAD_PARAMETER, "unable to parse body"};
|
return returnError(TRI_ERROR_BAD_PARAMETER, "unable to parse body");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool waitForSync = _request->parsedValue(StaticStrings::WaitForSyncString, false);
|
bool waitForSync = _request->parsedValue(StaticStrings::WaitForSyncString, false);
|
||||||
|
@ -927,7 +938,7 @@ Result RestGraphHandler::graphActionCreateGraph() {
|
||||||
bool parseSuccess = false;
|
bool parseSuccess = false;
|
||||||
VPackSlice body = this->parseVPackBody(parseSuccess);
|
VPackSlice body = this->parseVPackBody(parseSuccess);
|
||||||
if (!parseSuccess) {
|
if (!parseSuccess) {
|
||||||
return {TRI_ERROR_BAD_PARAMETER, "unable to parse body"};
|
return returnError(TRI_ERROR_BAD_PARAMETER, "unable to parse body");
|
||||||
}
|
}
|
||||||
bool waitForSync = _request->parsedValue(StaticStrings::WaitForSyncString, false);
|
bool waitForSync = _request->parsedValue(StaticStrings::WaitForSyncString, false);
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,11 @@ class RestGraphHandler : public arangodb::RestVocbaseBaseHandler {
|
||||||
RequestLane lane() const override;
|
RequestLane lane() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Result returnError(int errorNumber);
|
||||||
|
|
||||||
|
Result returnError(int errorNumber, char const* message);
|
||||||
|
|
||||||
arangodb::Result executeGharial();
|
arangodb::Result executeGharial();
|
||||||
|
|
||||||
// /_api/gharial
|
// /_api/gharial
|
||||||
|
|
|
@ -135,6 +135,8 @@ class GeneralResponse {
|
||||||
_headers.emplace(key, value);
|
_headers.emplace(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual bool isResponseEmpty() const {return false;};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual uint64_t messageId() const { return 1; }
|
virtual uint64_t messageId() const { return 1; }
|
||||||
|
|
||||||
|
@ -146,6 +148,7 @@ class GeneralResponse {
|
||||||
void setPayload(Payload&& payload, bool generateBody,
|
void setPayload(Payload&& payload, bool generateBody,
|
||||||
VPackOptions const& options = VPackOptions::Options::Defaults,
|
VPackOptions const& options = VPackOptions::Options::Defaults,
|
||||||
bool resolveExternals = true) {
|
bool resolveExternals = true) {
|
||||||
|
TRI_ASSERT(isResponseEmpty());
|
||||||
_generateBody = generateBody;
|
_generateBody = generateBody;
|
||||||
addPayload(std::forward<Payload>(payload), &options, resolveExternals);
|
addPayload(std::forward<Payload>(payload), &options, resolveExternals);
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,10 @@ class HttpResponse : public GeneralResponse {
|
||||||
void addPayload(VPackBuffer<uint8_t>&&, arangodb::velocypack::Options const* = nullptr,
|
void addPayload(VPackBuffer<uint8_t>&&, arangodb::velocypack::Options const* = nullptr,
|
||||||
bool resolve_externals = true) override;
|
bool resolve_externals = true) override;
|
||||||
|
|
||||||
|
bool isResponseEmpty() const override {
|
||||||
|
return _body->empty();
|
||||||
|
}
|
||||||
|
|
||||||
/// used for head-responses
|
/// used for head-responses
|
||||||
bool setGenerateBody(bool generateBody) override final {
|
bool setGenerateBody(bool generateBody) override final {
|
||||||
return _generateBody = generateBody;
|
return _generateBody = generateBody;
|
||||||
|
|
|
@ -47,6 +47,10 @@ class VstResponse : public GeneralResponse {
|
||||||
|
|
||||||
VstResponse(ResponseCode code, uint64_t id);
|
VstResponse(ResponseCode code, uint64_t id);
|
||||||
|
|
||||||
|
bool isResponseEmpty() const override {
|
||||||
|
return _vpackPayloads.empty();
|
||||||
|
}
|
||||||
|
|
||||||
// required by base
|
// required by base
|
||||||
uint64_t messageId() const override { return _messageId; }
|
uint64_t messageId() const override { return _messageId; }
|
||||||
virtual arangodb::Endpoint::TransportType transportType() override {
|
virtual arangodb::Endpoint::TransportType transportType() override {
|
||||||
|
|
|
@ -49,6 +49,9 @@ struct GeneralRequestMock: public arangodb::GeneralRequest {
|
||||||
|
|
||||||
struct GeneralResponseMock: public arangodb::GeneralResponse {
|
struct GeneralResponseMock: public arangodb::GeneralResponse {
|
||||||
arangodb::velocypack::Builder _payload;
|
arangodb::velocypack::Builder _payload;
|
||||||
|
virtual bool isResponseEmpty() const override {
|
||||||
|
return _payload.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
GeneralResponseMock(arangodb::ResponseCode code = arangodb::ResponseCode::OK);
|
GeneralResponseMock(arangodb::ResponseCode code = arangodb::ResponseCode::OK);
|
||||||
virtual void addPayload(arangodb::velocypack::Buffer<uint8_t>&& buffer, arangodb::velocypack::Options const* options = nullptr, bool resolveExternals = true) override;
|
virtual void addPayload(arangodb::velocypack::Buffer<uint8_t>&& buffer, arangodb::velocypack::Options const* options = nullptr, bool resolveExternals = true) override;
|
||||||
|
|
|
@ -32,7 +32,7 @@ chai.Assertion.addProperty('does', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
const arangodb = require('@arangodb');
|
const arangodb = require('@arangodb');
|
||||||
const request = require('@arangodb/request');
|
const arango = arangodb.arango;
|
||||||
|
|
||||||
const ERRORS = arangodb.errors;
|
const ERRORS = arangodb.errors;
|
||||||
const db = arangodb.db;
|
const db = arangodb.db;
|
||||||
|
@ -105,16 +105,14 @@ describe('_api/gharial', () => {
|
||||||
};
|
};
|
||||||
expect(db._collection(eColName)).to.be.null;
|
expect(db._collection(eColName)).to.be.null;
|
||||||
expect(db._collection(vColName)).to.be.null;
|
expect(db._collection(vColName)).to.be.null;
|
||||||
let req = request.post(url, {
|
let req = arango.POST(url, graphDef);
|
||||||
body: JSON.stringify(graphDef)
|
expect(req.code).to.equal(202);
|
||||||
});
|
|
||||||
expect(req.statusCode).to.equal(202);
|
|
||||||
|
|
||||||
// This is all async give it some time
|
// This is all async give it some time
|
||||||
do {
|
do {
|
||||||
wait(0.1);
|
wait(0.1);
|
||||||
req = request.get(url + "/" + graphName);
|
req = arango.GET(url + "/" + graphName);
|
||||||
} while (req.statusCode !== 200);
|
} while (req.code !== 200);
|
||||||
|
|
||||||
expect(db._collection(eColName)).to.not.be.null;
|
expect(db._collection(eColName)).to.not.be.null;
|
||||||
expect(db._collection(vColName)).to.not.be.null;
|
expect(db._collection(vColName)).to.not.be.null;
|
||||||
|
@ -139,16 +137,14 @@ describe('_api/gharial', () => {
|
||||||
expect(db._collection(vColName)).to.be.null;
|
expect(db._collection(vColName)).to.be.null;
|
||||||
expect(db._collection(oColName)).to.be.null;
|
expect(db._collection(oColName)).to.be.null;
|
||||||
expect(db._collection(oColName2)).to.be.null;
|
expect(db._collection(oColName2)).to.be.null;
|
||||||
let req = request.post(url, {
|
let req = arango.POST(url, graphDef);
|
||||||
body: JSON.stringify(graphDef)
|
expect(req.code).to.equal(202);
|
||||||
});
|
|
||||||
expect(req.statusCode).to.equal(202);
|
|
||||||
|
|
||||||
// This is all async give it some time
|
// This is all async give it some time
|
||||||
do {
|
do {
|
||||||
wait(0.1);
|
wait(0.1);
|
||||||
req = request.get(url + "/" + graphName);
|
req = arango.GET(url + "/" + graphName);
|
||||||
} while (req.statusCode !== 200);
|
} while (req.code !== 200);
|
||||||
|
|
||||||
expect(db._collection(eColName)).to.not.be.null;
|
expect(db._collection(eColName)).to.not.be.null;
|
||||||
expect(db._collection(vColName)).to.not.be.null;
|
expect(db._collection(vColName)).to.not.be.null;
|
||||||
|
@ -175,10 +171,8 @@ describe('_api/gharial', () => {
|
||||||
_from: 'persons/bob',
|
_from: 'persons/bob',
|
||||||
_to: 'persons/charlie'
|
_to: 'persons/charlie'
|
||||||
};
|
};
|
||||||
let req = request.post(url + '/' + exampleGraphName + '/edge/knows', {
|
let req = arango.POST(url + '/' + exampleGraphName + '/edge/knows', edgeDef );
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(202);
|
||||||
});
|
|
||||||
expect(req.statusCode).to.equal(202);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -196,11 +190,9 @@ describe('_api/gharial', () => {
|
||||||
_from: 'persons/notavailable',
|
_from: 'persons/notavailable',
|
||||||
_to: 'persons/charlie'
|
_to: 'persons/charlie'
|
||||||
};
|
};
|
||||||
let req = request.post(url + '/' + exampleGraphName + '/edge/knows', {
|
let req = arango.POST(url + '/' + exampleGraphName + '/edge/knows', edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(404);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
||||||
expect(req.statusCode).to.equal(404);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -216,11 +208,9 @@ describe('_api/gharial', () => {
|
||||||
_from: 'persons/bob',
|
_from: 'persons/bob',
|
||||||
_to: 'persons/notavailable'
|
_to: 'persons/notavailable'
|
||||||
};
|
};
|
||||||
let req = request.post(url + '/' + exampleGraphName + '/edge/knows', {
|
let req = arango.POST(url + '/' + exampleGraphName + '/edge/knows', edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(404);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
||||||
expect(req.statusCode).to.equal(404);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -236,11 +226,9 @@ describe('_api/gharial', () => {
|
||||||
_from: 'persons/notavailable',
|
_from: 'persons/notavailable',
|
||||||
_to: 'persons/notavailable'
|
_to: 'persons/notavailable'
|
||||||
};
|
};
|
||||||
let req = request.post(url + '/' + exampleGraphName + '/edge/knows', {
|
let req = arango.POST(url + '/' + exampleGraphName + '/edge/knows', edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(404);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
||||||
expect(req.statusCode).to.equal(404);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -260,11 +248,9 @@ describe('_api/gharial', () => {
|
||||||
_from: 'xxx/peter',
|
_from: 'xxx/peter',
|
||||||
_to: 'persons/charlie'
|
_to: 'persons/charlie'
|
||||||
};
|
};
|
||||||
let req = request.post(url + '/' + exampleGraphName + '/edge/knows', {
|
let req = arango.POST(url + '/' + exampleGraphName + '/edge/knows', edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(404);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND.code);
|
||||||
expect(req.statusCode).to.equal(404);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -282,11 +268,9 @@ describe('_api/gharial', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// get a (any) valid key of an existing edge document
|
// get a (any) valid key of an existing edge document
|
||||||
let req = request.post(url + '/' + exampleGraphName + '/edge/knows/', {
|
let req = arango.POST(url + '/' + exampleGraphName + '/edge/knows/', edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(404);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
||||||
expect(req.statusCode).to.equal(404);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -304,11 +288,9 @@ describe('_api/gharial', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// get a (any) valid key of an existing edge document
|
// get a (any) valid key of an existing edge document
|
||||||
let req = request.post(url + '/' + exampleGraphName + '/edge/knows/', {
|
let req = arango.POST(url + '/' + exampleGraphName + '/edge/knows/', edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(404);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
||||||
expect(req.statusCode).to.equal(404);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -326,11 +308,9 @@ describe('_api/gharial', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// get a (any) valid key of an existing edge document
|
// get a (any) valid key of an existing edge document
|
||||||
let req = request.post(url + '/' + exampleGraphName + '/edge/knows/', {
|
let req = arango.POST(url + '/' + exampleGraphName + '/edge/knows/', edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(404);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
||||||
expect(req.statusCode).to.equal(404);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -346,11 +326,9 @@ describe('_api/gharial', () => {
|
||||||
_from: 'persons/bob',
|
_from: 'persons/bob',
|
||||||
_to: 'xxx/charlie'
|
_to: 'xxx/charlie'
|
||||||
};
|
};
|
||||||
let req = request.post(url + '/' + exampleGraphName + '/edge/knows', {
|
let req = arango.POST(url + '/' + exampleGraphName + '/edge/knows', edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(404);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND.code);
|
||||||
expect(req.statusCode).to.equal(404);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -366,11 +344,9 @@ describe('_api/gharial', () => {
|
||||||
_from: 'xxx/peter',
|
_from: 'xxx/peter',
|
||||||
_to: 'xxx/charlie'
|
_to: 'xxx/charlie'
|
||||||
};
|
};
|
||||||
let req = request.post(url + '/' + exampleGraphName + '/edge/knows', {
|
let req = arango.POST(url + '/' + exampleGraphName + '/edge/knows', edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(404);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND.code);
|
||||||
expect(req.statusCode).to.equal(404);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -386,11 +362,9 @@ describe('_api/gharial', () => {
|
||||||
_from: 'peter',
|
_from: 'peter',
|
||||||
_to: 'persons/charlie'
|
_to: 'persons/charlie'
|
||||||
};
|
};
|
||||||
let req = request.post(url + '/' + exampleGraphName + '/edge/knows', {
|
let req = arango.POST(url + '/' + exampleGraphName + '/edge/knows', edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(400);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE.code);
|
||||||
expect(req.statusCode).to.equal(400);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -406,11 +380,9 @@ describe('_api/gharial', () => {
|
||||||
_from: 'persons/peter',
|
_from: 'persons/peter',
|
||||||
_to: 'charlie'
|
_to: 'charlie'
|
||||||
};
|
};
|
||||||
let req = request.post(url + '/' + exampleGraphName + '/edge/knows', {
|
let req = arango.POST(url + '/' + exampleGraphName + '/edge/knows', edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(400);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE.code);
|
||||||
expect(req.statusCode).to.equal(400);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -426,11 +398,9 @@ describe('_api/gharial', () => {
|
||||||
_from: 'peter',
|
_from: 'peter',
|
||||||
_to: 'charlie'
|
_to: 'charlie'
|
||||||
};
|
};
|
||||||
let req = request.post(url + '/' + exampleGraphName + '/edge/knows', {
|
let req = arango.POST(url + '/' + exampleGraphName + '/edge/knows', edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(400);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE.code);
|
||||||
expect(req.statusCode).to.equal(400);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -447,11 +417,9 @@ describe('_api/gharial', () => {
|
||||||
expect(g).to.not.be.null;
|
expect(g).to.not.be.null;
|
||||||
|
|
||||||
const edgeDef = {};
|
const edgeDef = {};
|
||||||
let req = request.post(url + '/' + exampleGraphName + '/edge/knows', {
|
let req = arango.POST(url + '/' + exampleGraphName + '/edge/knows', edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(400);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE.code);
|
||||||
expect(req.statusCode).to.equal(400);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -473,14 +441,11 @@ describe('_api/gharial', () => {
|
||||||
edgeDef._from = 'persons/charlie';
|
edgeDef._from = 'persons/charlie';
|
||||||
edgeDef._to = 'persons/charlie';
|
edgeDef._to = 'persons/charlie';
|
||||||
|
|
||||||
let res = request.patch(url + '/' + exampleGraphName + '/edge/knows/' + edgeDef._key, {
|
let res = arango.PATCH(url + '/' + exampleGraphName + '/edge/knows/' + edgeDef._key, edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
|
||||||
});
|
|
||||||
// 202 without waitForSync (default)
|
// 202 without waitForSync (default)
|
||||||
expect(res.statusCode).to.equal(202);
|
expect(res.code).to.equal(202);
|
||||||
expect(res.json.code).to.equal(202);
|
expect(res.error).to.equal(false);
|
||||||
expect(res.json.error).to.equal(false);
|
expect(res.edge._key).to.equal(edgeDef._key);
|
||||||
expect(res.json.edge._key).to.equal(edgeDef._key);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -501,11 +466,9 @@ describe('_api/gharial', () => {
|
||||||
|
|
||||||
// get a (any) valid key of an existing edge document
|
// get a (any) valid key of an existing edge document
|
||||||
const _key = db.knows.any()._key;
|
const _key = db.knows.any()._key;
|
||||||
let req = request.patch(url + '/' + exampleGraphName + '/edge/knows/' + _key, {
|
let req = arango.PATCH(url + '/' + exampleGraphName + '/edge/knows/' + _key, edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(400);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE.code);
|
||||||
expect(req.statusCode).to.equal(400);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -524,11 +487,9 @@ describe('_api/gharial', () => {
|
||||||
|
|
||||||
// get a (any) valid key of an existing edge document
|
// get a (any) valid key of an existing edge document
|
||||||
const _key = db.knows.any()._key;
|
const _key = db.knows.any()._key;
|
||||||
let req = request.patch(url + '/' + exampleGraphName + '/edge/knows/' + _key, {
|
let req = arango.PATCH(url + '/' + exampleGraphName + '/edge/knows/' + _key, edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(400);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND.code);
|
||||||
expect(req.statusCode).to.equal(404);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -547,11 +508,9 @@ describe('_api/gharial', () => {
|
||||||
|
|
||||||
// get a (any) valid key of an existing edge document
|
// get a (any) valid key of an existing edge document
|
||||||
const _key = db.knows.any()._key;
|
const _key = db.knows.any()._key;
|
||||||
let req = request.patch(url + '/' + exampleGraphName + '/edge/knows/' + _key, {
|
let req = arango.PATCH(url + '/' + exampleGraphName + '/edge/knows/' + _key, edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(400);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND.code);
|
||||||
expect(req.statusCode).to.equal(404);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -570,11 +529,9 @@ describe('_api/gharial', () => {
|
||||||
|
|
||||||
// get a (any) valid key of an existing edge document
|
// get a (any) valid key of an existing edge document
|
||||||
const _key = db.knows.any()._key;
|
const _key = db.knows.any()._key;
|
||||||
let req = request.patch(url + '/' + exampleGraphName + '/edge/knows/' + _key, {
|
let req = arango.PATCH(url + '/' + exampleGraphName + '/edge/knows/' + _key, edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(404);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
||||||
expect(req.statusCode).to.equal(404);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -593,11 +550,9 @@ describe('_api/gharial', () => {
|
||||||
|
|
||||||
// get a (any) valid key of an existing edge document
|
// get a (any) valid key of an existing edge document
|
||||||
const _key = db.knows.any()._key;
|
const _key = db.knows.any()._key;
|
||||||
let req = request.patch(url + '/' + exampleGraphName + '/edge/knows/' + _key, {
|
let req = arango.PATCH(url + '/' + exampleGraphName + '/edge/knows/' + _key, edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(404);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
||||||
expect(req.statusCode).to.equal(404);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -616,11 +571,9 @@ describe('_api/gharial', () => {
|
||||||
|
|
||||||
// get a (any) valid key of an existing edge document
|
// get a (any) valid key of an existing edge document
|
||||||
const _key = db.knows.any()._key;
|
const _key = db.knows.any()._key;
|
||||||
let req = request.patch(url + '/' + exampleGraphName + '/edge/knows/' + _key, {
|
let req = arango.PATCH(url + '/' + exampleGraphName + '/edge/knows/' + _key, edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(404);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
||||||
expect(req.statusCode).to.equal(404);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -639,11 +592,9 @@ describe('_api/gharial', () => {
|
||||||
|
|
||||||
// get a (any) valid key of an existing edge document
|
// get a (any) valid key of an existing edge document
|
||||||
const _key = db.knows.any()._key;
|
const _key = db.knows.any()._key;
|
||||||
let req = request.patch(url + '/' + exampleGraphName + '/edge/knows/' + _key, {
|
let req = arango.PATCH(url + '/' + exampleGraphName + '/edge/knows/' + _key, edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(400);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE.code);
|
||||||
expect(req.statusCode).to.equal(400);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -662,11 +613,9 @@ describe('_api/gharial', () => {
|
||||||
|
|
||||||
// get a (any) valid key of an existing edge document
|
// get a (any) valid key of an existing edge document
|
||||||
const _key = db.knows.any()._key;
|
const _key = db.knows.any()._key;
|
||||||
let req = request.patch(url + '/' + exampleGraphName + '/edge/knows/' + _key, {
|
let req = arango.PATCH(url + '/' + exampleGraphName + '/edge/knows/' + _key, edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(404);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
||||||
expect(req.statusCode).to.equal(404);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -694,16 +643,13 @@ describe('_api/gharial', () => {
|
||||||
const newEdge = Object.assign({}, e);
|
const newEdge = Object.assign({}, e);
|
||||||
newEdge.newAttribute = 'new value';
|
newEdge.newAttribute = 'new value';
|
||||||
|
|
||||||
const res = request.put(
|
const res = arango.PUT(
|
||||||
`${url}/${exampleGraphName}/edge/${eName}/${e._key}`,
|
`${url}/${exampleGraphName}/edge/${eName}/${e._key}`, newEdge);
|
||||||
{body: JSON.stringify(newEdge)}
|
|
||||||
);
|
|
||||||
|
|
||||||
// 202 without waitForSync (default)
|
// 202 without waitForSync (default)
|
||||||
expect(res.statusCode).to.equal(202);
|
expect(res.code).to.equal(202);
|
||||||
expect(res.json.code).to.equal(202);
|
expect(res.error).to.equal(false);
|
||||||
expect(res.json.error).to.equal(false);
|
expect(res.edge._key).to.equal(e._key);
|
||||||
expect(res.json.edge._key).to.equal(e._key);
|
|
||||||
|
|
||||||
expect(db.knows.document(e._key))
|
expect(db.knows.document(e._key))
|
||||||
.to.be.an('object')
|
.to.be.an('object')
|
||||||
|
@ -743,13 +689,12 @@ describe('_api/gharial', () => {
|
||||||
const description = key;
|
const description = key;
|
||||||
const newEdge = newEdges[key];
|
const newEdge = newEdges[key];
|
||||||
|
|
||||||
const res = request.put(
|
const res = arango.PUT(
|
||||||
`${url}/${exampleGraphName}/edge/${eName}/${e._key}`,
|
`${url}/${exampleGraphName}/edge/${eName}/${e._key}`,
|
||||||
{body: JSON.stringify(newEdge)}
|
newEdge);
|
||||||
);
|
|
||||||
|
|
||||||
expect(res.statusCode, description).to.equal(400);
|
expect(res.code, description).to.equal(400);
|
||||||
expect(res.json.errorNum, description)
|
expect(res.errorNum, description)
|
||||||
.to.equal(ERRORS.ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE.code);
|
.to.equal(ERRORS.ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -771,11 +716,9 @@ describe('_api/gharial', () => {
|
||||||
|
|
||||||
// get a (any) valid key of an existing edge document
|
// get a (any) valid key of an existing edge document
|
||||||
const _key = db.knows.any()._key;
|
const _key = db.knows.any()._key;
|
||||||
let req = request.put(url + '/' + exampleGraphName + '/edge/knows/' + _key, {
|
let req = arango.PUT(url + '/' + exampleGraphName + '/edge/knows/' + _key, edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(400);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE.code);
|
||||||
expect(req.statusCode).to.equal(400);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -794,11 +737,9 @@ describe('_api/gharial', () => {
|
||||||
|
|
||||||
// get a (any) valid key of an existing edge document
|
// get a (any) valid key of an existing edge document
|
||||||
const _key = db.knows.any()._key;
|
const _key = db.knows.any()._key;
|
||||||
let req = request.put(url + '/' + exampleGraphName + '/edge/knows/' + _key, {
|
let req = arango.PUT(url + '/' + exampleGraphName + '/edge/knows/' + _key, edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(400);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND.code);
|
||||||
expect(req.statusCode).to.equal(404);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -817,11 +758,9 @@ describe('_api/gharial', () => {
|
||||||
|
|
||||||
// get a (any) valid key of an existing edge document
|
// get a (any) valid key of an existing edge document
|
||||||
const _key = db.knows.any()._key;
|
const _key = db.knows.any()._key;
|
||||||
let req = request.put(url + '/' + exampleGraphName + '/edge/knows/' + _key, {
|
let req = arango.PUT(url + '/' + exampleGraphName + '/edge/knows/' + _key, edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(400);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND.code);
|
||||||
expect(req.statusCode).to.equal(404);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -840,11 +779,9 @@ describe('_api/gharial', () => {
|
||||||
|
|
||||||
// get a (any) valid key of an existing edge document
|
// get a (any) valid key of an existing edge document
|
||||||
const _key = db.knows.any()._key;
|
const _key = db.knows.any()._key;
|
||||||
let req = request.put(url + '/' + exampleGraphName + '/edge/knows/' + _key, {
|
let req = arango.PUT(url + '/' + exampleGraphName + '/edge/knows/' + _key, edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(404);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
||||||
expect(req.statusCode).to.equal(404);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -863,11 +800,9 @@ describe('_api/gharial', () => {
|
||||||
|
|
||||||
// get a (any) valid key of an existing edge document
|
// get a (any) valid key of an existing edge document
|
||||||
const _key = db.knows.any()._key;
|
const _key = db.knows.any()._key;
|
||||||
let req = request.put(url + '/' + exampleGraphName + '/edge/knows/' + _key, {
|
let req = arango.PUT(url + '/' + exampleGraphName + '/edge/knows/' + _key, edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(404);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
||||||
expect(req.statusCode).to.equal(404);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -886,11 +821,9 @@ describe('_api/gharial', () => {
|
||||||
|
|
||||||
// get a (any) valid key of an existing edge document
|
// get a (any) valid key of an existing edge document
|
||||||
const _key = db.knows.any()._key;
|
const _key = db.knows.any()._key;
|
||||||
let req = request.put(url + '/' + exampleGraphName + '/edge/knows/' + _key, {
|
let req = arango.PUT(url + '/' + exampleGraphName + '/edge/knows/' + _key, edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(404);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
||||||
expect(req.statusCode).to.equal(404);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -909,11 +842,9 @@ describe('_api/gharial', () => {
|
||||||
|
|
||||||
// get a (any) valid key of an existing edge document
|
// get a (any) valid key of an existing edge document
|
||||||
const _key = db.knows.any()._key;
|
const _key = db.knows.any()._key;
|
||||||
let req = request.patch(url + '/' + exampleGraphName + '/edge/knows/' + _key, {
|
let req = arango.PATCH(url + '/' + exampleGraphName + '/edge/knows/' + _key, edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(400);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE.code);
|
||||||
expect(req.statusCode).to.equal(400);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -932,11 +863,9 @@ describe('_api/gharial', () => {
|
||||||
|
|
||||||
// get a (any) valid key of an existing edge document
|
// get a (any) valid key of an existing edge document
|
||||||
const _key = db.knows.any()._key;
|
const _key = db.knows.any()._key;
|
||||||
let req = request.put(url + '/' + exampleGraphName + '/edge/knows/' + _key, {
|
let req = arango.PUT(url + '/' + exampleGraphName + '/edge/knows/' + _key, edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(404);
|
||||||
});
|
expect(req.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
||||||
expect(req.statusCode).to.equal(404);
|
|
||||||
expect(req.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code);
|
|
||||||
|
|
||||||
expect(db._collection(eName)).to.not.be.null;
|
expect(db._collection(eName)).to.not.be.null;
|
||||||
expect(db._collection(vName)).to.not.be.null;
|
expect(db._collection(vName)).to.not.be.null;
|
||||||
|
@ -964,16 +893,13 @@ describe('_api/gharial', () => {
|
||||||
expect(db[eName].all().toArray().length).to.equal(5);
|
expect(db[eName].all().toArray().length).to.equal(5);
|
||||||
|
|
||||||
// delete vertex bob
|
// delete vertex bob
|
||||||
const res = request.delete(
|
const res = arango.DELETE(
|
||||||
`${url}/${exampleGraphName}/vertex/${vName}/${bob}`
|
`${url}/${exampleGraphName}/vertex/${vName}/${bob}`
|
||||||
);
|
);
|
||||||
|
|
||||||
// check response
|
// check response
|
||||||
expect(res).to.be.an.instanceof(request.Response);
|
|
||||||
expect(res.body).to.be.a('string');
|
|
||||||
const body = JSON.parse(res.body);
|
|
||||||
// 202 without waitForSync (default)
|
// 202 without waitForSync (default)
|
||||||
expect(body).to.eql({
|
expect(res).to.eql({
|
||||||
error: false,
|
error: false,
|
||||||
code: 202,
|
code: 202,
|
||||||
removed: true
|
removed: true
|
||||||
|
@ -1031,16 +957,13 @@ describe('_api/gharial', () => {
|
||||||
expect(db[eName].all().toArray().length).to.equal(5);
|
expect(db[eName].all().toArray().length).to.equal(5);
|
||||||
|
|
||||||
// delete vertex bob
|
// delete vertex bob
|
||||||
const res = request.delete(
|
const res = arango.DELETE(
|
||||||
`${url}/${exampleGraphName}/vertex/${vName}/${bob}`
|
`${url}/${exampleGraphName}/vertex/${vName}/${bob}`
|
||||||
);
|
);
|
||||||
|
|
||||||
// check response
|
// check response
|
||||||
expect(res).to.be.an.instanceof(request.Response);
|
|
||||||
expect(res.body).to.be.a('string');
|
|
||||||
const body = JSON.parse(res.body);
|
|
||||||
// 202 without waitForSync (default)
|
// 202 without waitForSync (default)
|
||||||
expect(body).to.eql({
|
expect(res).to.eql({
|
||||||
error: false,
|
error: false,
|
||||||
code: 202,
|
code: 202,
|
||||||
removed: true
|
removed: true
|
||||||
|
@ -1094,18 +1017,14 @@ describe('_api/gharial', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// create the actual edge pointing from bob to alice
|
// create the actual edge pointing from bob to alice
|
||||||
let reqB = request.post(url + '/' + exampleGraphName + '/edge/' + eName_2, {
|
let reqB = arango.POST(url + '/' + exampleGraphName + '/edge/' + eName_2, edgeDefBToA);
|
||||||
body: JSON.stringify(edgeDefBToA)
|
expect(reqB.code).to.equal(202);
|
||||||
});
|
let bobToAlice = reqB.edge;
|
||||||
expect(reqB.statusCode).to.equal(202);
|
|
||||||
let bobToAlice = reqB.json.edge;
|
|
||||||
|
|
||||||
// create the actual edge pointing from alice to bob
|
// create the actual edge pointing from alice to bob
|
||||||
let reqA = request.post(url + '/' + exampleGraphName + '/edge/' + eName_2, {
|
let reqA = arango.POST(url + '/' + exampleGraphName + '/edge/' + eName_2, edgeDefAToB);
|
||||||
body: JSON.stringify(edgeDefAToB)
|
expect(reqA.code).to.equal(202);
|
||||||
});
|
let aliceToBob = reqA.edge;
|
||||||
expect(reqA.statusCode).to.equal(202);
|
|
||||||
let aliceToBob = reqA.json.edge;
|
|
||||||
|
|
||||||
|
|
||||||
// now create a new edge between the edges from A->B and B->A
|
// now create a new edge between the edges from A->B and B->A
|
||||||
|
@ -1114,12 +1033,10 @@ describe('_api/gharial', () => {
|
||||||
_to: bobToAlice._id
|
_to: bobToAlice._id
|
||||||
};
|
};
|
||||||
|
|
||||||
let reqx = request.post(url + '/' + exampleGraphName + '/edge/' + eName_2, {
|
let reqx = arango.POST(url + '/' + exampleGraphName + '/edge/' + eName_2, edgeLinkDef);
|
||||||
body: JSON.stringify(edgeLinkDef)
|
|
||||||
});
|
|
||||||
|
|
||||||
let newEdge = reqx.json.edge;
|
let newEdge = reqx.edge;
|
||||||
expect(reqx.statusCode).to.equal(202);
|
expect(reqx.code).to.equal(202);
|
||||||
|
|
||||||
const updateEdgeLinkDef = {
|
const updateEdgeLinkDef = {
|
||||||
_to: aliceToBob._id,
|
_to: aliceToBob._id,
|
||||||
|
@ -1127,23 +1044,19 @@ describe('_api/gharial', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// UPDATE that edge
|
// UPDATE that edge
|
||||||
reqx = request.patch(url + '/' + exampleGraphName + '/edge/' + eName_2 + "/" + newEdge._key, {
|
reqx = arango.PATCH(url + '/' + exampleGraphName + '/edge/' + eName_2 + "/" + newEdge._key, updateEdgeLinkDef);
|
||||||
body: JSON.stringify(updateEdgeLinkDef)
|
newEdge = reqx.edge;
|
||||||
});
|
expect(reqx.code).to.equal(202);
|
||||||
newEdge = reqx.json.edge;
|
|
||||||
expect(reqx.statusCode).to.equal(202);
|
|
||||||
|
|
||||||
// REPLACE that edge
|
// REPLACE that edge
|
||||||
reqx = request.put(url + '/' + exampleGraphName + '/edge/' + eName_2 + "/" + newEdge._key, {
|
reqx = arango.PUT(url + '/' + exampleGraphName + '/edge/' + eName_2 + "/" + newEdge._key, edgeLinkDef);
|
||||||
body: JSON.stringify(edgeLinkDef)
|
newEdge = reqx.edge;
|
||||||
});
|
expect(reqx.code).to.equal(202);
|
||||||
newEdge = reqx.json.edge;
|
|
||||||
expect(reqx.statusCode).to.equal(202);
|
|
||||||
|
|
||||||
// DELETE that edge
|
// DELETE that edge
|
||||||
reqx = request.delete(url + '/' + exampleGraphName + '/edge/' + eName_2 + "/" + newEdge._key, {
|
reqx = arango.DELETE(url + '/' + exampleGraphName + '/edge/' + eName_2 + "/" + newEdge._key, {
|
||||||
});
|
});
|
||||||
expect(reqx.statusCode).to.equal(202);
|
expect(reqx.code).to.equal(202);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1178,11 +1091,9 @@ describe('_api/gharial', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// create the actual edge pointing from bob to alice
|
// create the actual edge pointing from bob to alice
|
||||||
let req = request.post(url + '/' + exampleGraphName + '/edge/' + eName, {
|
let req = arango.POST(url + '/' + exampleGraphName + '/edge/' + eName, edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(202);
|
||||||
});
|
let bobToAlice = req.edge;
|
||||||
expect(req.statusCode).to.equal(202);
|
|
||||||
let bobToAlice = req.json.edge;
|
|
||||||
|
|
||||||
// now create a new edge between the edges from A->B and B->A
|
// now create a new edge between the edges from A->B and B->A
|
||||||
const edgeLinkDef = {
|
const edgeLinkDef = {
|
||||||
|
@ -1190,12 +1101,10 @@ describe('_api/gharial', () => {
|
||||||
_to: bobToAlice._id
|
_to: bobToAlice._id
|
||||||
};
|
};
|
||||||
|
|
||||||
let reqx = request.post(url + '/' + exampleGraphName + '/edge/' + eName, {
|
let reqx = arango.POST(url + '/' + exampleGraphName + '/edge/' + eName, edgeLinkDef);
|
||||||
body: JSON.stringify(edgeLinkDef)
|
expect(reqx.code).to.equal(404);
|
||||||
});
|
expect(reqx.errorNum).to.equal(ERRORS.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND.code);
|
||||||
expect(reqx.statusCode).to.equal(404);
|
expect(reqx.error).to.equal(true);
|
||||||
expect(reqx.json.errorNum).to.equal(ERRORS.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND.code);
|
|
||||||
expect(reqx.json.error).to.equal(true);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1217,13 +1126,13 @@ describe('_api/gharial', () => {
|
||||||
const doc = db[vName].document(key);
|
const doc = db[vName].document(key);
|
||||||
const revision = doc._rev; // get a valid revision
|
const revision = doc._rev; // get a valid revision
|
||||||
|
|
||||||
let req = request.get(url + '/' + exampleGraphName + '/edge/' + vName + '/' + key, {
|
let req = arango.GET(url + '/' + exampleGraphName + '/edge/' + vName + '/' + key, {
|
||||||
headers: {
|
headers: {
|
||||||
'if-match': revision
|
'if-match': revision
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
expect(req.statusCode).to.equal(200);
|
expect(req.code).to.equal(200);
|
||||||
expect(req.json.edge).to.deep.equal(doc);
|
expect(req.edge).to.deep.equal(doc);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should check if the if-match header is working - negative', () => {
|
it('should check if the if-match header is working - negative', () => {
|
||||||
|
@ -1246,15 +1155,12 @@ describe('_api/gharial', () => {
|
||||||
const revisions = [null, undefined, true, false, revision];
|
const revisions = [null, undefined, true, false, revision];
|
||||||
|
|
||||||
revisions.forEach(function (rev) {
|
revisions.forEach(function (rev) {
|
||||||
let req = request.get(url + '/' + exampleGraphName + '/edge/' + vName + '/' + key, {
|
let req = arango.GET(url + '/' + exampleGraphName + '/edge/' + vName + '/' + key, {
|
||||||
headers: {
|
|
||||||
'if-match': rev
|
'if-match': rev
|
||||||
}
|
|
||||||
});
|
});
|
||||||
expect(req.json.error).to.equal(true);
|
expect(req.error).to.equal(true);
|
||||||
expect(req.statusCode).to.equal(ERRORS.ERROR_HTTP_PRECONDITION_FAILED.code);
|
expect(req.code).to.equal(ERRORS.ERROR_HTTP_PRECONDITION_FAILED.code);
|
||||||
expect(req.json.code).to.equal(ERRORS.ERROR_HTTP_PRECONDITION_FAILED.code);
|
expect(req.errorMessage).to.equal(ERRORS.ERROR_HTTP_PRECONDITION_FAILED.message);
|
||||||
expect(req.json.errorMessage).to.equal(ERRORS.ERROR_HTTP_PRECONDITION_FAILED.message);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1274,13 +1180,10 @@ describe('_api/gharial', () => {
|
||||||
const doc = db[vName].document(key);
|
const doc = db[vName].document(key);
|
||||||
const revision = doc._rev; // get a valid revision
|
const revision = doc._rev; // get a valid revision
|
||||||
|
|
||||||
let req = request.get(url + '/' + exampleGraphName + '/edge/' + vName + '/' + key, {
|
let req = arango.GET(url + '/' + exampleGraphName + '/edge/' + vName + '/' + key, {
|
||||||
headers: {
|
|
||||||
'if-none-match': revision
|
'if-none-match': revision
|
||||||
}
|
|
||||||
});
|
});
|
||||||
expect(req.status).to.equal(304);
|
expect(req.code).to.equal(304);
|
||||||
expect(req.json).to.equal(undefined);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should check if the if-none-match header is working - negative', () => {
|
it('should check if the if-none-match header is working - negative', () => {
|
||||||
|
@ -1303,13 +1206,11 @@ describe('_api/gharial', () => {
|
||||||
const revisions = [null, undefined, true, false, revision];
|
const revisions = [null, undefined, true, false, revision];
|
||||||
|
|
||||||
revisions.forEach(function (rev) {
|
revisions.forEach(function (rev) {
|
||||||
let req = request.get(url + '/' + exampleGraphName + '/edge/' + vName + '/' + key, {
|
let req = arango.GET(url + '/' + exampleGraphName + '/edge/' + vName + '/' + key, {
|
||||||
headers: {
|
|
||||||
'if-none-match': rev
|
'if-none-match': rev
|
||||||
}
|
|
||||||
});
|
});
|
||||||
expect(req.statusCode).to.equal(200);
|
expect(req.code).to.equal(200);
|
||||||
expect(req.json.edge).to.deep.equal(doc);
|
expect(req.edge).to.deep.equal(doc);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1367,15 +1268,13 @@ describe('_api/gharial', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// create edge pointing from g2 to g1 (edge)
|
// create edge pointing from g2 to g1 (edge)
|
||||||
let req = request.post(url + '/' + 'secondGraph' + '/edge/secondEdge', {
|
let req = arango.POST(url + '/' + 'secondGraph' + '/edge/secondEdge', edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(202);
|
||||||
});
|
let toBeRemovedEdgeID = req.edge._id;
|
||||||
expect(req.statusCode).to.equal(202);
|
|
||||||
let toBeRemovedEdgeID = req.json.edge._id;
|
|
||||||
|
|
||||||
// now delete the target edge of g1
|
// now delete the target edge of g1
|
||||||
let req2 = request.delete(url + '/' + 'firstGraph' + '/edge/' + edgeID1);
|
let req2 = arango.DELETE(url + '/' + 'firstGraph' + '/edge/' + edgeID1);
|
||||||
expect(req2.statusCode).to.equal(202);
|
expect(req2.code).to.equal(202);
|
||||||
|
|
||||||
var deleted = false;
|
var deleted = false;
|
||||||
try {
|
try {
|
||||||
|
@ -1423,15 +1322,13 @@ describe('_api/gharial', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// create edge pointing from g2 to g1 (edge)
|
// create edge pointing from g2 to g1 (edge)
|
||||||
let req = request.post(url + '/' + 'secondGraph' + '/edge/secondEdge', {
|
let req = arango.POST(url + '/' + 'secondGraph' + '/edge/secondEdge', edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(202);
|
||||||
});
|
let toBeRemovedEdgeID = req.edge._id;
|
||||||
expect(req.statusCode).to.equal(202);
|
|
||||||
let toBeRemovedEdgeID = req.json.edge._id;
|
|
||||||
|
|
||||||
// now delete the target edge of g1 (a vertex)
|
// now delete the target edge of g1 (a vertex)
|
||||||
let req2 = request.delete(url + '/' + 'firstGraph' + '/vertex/' + vertexIDTo1);
|
let req2 = arango.DELETE(url + '/' + 'firstGraph' + '/vertex/' + vertexIDTo1);
|
||||||
expect(req2.statusCode).to.equal(202);
|
expect(req2.code).to.equal(202);
|
||||||
|
|
||||||
var deleted = false;
|
var deleted = false;
|
||||||
try {
|
try {
|
||||||
|
@ -1459,13 +1356,11 @@ describe('_api/gharial', () => {
|
||||||
to: [to]
|
to: [to]
|
||||||
};
|
};
|
||||||
var createAndDropEdgeDefinition = function () {
|
var createAndDropEdgeDefinition = function () {
|
||||||
let req = request.post(url + '/' + gName + '/edge', {
|
let req = arango.POST(url + '/' + gName + '/edge', edgeDef);
|
||||||
body: JSON.stringify(edgeDef)
|
expect(req.code).to.equal(202);
|
||||||
});
|
|
||||||
expect(req.statusCode).to.equal(202);
|
|
||||||
// now delete the created edge definition
|
// now delete the created edge definition
|
||||||
let req2 = request.delete(url + '/' + gName + '/edge/' + collection + '?dropCollections=true');
|
let req2 = arango.DELETE(url + '/' + gName + '/edge/' + collection + '?dropCollections=true');
|
||||||
expect(req2.statusCode).to.equal(202);
|
expect(req2.code).to.equal(202);
|
||||||
};
|
};
|
||||||
createAndDropEdgeDefinition();
|
createAndDropEdgeDefinition();
|
||||||
createAndDropEdgeDefinition();
|
createAndDropEdgeDefinition();
|
||||||
|
|
|
@ -1298,6 +1298,14 @@ describe ArangoDB do
|
||||||
doc.parsed_response['errorMessage'].should include("collection or view not found")
|
doc.parsed_response['errorMessage'].should include("collection or view not found")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check400Collection (doc)
|
||||||
|
doc.code.should eq(400)
|
||||||
|
doc.parsed_response['error'].should eq(true)
|
||||||
|
doc.parsed_response['code'].should eq(400)
|
||||||
|
doc.parsed_response['errorNum'].should eq(1203)
|
||||||
|
doc.parsed_response['errorMessage'].should include("no collection name specified")
|
||||||
|
end
|
||||||
|
|
||||||
def check400 (doc)
|
def check400 (doc)
|
||||||
doc.code.should eq(400)
|
doc.code.should eq(400)
|
||||||
doc.parsed_response['error'].should eq(true)
|
doc.parsed_response['error'].should eq(true)
|
||||||
|
@ -1338,7 +1346,7 @@ describe ArangoDB do
|
||||||
# Added _from and _to, because otherwise a 400 might conceal the
|
# Added _from and _to, because otherwise a 400 might conceal the
|
||||||
# 404. Another test checking that missing _from or _to trigger
|
# 404. Another test checking that missing _from or _to trigger
|
||||||
# errors was added to api-gharial-spec.js.
|
# errors was added to api-gharial-spec.js.
|
||||||
check404Collection(replace_edge( sync, graph_name, friend_collection, unknown_name, {"_from" => "xyz/1", "_to" => "abc/2"}))
|
check400Collection(replace_edge( sync, graph_name, friend_collection, unknown_name, {"_from" => "xyz/1", "_to" => "abc/2"}))
|
||||||
end
|
end
|
||||||
|
|
||||||
it "replace edge (document does not exist) not found" do
|
it "replace edge (document does not exist) not found" do
|
||||||
|
|
Loading…
Reference in New Issue