formatting and semi colons

This commit is contained in:
Simon Tokumine 2012-06-01 21:12:29 +01:00
parent 7c15a1218a
commit aa1e306881

View File

@ -44,7 +44,7 @@ exports['test username returns interpolated db if user set'] = function(){
exports['test private user can execute SELECTS on db'] = function(){
var pg = new PSQL('1');
var sql = "SELECT 1 as test_sum"
var sql = "SELECT 1 as test_sum";
pg.query(sql, function(err, result){
assert.equal(result.rows[0].test_sum, 1);
pg.end();
@ -53,7 +53,7 @@ exports['test private user can execute SELECTS on db'] = function(){
exports['test private user can execute CREATE on db'] = function(){
var pg = new PSQL('1');
var sql = "DROP TABLE IF EXISTS distributors; CREATE TABLE distributors (id integer, name varchar(40), UNIQUE(name))"
var sql = "DROP TABLE IF EXISTS distributors; CREATE TABLE distributors (id integer, name varchar(40), UNIQUE(name))";
pg.query(sql, function(err, result){
assert.isNull(err);
pg.end();
@ -62,9 +62,9 @@ exports['test private user can execute CREATE on db'] = function(){
exports['test private user can execute INSERT on db'] = function(){
var pg = new PSQL('1');
var sql = "DROP TABLE IF EXISTS distributors1; CREATE TABLE distributors1 (id integer, name varchar(40), UNIQUE(name))"
var sql = "DROP TABLE IF EXISTS distributors1; CREATE TABLE distributors1 (id integer, name varchar(40), UNIQUE(name))";
pg.query(sql, function(err, result){
sql = "INSERT INTO distributors1 (id, name) VALUES (1, 'fish')"
sql = "INSERT INTO distributors1 (id, name) VALUES (1, 'fish')";
pg.query(sql,function(err, result){
assert.eql(result.rows, []);
pg.end();
@ -74,7 +74,7 @@ exports['test private user can execute INSERT on db'] = function(){
exports['test publicuser can execute SELECT on enabled tables'] = function(){
var pg = new PSQL("1");
var sql = "DROP TABLE IF EXISTS distributors2; CREATE TABLE distributors2 (id integer, name varchar(40), UNIQUE(name)); GRANT SELECT ON distributors2 TO publicuser;"
var sql = "DROP TABLE IF EXISTS distributors2; CREATE TABLE distributors2 (id integer, name varchar(40), UNIQUE(name)); GRANT SELECT ON distributors2 TO publicuser;";
pg.query(sql, function(err, result){
pg.end();
@ -84,18 +84,18 @@ exports['test publicuser can execute SELECT on enabled tables'] = function(){
pg.end();
});
});
}
};
exports['test publicuser cannot execute INSERT on db'] = function(){
var pg = new PSQL("1");
var sql = "DROP TABLE IF EXISTS distributors3; CREATE TABLE distributors3 (id integer, name varchar(40), UNIQUE(name)); GRANT SELECT ON distributors3 TO publicuser;"
var sql = "DROP TABLE IF EXISTS distributors3; CREATE TABLE distributors3 (id integer, name varchar(40), UNIQUE(name)); GRANT SELECT ON distributors3 TO publicuser;";
pg.query(sql, function(err, result){
pg.end();
pg = new PSQL(null, 'cartodb_test_user_1_db'); //anonymous user
pg.query("INSERT INTO distributors3 (id, name) VALUES (1, 'fishy')", function(err, result){
assert.eql(err.message, 'permission denied for relation distributors3')
assert.eql(err.message, 'permission denied for relation distributors3');
pg.end();
});
});
}
};