示例#1
0
class TestCase(object):
    def __init__(self, suite, filename):
        self.filename = filename
        self.data = None
        self.variables = Variables()
        if suite:
            self.variables.update(suite.variables)
        self.load()

    def __getattr__(self, key):
        return getattr(self.data, key)

    @property
    def steps(self):
        return self.data.testSteps

    @property
    def request_opts(self):
        return self.variables.get('request_opts', {})

    def load(self):
        with open(self.filename) as fh:
            data = load(self.filename, fh)
            self._load(data)

    def _load(self, data):
        self.data = DictWrapper(data)
        self.variables.update(
            data.get('globals', {}).get('variables', {}).items())
示例#2
0
 def __init__(self, suite, filename):
     self.filename = filename
     self.data = None
     self.variables = Variables()
     if suite:
         self.variables.update(suite.variables)
     self.load()
示例#3
0
文件: loader.py 项目: jayv/Rester
class TestCase(object):
    def __init__(self, suite, filename):
        self.filename = filename
        self.data = None
        self.variables = Variables()
        if suite:
            self.variables.update(suite.variables)

    def __getattr__(self, key):
        return getattr(self.data, key)

    @property
    def steps(self):
        return self.data.testSteps

    @property
    def request_opts(self):
        return self.variables.get("request_opts", {})

    def load(self):
        with open(self.filename) as fh:
            data = load(self.filename, fh)
            self._load(data)

    def _load(self, data):
        self.data = DictWrapper(data)
        self.variables.update(data.get("globals", {}).get("variables", {}).items())
示例#4
0
文件: loader.py 项目: jayv/Rester
class TestSuite(object):
    def __init__(self, filename):
        self.filename = filename
        self.test_cases = []
        self.variables = Variables()

    def load(self):
        with open(self.filename) as fh:
            data = load(self.filename, fh)
            self._load(data)

    def _load(self, data):
        self.variables.update(data.get("globals", {}).get("variables", {}).items())
        for case in data["test_cases"]:
            filename = os.path.join(os.path.dirname(self.filename), case)
            self.test_cases.append(TestCase(self, filename))
示例#5
0
 def __init__(self, suite, filename):
     self.filename = filename
     self.data = None
     self.variables = Variables()
     if suite:
         self.variables.update(suite.variables)
     self.load()
示例#6
0
class TestSuite(object):
    def __init__(self, filename):
        self.filename = filename
        self.test_cases = []
        self.variables = Variables()

    def load(self):
        with open(self.filename) as fh:
            data = load(self.filename, fh)
            self._load(data)

    def _load(self, data):
        self.variables.update(
            data.get('globals', {}).get('variables', {}).items())
        for case in data['test_cases']:
            filename = os.path.join(os.path.dirname(self.filename), case)
            self.test_cases.append(TestCase(self, filename))
示例#7
0
 def __init__(self, filename):
     self.filename = filename
     self.test_cases = []
     self.variables = Variables()
     self.load()
示例#8
0
文件: loader.py 项目: jayv/Rester
 def __init__(self, filename):
     self.filename = filename
     self.test_cases = []
     self.variables = Variables()