'Logs in a user and creates model.
Tests for 200 status on deletion and for the deleted object.
Tests that the deleted object no longer exists.'

def _test_model(self, name, data):

    self._login_user()
    path = (get_path() if (name == 'event') else get_path(1, (name + 's')))
    response = self.app.post(path, data=json.dumps(data), headers={'Content-Type': 'application/json'})
    self.assertEqual(response.status_code, 201)
    path = (get_path(1) if (name == 'event') else get_path(1, (name + 's'), 1))
    response = self.app.delete(path)
    self.assertEqual(response.status_code, 200)
    self.assertIn(('Test' + str(name).title()), response.data)
    response = self.app.get(path)
    self.assertEqual(response.status_code, 404)
    self.assertIn('does    not    exist', response.data)
