示例#1
0
 def setUp(self):
     self.config = testing.setUp()
     setup_routes(self.config)
     self.session = setup_database()
     self.testuser = User(username='******', password='******')
     self.session.add(self.testuser)
     self.session.flush()
示例#2
0
 def setUp(self):
     self.config = testing.setUp()
     setup_routes(self.config)
     self.session = setup_database()
     self.testuser = User(username='******', password='******')
     self.session.add(self.testuser)
     self.session.flush()
示例#3
0
 def setUp(self):
     self.config = testing.setUp()
     setup_routes(self.config)
     self.session = setup_database()
     with transaction.manager:
         self.testuser = User(username='******', password='******')
         self.session.add(self.testuser)
示例#4
0
文件: scripts.py 项目: Graoumpf/ccvpn
 def setUp(self):
     self.config = testing.setUp()
     self.session = setup_database()
     with transaction.manager:
         self.testuser = User(username='******', password='******')
         self.session.add(self.testuser)
         self.testorder = models.Order(user=self.testuser.id, amount=2,
                                method=models.Order.METHOD.BITCOIN,
                                time=datetime.timedelta(days=30))
示例#5
0
    def setUp(self):
        self.config = testing.setUp()
        setup_routes(self.config)
        self.session = setup_database()

        self.paiduser = User(username='******', password='******')
        self.paiduser.add_paid_time(datetime.timedelta(days=30))
        self.session.add(self.paiduser)
        self.session.flush()

        self.profile = Profile(uid=self.paiduser.id, name='testprofile')
        self.session.add(self.profile)

        self.freeuser = User(username='******', password='******')
        self.session.add(self.freeuser)

        duser = User(username='******', password='******')
        duser.is_active = False
        duser.add_paid_time(datetime.timedelta(days=30))
        self.session.add(duser)

        self.gw0 = Gateway(name='gw0',
                           token='simple_gateway',
                           isp_name='',
                           isp_url='',
                           country='')
        self.session.add(self.gw0)

        self.gw1 = Gateway(name='gw1',
                           token='disabled_gateway',
                           isp_name='',
                           isp_url='',
                           country='')
        self.gw1.enabled = False
        self.session.add(self.gw1)

        self.gw2 = Gateway(name='gw2',
                           token='ipv4_gateway',
                           isp_name='',
                           isp_url='',
                           country='',
                           ipv4='1.2.3.4')
        self.session.add(self.gw2)

        self.gw3 = Gateway(name='gw3',
                           token='ipv6_gateway',
                           isp_name='',
                           isp_url='',
                           country='',
                           ipv6='1:2:3:4:5:6:7:8')
        self.session.add(self.gw3)
        self.session.flush()

        self.testheaders = {
            'X-Gateway-Token': 'simple_gateway',
            'X-Gateway-Version': 'alpha',
        }
示例#6
0
文件: models.py 项目: Logolo/ccvpn
    def setUp(self):
        self.config = testing.setUp()
        self.session = setup_database()
        with transaction.manager:
            self.u = User(username='******', password='******')
            DBSession.add(self.u)

            self.pu = User(username='******', password='******')
            self.pu.add_paid_time(datetime.timedelta(days=30))
            DBSession.add(self.pu)
示例#7
0
文件: scripts.py 项目: Graoumpf/ccvpn
 def setUp(self):
     self.config = testing.setUp()
     self.session = setup_database()
     with transaction.manager:
         self.testuser = User(username='******', password='******')
         self.session.add(self.testuser)
         self.testorder = models.Order(user=self.testuser.id,
                                       amount=2,
                                       method=models.Order.METHOD.BITCOIN,
                                       time=datetime.timedelta(days=30))
示例#8
0
文件: models.py 项目: Graoumpf/ccvpn
    def setUp(self):
        self.config = testing.setUp()
        self.session = setup_database()
        self.u = User(username='******', password='******')
        DBSession.add(self.u)
        self.session.flush()

        self.pu = User(username='******', password='******')
        self.pu.add_paid_time(datetime.timedelta(days=30))
        DBSession.add(self.pu)
        self.session.flush()
示例#9
0
    def setUp(self):
        settings = {'mako.directories': 'ccvpn:templates/'}
        self.config = testing.setUp(settings=settings)
        setup_routes(self.config)
        self.session = setup_database()

        self.testuser = User(username='******', password='******')
        self.session.add(self.testuser)
        self.session.flush()
        profile = Profile(uid=self.testuser.id, name='testprofile')
        self.session.add(profile)
        self.session.flush()
示例#10
0
    def setUp(self):
        settings = {
            'mako.directories': 'ccvpn:templates/'
        }
        self.config = testing.setUp(settings=settings)
        setup_routes(self.config)
        self.session = setup_database()

        with transaction.manager:
            self.testuser = User(username='******', password='******')
            self.session.add(self.testuser)
        with transaction.manager:
            self.testcode = GiftCode(datetime.timedelta(days=7))
            self.session.add(self.testcode)
示例#11
0
    def setUp(self):
        settings = {
            'mako.directories': 'ccvpn:templates/'
        }
        self.config = testing.setUp(settings=settings)
        setup_routes(self.config)
        self.session = setup_database()

        self.testuser = User(username='******', password='******')
        self.session.add(self.testuser)
        self.session.flush()
        profile = Profile(uid=self.testuser.id, name='testprofile')
        self.session.add(profile)
        self.session.flush()
示例#12
0
    def setUp(self):
        settings = {'mako.directories': 'ccvpn:templates/'}
        self.config = testing.setUp(settings=settings)
        setup_routes(self.config)
        self.session = setup_database()

        self.testuser = User(username='******', password='******')
        self.session.add(self.testuser)
        self.testadmin = User(username='******', password='******')
        self.testadmin.is_admin = True
        self.session.add(self.testadmin)
        self.session.flush()
        self.testcode = GiftCode(datetime.timedelta(days=7))
        self.session.add(self.testcode)
        self.session.flush()
示例#13
0
    def setUp(self):
        settings = {
            'mail.default_sender': 'root@lo',
            'mako.directories': 'ccvpn:templates/'
        }
        self.config = testing.setUp(settings=settings)
        setup_routes(self.config)
        self.config.include('pyramid_mailer.testing')
        self.session = setup_database()

        testuser = User(username='******', password='******', email='user@host')
        self.session.add(testuser)
        self.session.flush()
        self.token = PasswordResetToken(uid=testuser.id)
        self.session.add(self.token)
        self.session.flush()
示例#14
0
    def setUp(self):
        settings = {
            'mail.default_sender': 'root@lo',
            'mako.directories': 'ccvpn:templates/'
        }
        self.config = testing.setUp(settings=settings)
        setup_routes(self.config)
        self.config.include('pyramid_mailer.testing')
        self.session = setup_database()

        with transaction.manager:
            testuser = User(username='******', password='******',
                            email='user@host')
            self.session.add(testuser)
            testuserw = User(username='******', password='******')
            self.session.add(testuserw)
示例#15
0
    def setUp(self):
        settings = {
            'mako.directories': 'ccvpn:templates/'
        }
        self.config = testing.setUp(settings=settings)
        setup_routes(self.config)
        self.session = setup_database()

        self.testuser = User(username='******', password='******')
        self.session.add(self.testuser)
        self.testadmin = User(username='******', password='******')
        self.testadmin.is_admin = True
        self.session.add(self.testadmin)
        self.session.flush()
        self.testcode = GiftCode(datetime.timedelta(days=7))
        self.session.add(self.testcode)
        self.session.flush()
示例#16
0
    def setUp(self):
        settings = {
            'mail.default_sender': 'root@lo',
            'mako.directories': 'ccvpn:templates/'
        }
        self.config = testing.setUp(settings=settings)
        setup_routes(self.config)
        self.config.include('pyramid_mailer.testing')
        self.session = setup_database()

        with transaction.manager:
            testuser = User(username='******',
                            password='******',
                            email='user@host')
            self.session.add(testuser)
            testuserw = User(username='******', password='******')
            self.session.add(testuserw)
示例#17
0
    def setUp(self):
        settings = {
            'mail.default_sender': 'root@lo',
            'mako.directories': 'ccvpn:templates/'
        }
        self.config = testing.setUp(settings=settings)
        setup_routes(self.config)
        self.config.include('pyramid_mailer.testing')
        self.session = setup_database()

        testuser = User(username='******', password='******',
                        email='user@host')
        self.session.add(testuser)
        self.session.flush()
        self.token = PasswordResetToken(uid=testuser.id)
        self.session.add(self.token)
        self.session.flush()
示例#18
0
    def setUp(self):
        self.config = testing.setUp()
        setup_routes(self.config)
        self.session = setup_database()

        self.paiduser = User(username='******', password='******')
        self.paiduser.add_paid_time(datetime.timedelta(days=30))
        self.session.add(self.paiduser)
        self.session.flush()

        self.profile = Profile(uid=self.paiduser.id, name='testprofile')
        self.session.add(self.profile)

        self.freeuser = User(username='******', password='******')
        self.session.add(self.freeuser)

        duser = User(username='******', password='******')
        duser.is_active = False
        duser.add_paid_time(datetime.timedelta(days=30))
        self.session.add(duser)

        self.gw0 = Gateway(name='gw0', token='simple_gateway',
                      isp_name='', isp_url='', country='')
        self.session.add(self.gw0)

        self.gw1 = Gateway(name='gw1', token='disabled_gateway',
                      isp_name='', isp_url='', country='')
        self.gw1.enabled = False
        self.session.add(self.gw1)

        self.gw2 = Gateway(name='gw2', token='ipv4_gateway',
                      isp_name='', isp_url='', country='',
                      ipv4='1.2.3.4')
        self.session.add(self.gw2)

        self.gw3 = Gateway(name='gw3', token='ipv6_gateway',
                      isp_name='', isp_url='', country='',
                      ipv6='1:2:3:4:5:6:7:8')
        self.session.add(self.gw3)
        self.session.flush()

        self.testheaders = {
            'X-Gateway-Token': 'simple_gateway',
            'X-Gateway-Version': 'alpha',
        }
示例#19
0
文件: views_api.py 项目: Logolo/ccvpn
    def setUp(self):
        self.config = testing.setUp()
        setup_routes(self.config)
        self.session = setup_database()

        with transaction.manager:
            user = User(username='******', password='******')
            user.add_paid_time(datetime.timedelta(days=30))
            baduser = User(username='******', password='******')
            self.session.add(user)
            self.session.add(baduser)
        with transaction.manager:
            token = APIAccessToken(token='apitoken')
            self.session.add(token)

            restricted_token = APIAccessToken(token='restricted_apitoken')
            restricted_token.remote_addr = '127.0.0.1'
            self.session.add(restricted_token)
        with transaction.manager:
            profile = Profile(uid=user.id, name='testprofile')
            self.session.add(profile)
示例#20
0
文件: models.py 项目: Logolo/ccvpn
 def setUp(self):
     self.config = testing.setUp()
     self.session = setup_database()
     with transaction.manager:
         u = User(username='******', email='test@host', password='******')
         DBSession.add(u)
示例#21
0
 def setUp(self):
     self.config = testing.setUp()
     setup_routes(self.config)
     self.session = setup_database()
示例#22
0
文件: models.py 项目: Graoumpf/ccvpn
 def setUp(self):
     self.config = testing.setUp()
     self.session = setup_database()
     u = User(username='******', email='test@host', password='******')
     DBSession.add(u)
     self.session.flush()
示例#23
0
 def setUp(self):
     self.config = testing.setUp()
     setup_routes(self.config)
     self.session = setup_database()
示例#24
0
文件: models.py 项目: Graoumpf/ccvpn
 def setUp(self):
     self.config = testing.setUp()
     self.session = setup_database()
     u = User(username='******', email='test@host', password='******')
     DBSession.add(u)
     self.session.flush()