comparison tests/e2e/libervia-cli/conftest.py @ 3659:d4b8f1e8f0b4

tests (e2e/cli): update JSON and XML outputs following changes in Libervia CLI
author Goffi <goffi@goffi.org>
date Wed, 08 Sep 2021 11:18:01 +0200
parents d78b5eae912a
children 4b842c1fb686
comparison
equal deleted inserted replaced
3658:9e491b2bab88 3659:d4b8f1e8f0b4
33 self.subcommands = [] 33 self.subcommands = []
34 34
35 def __call__(self, *args, **kwargs): 35 def __call__(self, *args, **kwargs):
36 args = self.subcommands + list(args) 36 args = self.subcommands + list(args)
37 self.subcommands.clear() 37 self.subcommands.clear()
38 kwargs['output'] = 'json_raw' 38 kwargs['output'] = 'json-raw'
39 kwargs['_tty_out'] = False 39 kwargs['_tty_out'] = False
40 cmd = li(*args, **kwargs) 40 cmd = li(*args, **kwargs)
41 return json.loads(cmd.stdout) 41 return json.loads(cmd.stdout)
42 42
43 def __getattr__(self, name): 43 def __getattr__(self, name):
58 self.parser = ElementParser() 58 self.parser = ElementParser()
59 59
60 def __call__(self, *args, **kwargs): 60 def __call__(self, *args, **kwargs):
61 args = self.subcommands + list(args) 61 args = self.subcommands + list(args)
62 self.subcommands.clear() 62 self.subcommands.clear()
63 kwargs['output'] = 'xml_raw' 63 kwargs['output'] = 'xml-raw'
64 kwargs['_tty_out'] = False 64 kwargs['_tty_out'] = False
65 cmd = li(*args, **kwargs) 65 cmd = li(*args, **kwargs)
66 return self.parser(cmd.stdout.decode().strip()) 66 return self.parser(cmd.stdout.decode().strip())
67 67
68 68
151 return None 151 return None
152 152
153 153
154 @pytest.fixture(scope="session") 154 @pytest.fixture(scope="session")
155 def li_json(): 155 def li_json():
156 """Run li with "json_raw" output, and returns the parsed value""" 156 """Run li with "json-raw" output, and returns the parsed value"""
157 return LiberviaCliJson() 157 return LiberviaCliJson()
158 158
159 159
160 @pytest.fixture(scope="session") 160 @pytest.fixture(scope="session")
161 def li_elt(): 161 def li_elt():
162 """Run li with "xml_raw" output, and returns the parsed value""" 162 """Run li with "xml-raw" output, and returns the parsed value"""
163 return LiberviaCliElt() 163 return LiberviaCliElt()
164 164
165 165
166 @pytest.fixture() 166 @pytest.fixture()
167 def editor(): 167 def editor():