# Path: tests/base.py
# class TestCase(_TestCase):
#     db = db
# 
#     def create_app(self):
#         app.config.from_object('tests.settings_test')
#         app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:'
#         return app
# 
#     def setUp(self):
#         db.create_all()
#         self.user = create_admin()
# 
#     def tearDown(self):
#         db.session.remove()
#         db.drop_all()
# 
#     def login(self, email=None, password=None):
#         data = dict(
#             email=email or self.app.config['ADMIN_USER']['email'],
#             password=password or self.app.config['ADMIN_USER']['password'],
#             remember=True,
#         )
#         return self.client.post('/user/sign-in', data=data,
#                                 follow_redirects=True)
# 
#     def logout(self):
#         return self.client.get('/user/sign-out', follow_redirects=True)
# 
#     def assertRedirectToLogin(self, response, next_url):
#         expected = '/user/sign-in?next=http%3A//localhost{0}'.format(next_url)
#         self.assertRedirects(response, expected)
# 
# Path: app/accounts/models.py
# class FreeEmailProvider(db.Model, models.BaseModelMixin):
#     __tablename__ = 'free_email_providers'
# 
#     domain = db.Column(db.Unicode(255), nullable=False, index=True)
# 
#     def __unicode__(self):
#         return self.domain
# 
#     @classmethod
#     def exists(cls, domain):
#         return bool(cls.query.filter(cls.domain == domain).first())


from flask import url_for
from tests.base import TestCase
from app.accounts.models import FreeEmailProvider



class FreeEmailProviderTestCase(TestCase):
    def setUp(self):
        super(FreeEmailProviderTestCase, self).setUp()
        self.url = url_for('accounts.free_email_providers_list')


# Path: tests/base.py
# class TestCase(_TestCase):
#     db = db
# 
#     def create_app(self):
#         app.config.from_object('tests.settings_test')
#         app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:'
#         return app
# 
#     def setUp(self):
#         db.create_all()
#         self.user = create_admin()
# 
#     def tearDown(self):
#         db.session.remove()
#         db.drop_all()
# 
#     def login(self, email=None, password=None):
#         data = dict(
#             email=email or self.app.config['ADMIN_USER']['email'],
#             password=password or self.app.config['ADMIN_USER']['password'],
#             remember=True,
#         )
#         return self.client.post('/user/sign-in', data=data,
#                                 follow_redirects=True)
# 
#     def logout(self):
#         return self.client.get('/user/sign-out', follow_redirects=True)
# 
#     def assertRedirectToLogin(self, response, next_url):
#         expected = '/user/sign-in?next=http%3A//localhost{0}'.format(next_url)
#         self.assertRedirects(response, expected)
# 
# Path: app/accounts/models.py
# class FreeEmailProvider(db.Model, models.BaseModelMixin):
#     __tablename__ = 'free_email_providers'
# 
#     domain = db.Column(db.Unicode(255), nullable=False, index=True)
# 
#     def __unicode__(self):
#         return self.domain
# 
#     @classmethod
#     def exists(cls, domain):
#         return bool(cls.query.filter(cls.domain == domain).first())


# Path: tests/test_fep.py
from flask import url_for
from tests.base import TestCase
from app.accounts.models import FreeEmailProvider




class FreeEmailProviderTestCase(TestCase):
    def setUp(self):
        super(FreeEmailProviderTestCase, self).setUp()
        self.url = url_for('accounts.free_email_providers_list')


        self.items = [FreeEmailProvider(domain='%s+freedomain.com' % i)