Ejemplo n.º 1
0
    def setUp(self):
        super(AuthTestCase, self).setUp()
        logsetting.init()
        database.init(self.DATABASE_URL)
        database.create_db()

        self.test_client = app.test_client()
Ejemplo n.º 2
0
    def setUp(self):
        super(ApiTestCase, self).setUp()
        database.init(self.DATABASE_URL)
        database.create_db()
        self.app = app.test_client()

        # We do not want to send a real task as our test environment
        # does not have a AMQP system set up. TODO(): any better way?
        current_app.send_task = Mock()

        # We do not want to send a real task as our test environment
        # does not have a AMQP system set up. TODO(): any better way?
        current_app.send_task = Mock()
Ejemplo n.º 3
0
    def setUp(self):
        super(ApiTestCase, self).setUp()
        database.init(self.DATABASE_URL)
        database.create_db()
        self.app = app.test_client()

        # We do not want to send a real task as our test environment
        # does not have a AMQP system set up. TODO(): any better way?
        current_app.send_task = Mock()

        # We do not want to send a real task as our test environment
        # does not have a AMQP system set up. TODO(): any better way?
        current_app.send_task = Mock()
Ejemplo n.º 4
0
    def setUp(self):
        super(TestPollSwitch, self).setUp()
        logsetting.init()
        database.init(self.DATABASE_URL)
        database.create_db()
        self.test_client = app.test_client()

        with database.session() as session:
            # Add one switch to DB
            switch = Switch(ip="127.0.0.1", credential=self.SWITCH_CREDENTIAL)
            session.add(switch)
            # Add filter port to SwitchConfig table
            filter_list = [
                SwitchConfig(ip="127.0.0.1", filter_port='6'),
                SwitchConfig(ip="127.0.0.1", filter_port='7')
            ]
            session.add_all(filter_list)
    def setUp(self):
        super(TestPollSwitch, self).setUp()
        logsetting.init()
        database.init(self.DATABASE_URL)
        database.create_db()
        self.test_client = app.test_client()

        with database.session() as session:
            # Add one switch to DB
            switch = Switch(ip="127.0.0.1",
                            credential=self.SWITCH_CREDENTIAL)
            session.add(switch)
            # Add filter port to SwitchConfig table
            filter_list = [
                SwitchConfig(ip="127.0.0.1", filter_port='6'),
                SwitchConfig(ip="127.0.0.1", filter_port='7')
            ]
            session.add_all(filter_list)
Ejemplo n.º 6
0
    def setUp(self):
        super(ApiTestCase, self).setUp()
        database.init(self.DATABASE_URL)
        database.create_db()
        self.app = app.test_client()

        # We do not want to send a real task as our test environment
        # does not have a AMQP system set up. TODO(): any better way?
        current_app.send_task = Mock()

        # We do not want to send a real task as our test environment
        # does not have a AMQP system set up. TODO(): any better way?
        current_app.send_task = Mock()
        self.backup_logfile = flags.OPTIONS.logfile
        if not flags.OPTIONS.logfile:
            flags.OPTIONS.logfile = '/tmp/test_api.log'

        logsetting.init()