예제 #1
0
    def setUp(self):
        """ Set up before every test. """

        self.client = app.test_client()
        app.config['TESTING'] = True

        # connect to test database
        connect_to_db(app, 'postgresql:///testdb')

        # create tables and add sample data
        db.create_all()
        load_dummy_data()

        # Make mock
        def _load_message_and_send(_):
            message_status = {'labelIds': ['SENT']}
            return message_status

        # Make mock
        def _get_random_quote():
            return {
                'media':
                'http://healthruwords.com/wp-content/uploads/2016/09/Healthruwords.com_-_Inspirational_Images_-_Imagination-over-Knowledge-300x300.jpg',
                'author': 'Roxana Jones'
            }

        server.load_message_and_send = _load_message_and_send
        server.get_random_quote = _get_random_quote
예제 #2
0
    def setUp(self):
        """ Set up before every test. """

        self.client = app.test_client()
        app.config['TESTING'] = True

        # connect to test database
        connect_to_db(app, 'postgresql:///testdb')

        # create tables and add sample data
        db.create_all()
        load_dummy_data()
예제 #3
0
    def setUp(self):
        """ Set up before every test. """

        self.client = app.test_client()
        app.config['TESTING'] = True

        # connect to test database
        connect_to_db(app, 'postgresql:///testdb')

        # create tables and add sample data
        db.create_all()
        load_dummy_data()

        # Make mock
        def _send_text_message(from_, body, to):
            class Message():
                """ simple Message mock with error_code attribute. """
                def __init__(self):
                    self.error_code = None

            new_message = Message()
            return new_message

        server.send_text_message = _send_text_message