Example #1
0
    def restore_state(self, filename):
        txt = open(filename).read()
        state = json.loads(txt)
        self.trace.start = state["trace_log"]["start"]
        self.trace.trace = state["trace_log"]["trace"]
        self.flow_index = state["flow_index"]
        self.client_config = state["client_config"]
        self.test_output = state["test_output"]

        self.client.behaviour = state["client"]["behaviour"]
        self.client.keyjar.restore(state["client"]["keyjar"])
        pcr = ProviderConfigurationResponse().from_json(
            state["client"]["provider_info"])
        self.client.provider_info = pcr
        self.client.client_id = state["client"]["client_id"]
        self.client.client_secret = state["client"]["client_secret"]

        for key, val in pcr.items():
            if key.endswith("_endpoint"):
                setattr(self.client, key, val)

        try:
            self.client.registration_response = RegistrationResponse(
            ).from_json(state["client"]["registration_resp"])
        except KeyError:
            pass
Example #2
0
    def restore_state(self, filename):
        txt = open(filename).read()
        state = json.loads(txt)
        self.trace.start = state["trace_log"]["start"]
        self.trace.trace = state["trace_log"]["trace"]
        self.flow_index = state["flow_index"]
        self.client_config = state["client_config"]
        self.test_output = state["test_output"]

        self.client.behaviour = state["client"]["behaviour"]
        self.client.keyjar.restore(state["client"]["keyjar"])
        pcr = ProviderConfigurationResponse().from_json(
            state["client"]["provider_info"])
        self.client.provider_info = pcr
        self.client.client_id = state["client"]["client_id"]
        self.client.client_secret = state["client"]["client_secret"]

        for key, val in pcr.items():
            if key.endswith("_endpoint"):
                setattr(self.client, key, val)

        try:
            self.client.registration_response = RegistrationResponse().from_json(
                state["client"]["registration_resp"])
        except KeyError:
            pass