var expect = require('chai').expect;
var db = require('../database');
var users = db.get('users');
var posts = db.get('posts');

before(function () {
  users.insert({
    provider: 'localhost',
    identifier: '1337',
    email: 'test@localhost',
    name: 'testuser',
    apiKey: 'thetestuserapikey'
  });
  users.insert({
    provider: 'localhost',
    identifier: '1338',
    email: 'someone@localhost',
    name: 'someone else',
    apiKey: 'theotheruserapikey'
  });
});

after(function () {
  users.remove({apiKey: 'thetestuserapikey'});
  users.remove({apiKey: 'theotheruserapikey'});
});
@@ -478,32 +478,36 @@
 after(function (
+done
 ) %7B%0A  users.remo
@@ -494,37 +494,38 @@
 done) %7B%0A  users.
-remov
+findOn
 e(%7BapiKey: 'thet
@@ -539,19 +539,87 @@
 apikey'%7D
+, function (err, testuser) %7B%0A    posts.remove(%7Buser: testuser._id%7D
 );%0A
+  
   users.
@@ -629,37 +629,192 @@
 ove(
-%7BapiKey: 'theotheruserapikey'
+testuser);%0A    users.findOne(%7BapiKey: 'theotheruserapikey'%7D, function (err, testuser) %7B%0A      posts.remove(%7Buser: testuser._id%7D);%0A      users.remove(testuser);%0A      done();%0A    %7D);%0A  
 %7D);%0A

Delete all posts created by the tests.