
from flask.ext.testing import TestCase

from abilian.application import Application
from abilian.core.entities import db


class TestConfig(object):
  SQLALCHEMY_DATABASE_URI = "sqlite://"
  SQLALCHEMY_ECHO = False


class BaseTestCase(TestCase):

  config_class = TestConfig

  def create_app(self):
    config = self.config_class()
    self.app = Application(config)
    return self.app

  def setUp(self):
    self.app.create_db()
    self.session = db.session

  def tearDown(self):
    db.session.remove()
    db.drop_all()
    db.engine.dispose()


from flask.ext.testing import TestCase

from abilian.application import Application
from abilian.core.entities import db


class TestConfig(object):
  SQLALCHEMY_DATABASE_URI = "sqlite://"
  SQLALCHEMY_ECHO = False
  TESTING = True


class BaseTestCase(TestCase):

  config_class = TestConfig
  application_class = Application

  def create_app(self):
    config = self.config_class()
    self.app = self.application_class(config)
    return self.app

  def setUp(self):
    self.app.create_db()
    self.session = db.session

  def tearDown(self):
    db.session.remove()
    db.drop_all()
    db.engine.dispose()

Add TESTING-True in test config.
Add TESTING-True in test config.

  
  from flask.ext.testing import TestCase
  
  from abilian.application import Application
  from abilian.core.entities import db
  
  
  class TestConfig(object):
    SQLALCHEMY_DATABASE_URI = "sqlite://"
    SQLALCHEMY_ECHO = False
+   TESTING = True
  
  
  class BaseTestCase(TestCase):
  
    config_class = TestConfig
+   application_class = Application
  
    def create_app(self):
      config = self.config_class()
-     self.app = Application(config)
+     self.app = self.application_class(config)
      return self.app
  
    def setUp(self):
      self.app.create_db()
      self.session = db.session
  
    def tearDown(self):
      db.session.remove()
      db.drop_all()
      db.engine.dispose()
  
Add TESTING-True in test config.
## Code Before:

from flask.ext.testing import TestCase

from abilian.application import Application
from abilian.core.entities import db


class TestConfig(object):
  SQLALCHEMY_DATABASE_URI = "sqlite://"
  SQLALCHEMY_ECHO = False


class BaseTestCase(TestCase):

  config_class = TestConfig

  def create_app(self):
    config = self.config_class()
    self.app = Application(config)
    return self.app

  def setUp(self):
    self.app.create_db()
    self.session = db.session

  def tearDown(self):
    db.session.remove()
    db.drop_all()
    db.engine.dispose()

## Instruction:
Add TESTING-True in test config.
## Code After:

from flask.ext.testing import TestCase

from abilian.application import Application
from abilian.core.entities import db


class TestConfig(object):
  SQLALCHEMY_DATABASE_URI = "sqlite://"
  SQLALCHEMY_ECHO = False
  TESTING = True


class BaseTestCase(TestCase):

  config_class = TestConfig
  application_class = Application

  def create_app(self):
    config = self.config_class()
    self.app = self.application_class(config)
    return self.app

  def setUp(self):
    self.app.create_db()
    self.session = db.session

  def tearDown(self):
    db.session.remove()
    db.drop_all()
    db.engine.dispose()
