[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [bodega-server/store_channels] server/test: provide and after() routine that cleans up in case of fa
From:       Aaron Seigo <aseigo () kde ! org>
Date:       2013-05-31 16:56:34
Message-ID: 20130531165634.5F471A6067 () git ! kde ! org
[Download RAW message or body]

Git commit 54b2265d91b562e4956ec84b1f890bef611394b7 by Aaron Seigo.
Committed on 31/05/2013 at 18:24.
Pushed by aseigo into branch 'store_channels'.

provide and after() routine that cleans up in case of failures

M  +17   -0    server/test/store.js

http://commits.kde.org/bodega-server/54b2265d91b562e4956ec84b1f890bef611394b7

diff --git a/server/test/store.js b/server/test/store.js
index 80a5eec..a888d82 100644
--- a/server/test/store.js
+++ b/server/test/store.js
@@ -15,6 +15,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>
 */
 
+var pg = require('pg');
 var server = require('../app.js');
 var utils = require('./support/http');
 var queryString = require('querystring');
@@ -456,4 +457,20 @@ describe('Store management', function(){
                     cookie);
            });
     });
+
+    // always delete the two stores we made, even on error
+    after(function(done) {
+        var connectionString = app.config.database.protocol + "://" +
+                               app.config.database.user + ":" + \
app.config.database.password + +                               "@" + \
app.config.database.host + "/" + +                               \
app.config.database.name; +
+        pg.connect(connectionString, function(err, client, finis) {
+                   client.query("delete from stores where id = \
'2_FUN_TIMES_WITH_CLOWNS' or id = 'somethingcrazy'", [], +                   \
function(err, result) { +                       done();
+                   });
+        });
+    });
+
 });


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic