コード例 #1
0
    def setUp(self):
        '''sets up the test client'''
        self.app = createapp(os.getenv('APP_SETTINGS'))
        self.client = self.app.test_client()
        self.app_context = self.app.app_context()
        with self.app.app_context():
            drop_tables()
            create_tables()
        # variables for the user endpoints;
        # including but not limited to: logging in and signing up

        self.valid_entry = {
            "firstname": "solo",
            "lastname": "compredo",
            "othername": "nyakahia",
            "email": "*****@*****.**",
            "phoneNumber": "0723143761",
            "username": "******",
            "password": "******"
        }
コード例 #2
0
ファイル: test.py プロジェクト: AyonzOnTop/Fun_api
    def setUp(self):

        self.app = createapp()
        self.client = self.app.test_client
        self.database_name = "fun_api"
        self.database_path = getenv('DATABASE_URL', None)
        # setupdb(self.app, self.database_path)

        with self.app.app_context():
            self.db = SQLAlchemy()
            self.db.init_app(self.app)
            self.app.config['SQLALCHEMY_DATABASE_URI'] = self.database_path
            self.app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
            self.db.app = self.app
            self.endptheader = {
                'Authorization': 'Bearer {}'.format(accesstoken_endpointcheck)
            }
            self.adminheaders = {
                'Authorization': 'Bearer {}'.format(accesstoken_adminuser)
            }
            self.generalheaders = {
                'Authorization': 'Bearer {}'.format(accesstoken_generaluser)
            }
コード例 #3
0
from flask_frozen import Freezer
from flask import json
from app import createapp
import collections

if __name__ == '__main__':
    app = createapp()
    freezer = Freezer(app)

    data = json.load(app.open_resource('data.json'),
                     object_pairs_hook=collections.OrderedDict)

    @freezer.register_generator
    def product_url_generator():
        # Return a list. (Any iterable type will do.)
        paths = ['/', '/en-US/']
        for k, p in data["source"].iteritems():
            for lang in p['lang']:
                paths.append('/' + lang + '/' + k + '.html')
        print paths
        return paths

    freezer.freeze()
コード例 #4
0
ファイル: freeze.py プロジェクト: MDTsai/socialapi-directory
from flask_frozen import Freezer
from flask import json
from app import createapp;
import collections

if __name__ == '__main__':
  app = createapp()
  freezer = Freezer(app)

  data = json.load(app.open_resource('data.json'), object_pairs_hook=collections.OrderedDict)

  @freezer.register_generator
  def product_url_generator():
      # Return a list. (Any iterable type will do.)
      paths = [
          '/',
          '/en-US/'
      ]
      for k, p in data["source"].iteritems():
        for lang in p['lang']:
          paths.append('/'+lang+'/'+k+'.html')
      print paths
      return paths

  freezer.freeze()
コード例 #5
0
 def setUp(self):
     self.app = createapp()
     self.client = self.app.test_client()
     self.office1 = {"type": "Member of Paliament", "name": "MP Nairobi"}
     self.erroroffice = {}
コード例 #6
0
import os
from app import createapp

config_name = os.getenv('APP_SETTINGS')
app = createapp(config_name)

if __name__ == '__main__':
    app.run(debug= 1)
コード例 #7
0
 def setUp(self):
     self.app = createapp()
     self.client = self.app.test_client()
     self.party1 = {"name": "Part Theo", "logoUrl": ""}
     self.partytodelete = {"name": "Party 230", "logoUrl": ""}
     self.invalidparty = {"_id": 1}