Skip to content

Commit 5bfaa5c

Browse files
committed
Merge pull request #45 from neo4j/1.0-tck
1.0 tck - Added auth and ignoring StatementResult API steps
2 parents aa8d80a + 1829c39 commit 5bfaa5c

File tree

7 files changed

+166
-1
lines changed

7 files changed

+166
-1
lines changed

gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ gulp.task('run-tck', ['download-tck', 'nodejs'], function() {
205205
return gulp.src(featureHome + "/*").pipe(cucumber({
206206
'steps': 'test/v1/tck/steps/*.js',
207207
'format': 'pretty',
208-
'tags' : ['~@in_dev', '~@db', '~@equality']
208+
'tags' : ['~@in_dev', '~@db', '~@equality', '~@streaming_and_cursor_navigation']
209209
}));
210210
});
211211

test/v1/tck/steps/authsteps.js

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/**
2+
* Copyright (c) 2002-2016 "Neo Technology,"
3+
* Network Engine for Objects in Lund AB [http://neotechnology.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
20+
var neo4j = require("../../../../lib/v1");
21+
var util = require("./util")
22+
23+
module.exports = function () {
24+
25+
var username = "user"
26+
var password = "password"
27+
28+
this.Given(/^a driver is configured with auth enabled and correct password is provided$/, function () {
29+
this.driver.close();
30+
this.driver = neo4j.driver("bolt://localhost", neo4j.auth.basic("neo4j", "neo4j"));
31+
});
32+
33+
this.Then(/^reading and writing to the database should be possible$/, function (callback) {
34+
var session = this.driver.session()
35+
session.run("CREATE (:label1)").then( function( ) {
36+
callback();
37+
}).catch(function(err) {callback(new Error("Rejected Promise: " + err))});
38+
});
39+
40+
this.Given(/^a driver is configured with auth enabled and the wrong password is provided$/, function () {
41+
this.driver.close();
42+
this.driver = neo4j.driver("bolt://localhost", neo4j.auth.basic("neo4j", "wrong"));
43+
});
44+
45+
this.Then(/^reading and writing to the database should not be possible$/, function (callback) {
46+
var session = this.driver.session()
47+
var self = this;
48+
session.run("CREATE (:label1)").then( function( ) {
49+
callback(new Error("Should not be able to run session!"));
50+
}).catch( function(err) {
51+
self.err = err;
52+
callback();
53+
});
54+
});
55+
56+
this.Then(/^a `Protocol Error` is raised$/, function () {
57+
var message = this.err.fields[0].message
58+
var code = this.err.fields[0].code
59+
var expectedStartOfMessage = 'The client is unauthorized due to authentication failure.'
60+
var expectedCode = 'Neo.ClientError.Security.Unauthorized'
61+
62+
if (! message.startsWith(expectedStartOfMessage)) {
63+
throw new Error("Wrong error messsage. Expected: '" + expectedStartOfMessage + "'. Got: '" + message + "'");
64+
}
65+
66+
if ( code != expectedCode) {
67+
throw new Error("Wrong error code. Expected: '" + expectedCode + "'. Got: '" + code + "'");
68+
}
69+
});
70+
}

test/v1/tck/steps/environment.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/**
2+
* Copyright (c) 2002-2016 "Neo Technology,"
3+
* Network Engine for Objects in Lund AB [http://neotechnology.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
120
var neo4j = require("../../../../lib/v1");
221

322
module.exports = function () {

test/v1/tck/steps/matchacceptencesteps.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/**
2+
* Copyright (c) 2002-2016 "Neo Technology,"
3+
* Network Engine for Objects in Lund AB [http://neotechnology.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
120
var neo4j = require("../../../../lib/v1");
221
var util = require("./util")
322

test/v1/tck/steps/resultapisteps.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/**
2+
* Copyright (c) 2002-2016 "Neo Technology,"
3+
* Network Engine for Objects in Lund AB [http://neotechnology.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
120
var neo4j = require("../../../../lib/v1");
221
var resultSummary = require("../../../../lib/v1/result-summary");
322
var util = require("./util")

test/v1/tck/steps/tyepesystemsteps.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/**
2+
* Copyright (c) 2002-2016 "Neo Technology,"
3+
* Network Engine for Objects in Lund AB [http://neotechnology.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
120
var neo4j = require("../../../../lib/v1");
221
var util = require("./util");
322

test/v1/tck/steps/util.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/**
2+
* Copyright (c) 2002-2016 "Neo Technology,"
3+
* Network Engine for Objects in Lund AB [http://neotechnology.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
120
var neo4j = require("../../../../lib/v1");
221

322
INT = 'integer';

0 commit comments

Comments
 (0)