Beispiel #1
0
    def get_profile_info(self, test_id=None):
        try:
            _conv = self.session["conv"]
        except KeyError:
            pass
        else:
            try:
                iss = _conv.entity.provider_info["issuer"]
            except AttributeError:
                iss = _conv.entity.baseurl
            except (TypeError, KeyError):
                iss = ""

            profile = RT[''.join(self.session["profile"])]

            if test_id is None:
                try:
                    test_id = self.session["testid"]
                except KeyError:
                    return {}

            return {
                "Issuer": iss,
                "Profile": profile,
                "Test ID": test_id,
                "Test description": self.session.test_flows[test_id]["desc"],
                "Timestamp": in_a_while()
            }
        return {}
Beispiel #2
0
    def get_profile_info(self, test_id=None):
        try:
            _conv = self.session["conv"]
        except KeyError:
            pass
        else:
            try:
                iss = _conv.entity.provider_info["issuer"]
            except (TypeError, KeyError):
                iss = get_issuer(_conv)

            profile = self.to_profile("dict")

            if test_id is None:
                try:
                    test_id = self.session["testid"]
                except KeyError:
                    return {}

            return {
                "Issuer": iss,
                "Profile": profile,
                "Test ID": test_id,
                "Test description": self.session.test_flows[test_id]['desc'],
                "Timestamp": in_a_while()
            }

        return {}
Beispiel #3
0
    def get_profile_info(self, test_id=None):
        try:
            _conv = self.session["conv"]
        except KeyError:
            pass
        else:
            try:
                iss = _conv.entity.provider_info["issuer"]
            except (TypeError, KeyError):
                iss = ""

            profile = RT[self.session["profile"]]

            if test_id is None:
                try:
                    test_id = self.session["testid"]
                except KeyError:
                    return {}

            return {
                "Issuer": iss,
                "Profile": profile,
                "Test ID": test_id,
                "Test description": self.session["node"].desc,
                "Timestamp": in_a_while(),
            }

        return {}
Beispiel #4
0
    def get_profile_info(self, test_id=None):
        try:
            _conv = self.session["conv"]
        except KeyError:
            pass
        else:
            try:
                iss = _conv.entity.provider_info["issuer"]
            except AttributeError:
                iss = _conv.entity.baseurl
            except (TypeError, KeyError):
                iss = ""

            profile = RT[''.join(self.session["profile"])]

            if test_id is None:
                try:
                    test_id = self.session["testid"]
                except KeyError:
                    return {}

            return {
                "Issuer": iss, "Profile": profile,
                "Test ID": test_id,
                "Test description": self.session.test_flows[test_id]["desc"],
                "Timestamp": in_a_while()}
        return {}
Beispiel #5
0
    def get_profile_info(self, test_id=None):
        try:
            _conv = self.session["conv"]
        except KeyError:
            pass
        else:
            try:
                iss = _conv.entity.provider_info["issuer"]
            except (TypeError, KeyError):
                iss = ""

            profile = RT[self.session["profile"]]

            if test_id is None:
                try:
                    test_id = self.session["testid"]
                except KeyError:
                    return {}

            return {
                "Issuer": iss,
                "Profile": profile,
                "Test ID": test_id,
                "Test description": self.session["node"].desc,
                "Timestamp": in_a_while()
            }

        return {}
Beispiel #6
0
    def get_profile_info(self, test_id=None):
        try:
            _conv = self.session["conv"]
        except KeyError:
            pass
        else:
            try:
                iss = _conv.entity.provider_info["issuer"]
            except (TypeError, KeyError):
                iss = get_issuer(_conv)

            profile = self.to_profile("dict")

            if test_id is None:
                try:
                    test_id = self.session["testid"]
                except KeyError:
                    return {}

            return {"Issuer": iss, "Profile": profile,
                    "Test ID": test_id,
                    "Test description": self.session.test_flows[test_id][
                        'desc'],
                    "Timestamp": in_a_while()}

        return {}
Beispiel #7
0
    def write_info(self, tinfo, test_id='', file_name=None, tag=''):
        if not test_id:
            test_id = tinfo['test_id']

        if file_name is None:
            if isinstance(self.session['conv'].entity, Provider):
                file_name = self.rp_based(test_id, tag)
            else:
                file_name = self.op_based(test_id, tag)

        if 'conv' not in self.session:
            return
        else:
            _conv = self.session["conv"]

        sline = 60 * "="

        _pi = tinfo['profile_info']

        output = ["Test tool version: {}".format(self.session.tool_version)]
        if _pi:
            _keys = list(_pi.keys())
            _keys.sort()
            output.extend(["%s: %s" % (k, _pi[k]) for k in _keys])
        else:
            output.extend([
                'Test ID: {}'.format(_conv.test_id),
                "Timestamp: {}".format(in_a_while())
            ])

        _events = tinfo["events"]
        output.extend(["", sline, ""])
        output.extend(trace_output(_events))
        output.extend(["", sline, ""])
        output.extend(condition(_events))
        output.extend(["", sline, ""])
        # and lastly the result
        output.append("RESULT: {}".format(self.print_result(_events)))
        output.append("")

        txt = "\n".join(output)

        f = self._open_file(file_name, 'w')
        f.write(txt)
        f.close()

        self.cache[test_id] = {
            'result': result_code(_events),
            'file_name': file_name
        }
Beispiel #8
0
    def write_info(self, tinfo, test_id='', file_name=None, tag=''):
        if not test_id:
            test_id = tinfo['test_id']

        if file_name is None:
            if isinstance(self.session['conv'].entity, Provider):
                file_name = self.rp_based(test_id, tag)
            else:
                file_name = self.op_based(test_id, tag)

        if 'conv' not in self.session:
            return
        else:
            _conv = self.session["conv"]

        sline = 60 * "="

        _pi = tinfo['profile_info']

        output = ["Test tool version: {}".format(self.session.tool_version)]
        if _pi:
            _keys = list(_pi.keys())
            _keys.sort()
            output.extend(["%s: %s" % (k, _pi[k]) for k in _keys])
        else:
            output.extend(['Test ID: {}'.format(_conv.test_id),
                           "Timestamp: {}".format(in_a_while())])

        _events = tinfo["events"]
        output.extend(["", sline, ""])
        output.extend(trace_output(_events))
        output.extend(["", sline, ""])
        output.extend(condition(_events))
        output.extend(["", sline, ""])
        # and lastly the result
        output.append("RESULT: {}".format(self.print_result(_events)))
        output.append("")

        txt = "\n".join(output)

        f = self._open_file(file_name, 'w')
        f.write(txt)
        f.close()

        self.cache[test_id] = {'result': result_code(_events),
                               'file_name': file_name}
Beispiel #9
0
    def get_profile_info(self, test_id=None):
        try:
            _conv = self.session["conv"]
        except KeyError:
            pass
        else:
            profile = self.to_profile("dict")

            if test_id is None:
                try:
                    test_id = self.session["testid"]
                except KeyError:
                    return {}

            return {"Profile": profile,
                    "Test ID": test_id,
                    "Test description": self.session["node"].desc,
                    "Timestamp": in_a_while()}

        return {}
Beispiel #10
0
    def get_profile_info(self, test_id=None):
        try:
            _conv = self.session["conv"]
        except KeyError:
            pass
        else:
            profile = self.to_profile("dict")

            if test_id is None:
                try:
                    test_id = self.session["testid"]
                except KeyError:
                    return {}

            return {
                "Profile": profile,
                "Test ID": test_id,
                "Test description": self.session["node"].desc,
                "Timestamp": in_a_while()
            }

        return {}