Пример #1
0
    def replay_flight_data(self, test_case, zdata=False, region=None):
        """
        The `region` argument is to allow functional tests to override the
        default region. It is unused when replaying stored data.
        """

        if os.environ.get('C7N_FUNCTIONAL') == 'yes':
            self.recording = True
            return lambda region=region, assume=None: boto3.Session(
                region_name=region)

        if not zdata:
            test_dir = os.path.join(self.placebo_dir, test_case)
            if not os.path.exists(test_dir):
                raise RuntimeError(
                    "Invalid Test Dir for flight data %s" % test_dir)

        session = boto3.Session()
        if not zdata:
            pill = placebo.attach(session, test_dir)
        else:
            pill = attach(session, self.archive_path, test_case, False)

        pill.playback()
        self.addCleanup(pill.stop)
        self.addCleanup(self.cleanUp)
        return lambda region=None, assume=None: session
Пример #2
0
    def replay_flight_data(self, test_case, zdata=False):
        if not zdata:
            test_dir = os.path.join(self.placebo_dir, test_case)
            if not os.path.exists(test_dir):
                raise RuntimeError(
                    "Invalid Test Dir for flight data %s" % test_dir)

        session = boto3.Session()
        if not zdata:
            pill = placebo.attach(session, test_dir)
        else:
            pill = attach(session, self.archive_path, test_case, False)

        pill.playback()
        self.addCleanup(pill.stop)
        self.addCleanup(self.cleanUp)
        return lambda region=None, assume=None: session
Пример #3
0
    def replay_flight_data(self, test_case, zdata=False):
        if not zdata:
            test_dir = os.path.join(self.placebo_dir, test_case)
            if not os.path.exists(test_dir):
                raise RuntimeError("Invalid Test Dir for flight data %s" %
                                   test_dir)

        session = boto3.Session()
        if not zdata:
            pill = placebo.attach(session, test_dir)
        else:
            pill = attach(session, self.archive_path, test_case, False)

        pill.playback()
        self.addCleanup(pill.stop)
        self.addCleanup(self.cleanUp)
        return lambda region=None, assume=None: session
Пример #4
0
    def replay_flight_data(self, test_case, zdata=False):
        if os.environ.get('C7N_FUNCTIONAL') == 'yes':
            self.recording = True
            return lambda region=None, assume=None: boto3.Session(
                region_name=region)

        if not zdata:
            test_dir = os.path.join(self.placebo_dir, test_case)
            if not os.path.exists(test_dir):
                raise RuntimeError(
                    "Invalid Test Dir for flight data %s" % test_dir)

        session = boto3.Session()
        if not zdata:
            pill = placebo.attach(session, test_dir)
        else:
            pill = attach(session, self.archive_path, test_case, False)

        pill.playback()
        self.addCleanup(pill.stop)
        self.addCleanup(self.cleanUp)
        return lambda region=None, assume=None: session