def test_bad_to_good(self):
        logger.debug('test_bad_to_good (2)')
        r = None
        try:
            pathutil.delete_folder(self.repose_config_folder)
            pathutil.create_folder(self.repose_config_folder)
            conf.process_config_set(self.config_common,
                                    params=self.config_params,
                                    destination_path=self.repose_config_folder,
                                    verbose=False)

            conf.process_config_set(self.config_bad,
                                    params=self.config_params,
                                    destination_path=self.repose_config_folder,
                                    verbose=False)
            r = repose.ReposeValve(self.repose_config_folder,
                                   stop_port=self.repose_stop_port)
            time.sleep(self.sleep_time)
            self.assertRaises(requests.ConnectionError, requests.get,
                              self.repose_url)
            conf.process_config_set(self.config_good,
                                    params=self.config_params,
                                    destination_path=self.repose_config_folder,
                                    verbose=False)
            time.sleep(self.sleep_time)
            self.assertEquals(self.get_status_code_from_url(self.repose_url),
                              self.get_good_response())
        finally:
            if r:
                r.stop()
def setUpModule():
    logger.debug('setUpModule')
    repose_conf_folder = 'etc/repose'
    pathutil.delete_folder(repose_conf_folder)
    pathutil.create_folder(repose_conf_folder)
    pathutil.create_folder('usr/share/repose/filters')
    pathutil.create_folder('var/log/repose')
    pathutil.create_folder('var/repose')
    #install_repose.get_repose(valve_dest='usr/share/repose',
    #                          ear_dest='usr/share/repose/filters')
    create_mock()
    logger.debug('setUpModule complete')
예제 #3
0
 def test_start_missing(self):
     logger.debug('test_start_missing')
     r = None
     try:
         pathutil.delete_folder(self.repose_config_folder)
         pathutil.create_folder(self.repose_config_folder)
         conf.process_config_set(self.config_common,
                                 params=self.config_params,
                                 destination_path=self.repose_config_folder,
                                 verbose=False, configs_folder=configs_folder)
         
         r = repose.ReposeValve(self.repose_config_folder,
                                stop_port=self.repose_stop_port)
         time.sleep(self.sleep_time)
         self.assertEquals(self.get_status_code_from_url(self.repose_url),
                           self.get_good_response())
     finally:
         if r:
             r.stop()