Example #1
0
 def setUp(self):
     with APP.app_context():
         self.app = APP.test_client()
         self.request_headers = RequestHeaders(
             {'Authorization': 'Bearer ' + AuthToken.generate('testsource')})
         self.log_file = 'test/fixtures/example-1.log'
         self.log_data = open(self.log_file, 'rb').read()
Example #2
0
        def inner(*args, **kwargs):
            # Default HTTP return code
            returned_code_value = 444

            returned_data = ""

            try:
                # Getting the returned value
                returned_code_value, returned_data = func(*args, **kwargs)
            except TypeError as err:
                print("Error when processing function: {msg}".format(msg=err))
                if not returned_data:
                    return APP.response_class(
                        response=json.dumps("NO DATA TO RETURN"),
                        status=406,
                        mimetype='application/json')

            if not isinstance(returned_data, dict):
                response = APP.response_class(
                    response=json.dumps("DATA CASTING ERROR"),
                    status=406,
                    mimetype='application/json')
            else:
                response = APP.response_class(
                    response=json.dumps(returned_data),
                    status=returned_code_value,
                    mimetype='application/json')

            # Returning the value to the original frame
            return response
Example #3
0
 def setUp(self):
     with APP.app_context():
         self.app = APP.test_client()
         self.request_headers = RequestHeaders({
             'Authorization':
             'Bearer ' + AuthToken.generate('testsource')
         })
    def run(self):
        from app import APP
        APP.Functions.set_process_name ( "0@TFTPD" )        
        logger = APP.LoggingClient ( name="TFTPD" )
        
        controller = APP.Controller( APP.BE.CONTROLLER.tftpd )
        
        logger ( "Initializing the server." )
        server_process = Process ( name="TFTPD_LISTEN", target=ProvisioningTFTPServer )
        server_process.start()
        
        while True:
            action = APP.ControllerWait ( controller )
            if action == "STOP": break
        
        logger ("Terminating the server.")
        os.kill ( server_process.pid, signal.SIGHUP )        
        logger ("Waiting for all children to exit.")                
        server_process.join()
        logger ( "Finished." )
            
#config = ProvCon.Configuration()
#TFTPD = pcTFTPD()
#time.sleep(2)
#ProvCon.ControllerAction ( config.get ( "CONTROLLER", "tftpd"), "STOP" )
#TFTPD.join()
    def setUp(self):
        APP.config['TESTING'] = True
        APP.config['DEBUG'] = False
        APP.config[
            'SQLALCHEMY_DATABASE_URI'] = 'postgres://localhost/transport_test'

        self.app = APP.test_client()

        DB.drop_all()
        DB.create_all()

        self.lifegoup1 = {
            'name': 'uq1',
            'password': '******',
            'email': '*****@*****.**'
        }
        self.lifegoup2 = {
            'name': 'uq2',
            'password': '******',
            'email': '*****@*****.**'
        }
        self.lifegoup3 = {
            'name': 'uq3',
            'password': '******',
            'email': '*****@*****.**'
        }

        DB.session.add(LifegroupModel(**self.lifegoup1))
        DB.session.add(LifegroupModel(**self.lifegoup2))
        DB.session.add(LifegroupModel(**self.lifegoup3))
        DB.session.commit()

        self.member1 = {
            'id': '1',
            'lifegroup': 'uq1',
            'name': 'Kenneth Guo',
            'suburb': 'Sunnybank QLD, 4109'
        }
        self.member2 = {
            'id': '2',
            'lifegroup': 'uq2',
            'name': 'Ken Guo',
            'suburb': 'Sunnybank QLD, 4109'
        }
        self.note1 = {
            'id': '1',
            'lifegroup': 'uq1',
            'text': "A and B stay at the same place"
        }
        self.note2 = {
            'id': '2',
            'lifegroup': 'uq2',
            'text': "C and D stay at the same place"
        }
        DB.session.add(MemberModel(**self.member1))
        DB.session.add(MemberModel(**self.member2))
        DB.session.add(NoteModel(**self.note1))
        DB.session.add(NoteModel(**self.note2))
        DB.session.commit()
        self.assertFalse(APP.debug)
def socketio_test1():
    """ Tests to see if server adds users properly """
    # log the user in through Flask test client
    flask_test_client = APP.test_client()
    # connect to Socket.IO without being logged in
    socketio_test_client = SOCKETIO.test_client(
        APP, flask_test_client=flask_test_client)
    # makes a connection to the client
    assert socketio_test_client.is_connected()
    #test data to see if function works
    data = {'joined': 'test'}
    #go through on connection to get your logged in player
    result1 = on_connection1(data)
    #tests adding second player
    data2 = {'joined': 'test2'}
    result2 = on_connection1(data2)
    #tests adding spectator
    data3 = {'joined': 'test3'}
    result3 = on_connection1(data3)
    print(result1, result2, result3)
    """we could see that it runs through th function put's test3 as a spectator
    and returns the login list of current added players"""
    assert result1 == result2
    assert not result1[0] == result2[1]
    assert not result3[2] == result2[1]
    assert not result3[2] == result1[0]
Example #7
0
 def test_positive_route_company(self):
     """Verify that the API works for company employees."""
     tester = APP.test_client(self)
     response = tester.get(
         "/paranuara/company/COWTOWN", content_type="application/json"
     )
     self.assertEqual(response.status_code, 200)
 def setUp(self):
     '''
         Sets up the 'app.py' fixture
     '''
     self.middleware = []
     self.test_app = TestApp(APP.wsgifunc(*self.middleware))
     session.set_up(self.test_app)
Example #9
0
 def test_negative_route_person(self):
     """Verify that the API returns error on wrong link for person favorite fruits and vegetables."""
     tester = APP.test_client(self)
     response = tester.get(
         "paranuara/persON/Decker%20Mckenzie", content_type="application/json"
     )
     self.assertNotEqual(response.status_code, 200)
Example #10
0
 def test_negative_route_company(self):
     """Verify that the API returns error on wrong link for company employees."""
     tester = APP.test_client(self)
     response = tester.get(
         "/paranuara/companIES/COWTOWN", content_type="application/json"
     )
     self.assertNotEqual(response.status_code, 200)
Example #11
0
 def test_positive_route_person(self):
     """Verify that the API works for person favorite fruits and vegetables."""
     tester = APP.test_client(self)
     response = tester.get(
         "/paranuara/person/Decker%20Mckenzie", content_type="application/json"
     )
     self.assertEqual(response.status_code, 200)
Example #12
0
    def test_get_all_request(self):
        """test get all requests"""

        tester = APP.test_client(self)
        response = tester.get('/api/v1/users/requests',
                              content_type='application/json')
        self.assertEqual(response.status_code, 200)
Example #13
0
 def test_request_a_ride(self):
     """test to request a ride"""
     tester = APP.test_client(self)
     info = dict(rideID=4)
     response = tester.post('/v1/ride/4/request', data=json.dumps(info),
                            content_type="application/json")
     self.assertEqual(response.status_code, 200)
Example #14
0
    def setUp(self):
        APP.config['TESTING'] = True
        APP.config['WTF_CSRF_ENABLED'] = False
        self.app = APP.test_client()

        DB.Prod.delete_many({})
        DB.Logs.delete_many({})

        DB.User.insert_one({
            'name': 'Alice',
            'email': '*****@*****.**',
            'password': '******',
            'age': 22
        })

        DB.User.insert_one({
            'name': 'Bob',
            'email': '*****@*****.**',
            'password': '******',
            'age': 22
        })

        DB.User.insert_one({
            'name': 'Charlie',
            'email': '*****@*****.**',
            'password': '******',
            'age': 22
        })

        DB.Session.insert_one({
            'session_id': 'abcdefghijklmnopqrstuvwyzabcdef',
            'email': '*****@*****.**'
        })
Example #15
0
    def setUp(self):
        APP.config['TESTING'] = True
        APP.config['WTF_CSRF_ENABLED'] = False
        self.app = APP.test_client()
        DB.Logs.delete_many({})

        DB.Session.insert_one({
            'session_id': 'abcdefghijklmnopqrstuvwyzabcdef',
            'email': '*****@*****.**'
        })

        DB.User.insert_one({
            'name': 'Test User',
            'email': '*****@*****.**',
            'password': '******',
            'age': 22,
            'genre': ['Mystery', 'Horror']
        })

        DB.User.insert_one({
            'name': 'Test User2',
            'email': '*****@*****.**',
            'password': '******',
            'age': 22,
            'genre': ['Mystery', 'Horror']
        })

        DB.User.insert_one({
            'name': 'weird name',
            'email': '*****@*****.**',
            'password': '******',
            'age': 22,
            'genre': ['Mystery', 'Horror']
        })
    def setUp(self):
        APP.config['TESTING'] = True
        APP.config['DEBUG'] = False
        APP.config[
            'SQLALCHEMY_DATABASE_URI'] = 'postgres://localhost/transport_test'

        self.app = APP.test_client()

        DB.drop_all()
        DB.create_all()

        self.lifegoup1 = {
            'name': 'uq1',
            'password': '******',
            'email': '*****@*****.**'
        }
        self.lifegoup2 = {
            'name': 'uq2',
            'password': '******',
            'email': '*****@*****.**'
        }
        self.lifegoup3 = {
            'name': 'uq3',
            'password': '******',
            'email': '*****@*****.**'
        }

        DB.session.add(LifegroupModel(**self.lifegoup1))
        DB.session.add(LifegroupModel(**self.lifegoup2))
        DB.session.add(LifegroupModel(**self.lifegoup3))
        DB.session.commit()

        self.assertFalse(APP.debug)
    def run(self):
        from app import APP
        APP.Functions.set_process_name ( "0@TFTPD_DATA" )
        logger = APP.LoggingClient ( name = "TFTPD%05d" % self.pid )
        queue_errors = 0
        while 1:
            try:
                (client_address, initiating_packet, filename, filesize) = self.rfQueue.get()
            except:
                queue_errors += 1
                if queue_errors > 2:
                    logger ("Too many errors reading rfqueue")
                    break
                time.sleep(queue_errors)
            
            queue_errors = 0
            if client_address is None: break
            logger ("Sending %s to %s" % (filename, client_address))
            try:
                with open(filename, 'r') as source:
                    try:
                        (bytes, dt, speed) = Protocol.Handle_RRQ (initiating_packet, client_address, source)
                        logger ( "Sent %d bytes to %s at %.1f kB/s" % (bytes, client_address, speed/ 1024) )
                    except Protocol.TFTPProtocolError as e:
                        logger ( "TFTP Protocol Error: %s" %  e )
            except:
                info = sys.exc_info()[:2]
                logger ( "TFTP error: %s, %s" % (info[0], info[1]))                

        logger ( "EXIT" )
 def __init__(self):
     from app import APP
     Server.BaseTFTPServer.__init__(self)
     APP.Functions.set_process_name ( "0@TFTPD_LISTEN" )
     
     self.logger = APP.LoggingClient ( name="TFTPD_SRV" )
     #The queue for "ready-to-be-sent" files
     self.rfQueue = Queue(2048)
     
     #The base oven & cook - simple TFTP
     base_oven = FileOven ( root = APP.BE.TFTP.dir, name="FILES" )
     self.logger ( "Setting up %s." % base_oven )
     base_queue_size =  APP.BE.TFTP._i_queue_size
     base_cook_queue = Queue(base_queue_size)
     
     #The cook for cm firmware files
     cm_fw_oven = FileOven ( root = APP.BE.DOCSIS.fwdir, name="CM FW" )
     self.logger ( "Setting up %s." % cm_fw_oven )
     cm_fw_oven.deny ( (0,0) )
     cm_fw_queue = Queue(16)
     
     #The cook for cm config files
     cm_cfg_oven = CableModemConfigOven ( root = APP.BE.DOCSIS.dir, name="CM CONFIG" )
     self.logger ( "Setting up %s." % cm_cfg_oven )        
     cm_cfg_oven.deny ( (0,0) )
     cm_cfg_queue_size = APP.BE.DOCSIS._i_tftp_queue_size
     cm_cfg_queue = Queue (cm_cfg_queue_size)
     
     #The sub-processes count
     base_cooks_count = APP.BE.TFTP._i_cooks
     cm_fw_cooks_count = APP.BE.DOCSIS._i_tftp_cm_fw_cooks
     cm_cfg_cooks_count = APP.BE.DOCSIS._i_tftp_cm_cfg_cooks
     
     self.cooks = [ 
         (cm_cfg_oven, cm_cfg_queue, [CableModemConfigCook(cm_cfg_queue, self.rfQueue, cm_cfg_oven) for i in range(0,cm_cfg_cooks_count)]),
         (cm_fw_oven, cm_fw_queue, [FileCook(cm_fw_queue, self.rfQueue, cm_fw_oven) for i in range(0,cm_fw_cooks_count)] ),
         (base_oven, base_cook_queue, [FileCook(base_cook_queue, self.rfQueue, base_oven) for i in range(0,base_cooks_count)]),             
                  ]
     self.logger ( "Starting the cooks." )
     #run cooks, run!
     for (_,_,cooklist) in self.cooks:
         for cook in cooklist: cook.start()
     
     data_senders_count = APP.BE.TFTP._i_senders
     self.data_senders = [ TFTPDataSender (self.rfQueue)  for i in range(0,data_senders_count) ]
     for sender in self.data_senders: sender.start()
     
     signal.signal ( signal.SIGHUP, self.shutdown )        
     self.on = True
     #self.timeout = 4
     error_count = 0
     while self.on:   
         try:
             self.handle_request()
         except Exception as e:                
             error_count += 1
             self.logger ( "error#%d in handle_request (%s)" % (error_count, e) )
             if error_count > 10: break
     self.logger ( "TFTP service no longer active." )
Example #19
0
 def setUp(self):
     '''
         Sets up the 'app.py' fixture
     '''
     self.middleware = []
     self.test_app = TestApp(APP.wsgifunc(*self.middleware))
     session.set_up(self.test_app)
     model.star_module("BT5110", session.DUMMY_USER_ID)
Example #20
0
 def test_negative_route_people(self):
     """Verify that the API returns error on wrong link for friends names."""
     tester = APP.test_client(self)
     response = tester.get(
         "paranuara//peOPle/person1=Decker%20Mckenzie&person2=Rosemary%20Hayes",
         content_type="application/json",
     )
     self.assertNotEqual(response.status_code, 200)
Example #21
0
 def test_positive_route_people(self):
     """Verify that the API works for the friends names."""
     tester = APP.test_client(self)
     response = tester.get(
         "/paranuara/people/?person1=Decker%20Mckenzie&person2=Rosemary%20Hayes",
         content_type="application/json",
     )
     self.assertEqual(response.status_code, 200)
Example #22
0
 def test_register(self):
     """ Hitting Register API """
     tester = APP.test_client(self)
     url = '/register?userName=Rutu&password=rotadu'
     response = tester.post(url, content_type="application/json")
     self.assertEqual(response.status_code, 200)
     self.assertEqual(response.data.decode("UTF-8"),
                      "This UserName Already exists.")
Example #23
0
 def test_logout(self):
     """ 
         A test for loading of the editrecipe page
         The url endpoint is;
             =>    /logout (get)
     """
     r = APP.test_client(self)
     return r.get('/logout', follow_redirects=True)
Example #24
0
 def test_url_not_in_form_data_post(self):
     """
         Asserts the endpoint fails when the url is not in the form data
     """
     with APP.test_client() as client:
         sent = {}
         result = client.post('/scrape_reviews', data=sent)
         self.assertEqual(result.status_code, 400)
Example #25
0
 def test_url_is_not_restaurant_page_fails(self):
     """
         Asserts the endpoint fails when the url is a not a restaurant or review url
     """
     with APP.test_client() as client:
         sent = {"url": "www.google.com"}
         result = client.post('/scrape_reviews', data=sent)
         self.assertEqual(result.status_code, 400)
Example #26
0
 def test_create_a_ride(self):
     """test to create a ride"""
     tester = APP.test_client(self)
     info = dict(From="mukono", To="kampala", Time="4:00pm", Date="4/4/2018",
                 Driver_Username="******", Cost="4000", rideID=4)
     response = tester.post('/v1/create_ride', data=json.dumps(info),
                            content_type="application/json")
     self.assertEqual(response.status_code, 200)
Example #27
0
 def setUp(self):
     """Set up tests"""
     CATEGORIES.clear()
     self.user_email = "*****@*****.**"
     self.username = "******"
     self.user_password = "******"
     APP.config['TESTING'] = True
     self.test_app = APP.test_client()
Example #28
0
 def test_valid_user_registration(self):
     """test registration api"""
     tester = APP.test_client(self)
     info = dict(firstname="john", lastname="Smith", username="******",
                 password="******", gender="male", id=4)
     response = tester.post('/v1/register', data=json.dumps(info),
                            content_type="application/json")
     self.assertEqual(response.status_code, 200)
Example #29
0
    def run(self):

        self.logging_server = APP.LoggingServer()
        self.logger = APP.LoggingClient(name="MAIN")
        logger = self.logger

        logger("-=<" + ("-" * 70) + ">=-")
        logger("Provisioning v0.01, started.")

        self.controllers = {}
        for (cname, cpath) in APP.BE.CONTROLLER:
            self.controllers[cname] = cpath

        self.processes = {}
        self.start_services()
        self.cli = APP.CLIServer()
        self.cli.serve()
        self.exit()
Example #30
0
def client(db):
    # create temp upload folder
    upload_dir = tempfile.mkdtemp()
    APP.config['UPLOAD_FOLDER'] = upload_dir

    yield APP.test_client()

    # delete temp upload folder
    shutil.rmtree(upload_dir)
Example #31
0
def a_client():
    APP.config['TESTING'] = True
    disconnect()
    connect('mongoenginetest', host='mongomock://localhost')
    client = APP.test_client()

    yield client

    disconnect()
 def __init__(self, **kwargs):
     from meta import Table, Field
     pg.DB.__init__(self, **kwargs)            
     #Attempt to make sure this class is a singleton.
     CFG.tCX.instanceCount += 1
     APP.log("tCX init [%d]" % self.instanceCount)
     self.schemaname = CFG.DB.SCHEMA
     idmap = {}
     tableinfo = self.query ( "SELECT * FROM ONLY {0}.table_info".format(CFG.DB.SCHEMA) ).dictresult()
     for ti in tableinfo:
         with Table.New ( ti['name'], **ti ) as t:
             columninfo = self.query ( "SELECT * FROM ONLY {0}.field_info WHERE classid = {objectid}".format(CFG.DB.SCHEMA, **ti)).dictresult()
             for ci in columninfo:                        
                 t.addField ( Field (size=ci['length'], **ci) )
             idmap[t.objectid] = t
             t.recordlisttoolbox = text_to_array ( t.recordlisttoolbox, 0 )
             t.recordlistpopup = text_to_array ( t.recordlistpopup, 0 )
 
     #import foreign key relationships
     for t in Table.__all_tables__.values():
         if t.superclass: t.superclass = idmap[t.superclass]
         else: t.superclass = None
         for f in t.fields:
             #For columns that reference a table_info row, replace the appropriate
             #values with actual, python-object references
             if f.reference: 
                 f.reference = idmap[f.reference]
                 #fill the table's children list
                 f.reference.reference_child.append ( (t, f) )
                 f.reference.reference_child_hash[t.name + "_" + f.name] = (t,f)
             if f.arrayof:
                 f.arrayof = idmap[f.arrayof]               
     #import many-to-many relationships
     mtm_info = self.query ( "SELECT * FROM ONLY {0}.mtm_relationship".format(CFG.DB.SCHEMA) ).dictresult()
     for mtm in mtm_info:
         table1 = Table.Get ( mtm['table_1'] )
         table2 = Table.Get ( mtm['table_2'] )
         
         table1.mtm_relationships[ mtm['table_1_handle'] ] = ( 
             mtm['relationship_name'], mtm['mtm_table_name'], "refobjectid1", "refobjectid2", table2 )
         table2.mtm_relationships[ mtm['table_2_handle'] ] = ( 
             mtm['relationship_name'], mtm['mtm_table_name'], "refobjectid2", "refobjectid1", table1 )
         
     self.instance = self
Example #33
0
    def _create_default_field_editor (self, field, parent=None, **kwargs):
        from app import APP
        editor_class_name = field.editor_class
        default_class = EntryWidgets.Text
        options = {}
        prefix = ''
        suffix = ''

        if self.form.is_field_fixed ( field.name ):
            editor_class_name = 'Static'
            
        if field.isarray:
            if field.arrayof:
                editor_class_name = "List"
                prefix = "Array"
                options['recordlist'] = RecordList ( field.arrayof ).reload()           
                default_class = EntryWidgets.ArrayCombo
            else:
                prefix = 'Array'
                default_class = EntryWidgets.ArrayText
        elif field.reference:
            suffix = 'Reference'
            default_class = EntryWidgets.ListReference
        
        wanted_class_name = prefix + editor_class_name + suffix
        print field, field.editor_class, wanted_class_name
        
        if hasattr (EntryWidgets,wanted_class_name ):
            editor_class = getattr(EntryWidgets, wanted_class_name)
        elif APP.getExtraDataEditor (wanted_class_name):
            editor_class = APP.getExtraDataEditor (wanted_class_name)
        else:
            editor_class = default_class
            
        editor = editor_class (field, parent, variable = self.form.getvar(field.name), **options )        
        return editor
Example #34
0
	def test_default_route(self):  
		tester = APP.test_client(self)
		response = tester.get('/', content_type='application/json')

		# Check 200 response from default route
		self.assertEqual(response.status_code, 200)

		# Check default route message output
		self.assertEqual(json.loads(response.data.decode('utf-8')), 
			{
			    "message" : "Hello pythonistic world"
			}
		)

		# Check number of characters in message
		response.json = json.loads(response.data.decode('utf-8'))
		self.assertEqual(len(response.json['message']), 23)
Example #35
0
def test_mailing():
    ''' mailing functions '''
    sender = TEST_USER[0]['email']
    recipients = [TEST_USER[1]['email']]
    subject = 'Testsubject'
    body = 'Testbody'

    with APP.app_context():
        with MAIL.record_messages() as outbox:
            mailing.send_email(sender=sender,
                               subject=subject,
                               recipients=recipients,
                               body=body)

            assert outbox[0].sender == sender
            assert outbox[0].recipients == recipients
            assert outbox[0].subject == subject
            assert body in outbox[0].body
Example #36
0
# -*- coding: utf-8 -*-

from app import APP


if __name__ == "__main__":
    APP.run(debug=True, host="0.0.0.0", threaded=True)
Example #37
0
def run():
    with Valves() as valves:
        APP.valves = valves
        APP.run(APP.config['HOST'], APP.config['PORT'], debug=True)
 def setUp(self):
     app_de_teste.config['TESTING'] = True
     app_de_teste.config['WTF_CSRF_ENABLED'] = False
     app_de_teste.config['DEBUG'] = False
     self.app = app_de_teste.test_client()
Example #39
0
'''launcher'''

from app import APP

if __name__ == '__main__':
    APP.run('127.0.0.1', debug=True, threaded=True)

Example #40
0
#!/usr/bin/env python

"""
   Run the server for the app.
   Note: Run as root on production, and user locally.
"""
from getpass import getuser
from app import APP
from util import parse_args

parse_args()


if getuser() == "root":
    APP.run(debug=False, host="172.31.11.17", port=80)
else:
    APP.run(debug=True)
Example #41
0
def test_whatsup_post(client, test_user):
    with APP.app_context():
        with MAIL.record_messages() as outbox:
            # add post
            login(client, test_user['email'], test_user['password'])
            add_whatsup_post(client, 'subject', 'body')

            # logout and try to access it
            logout(client)
            rv = client.get('/whatsup/1')

            assert rv.status_code == 302

            # login again
            login(client, test_user['email'], test_user['password'])

            # add comment
            rv = add_whatsup_comment(client, 1, 'cömment1')

            assert rv.status_code == 200
            assert 'Kommentar abgeschickt!' in rv.data

            # database entries
            rv = models.get_whatsup_post(1)

            assert rv.comments[0].body == 'cömment1'.decode('utf-8')
            assert rv.comments[0].post_id == 1
            assert rv.comments[0].user_id == test_user['id']

            # add 3 more comments
            sleep(1)
            add_whatsup_comment(client, 1, 'comment2')
            sleep(1)
            add_whatsup_comment(client, 1, 'comment3')
            sleep(1)
            add_whatsup_comment(client, 1, 'comment4')

            assert len(models.get_whatsup_post(1).comments) == 4

            # create soup
            rv = client.get('/whatsup/1')
            soup = BeautifulSoup(rv.data)

            rv = soup.find_all('div', class_='media-body')

            # discussion icon counter
            assert '4' in rv[0].text

            # checking comment order
            assert 'comment4' in rv[1].text
            assert 'comment3' in rv[2].text
            assert 'comment2' in rv[3].text
            assert 'cömment1'.decode('utf-8') in rv[4].text

            # checking names
            assert '{} {}'.format(
                test_user['vorname'],
                test_user['name']) in rv[0].text.encode('utf-8')
            assert '{} {}'.format(
                test_user['vorname'],
                test_user['name']) in rv[1].text.encode('utf-8')
            assert '{} {}'.format(
                test_user['vorname'],
                test_user['name']) in rv[2].text.encode('utf-8')
            assert '{} {}'.format(
                test_user['vorname'],
                test_user['name']) in rv[3].text.encode('utf-8')
            assert '{} {}'.format(
                test_user['vorname'],
                test_user['name']) in rv[4].text.encode('utf-8')

            # check notification emails
            assert outbox[0].sender == '{} {} <{}>'.format(
                unidecode(test_user['vorname'].decode('utf-8')), unidecode(
                    test_user['name'].decode('utf-8')), test_user['email'])
            assert outbox[0].subject == 'Kommentar in "{}"'.format('subject')
            assert '{} {} hat geschrieben:'.format(
                unidecode(test_user['vorname'].decode('utf-8')),
                unidecode(test_user['name'].decode('utf-8'))) in outbox[0].body
            assert 'cömment1'.decode('utf-8') in outbox[0].body
            assert '/whatsup/1' in outbox[0].body
Example #42
0
def stream_template(templatename, **context):
        APP.update_template_context(context)
        template = APP.jinja_env.get_template(templatename)
        rv = template.stream(context)
        rv.enable_buffering(5)      # you might want to buffer up a few items in the template
        return rv
Example #43
0
# -*- encoding: utf-8 -*-
'''
Current module: pyrunnerwbs.run

Rough version history:
v1.0    Original version to use

********************************************************************
    @AUTHOR:  Administrator-Bruce Luo(罗科峰)
    MAIL:    [email protected]
    RCS:      pyrunnerwbs.run,v 1.0 2016年4月24日
    FROM:   2016年4月24日
********************************************************************

======================================================================

UI and Web Http automation frame for python.

'''

from app import APP
APP.run(debug=True)
Example #44
0
#!/usr/bin/python
'''
:since: 01/08/2015
:author: oblivion
'''
from app import APP

APP.run(debug=APP.config['DEBUG'], host='0.0.0.0')
Example #45
0
 def setUp(self):
     APP.config["TESTING"] = True
     self.app = APP.test_client()