mik-laj commented on a change in pull request #8535:
URL: https://github.com/apache/airflow/pull/8535#discussion_r415204731
##########
File path: tests/cli/commands/test_variable_command.py
##########
@@ -124,10 +82,78 @@ def test_variables(self):
self.assertEqual(False, Variable.get('false', deserialize_json=True))
self.assertEqual(None, Variable.get('null', deserialize_json=True))
- os.remove('variables1.json')
- os.remove('variables2.json')
- os.remove('variables3.json')
+ os.remove('variables_types.json')
- def test_get_missing_variable(self):
+ @unittest.mock.patch('sys.stdout', new_callable=io.StringIO)
+ def test_variables_get(self, mock_stdout):
+ """"Test variable_get command"""
+ # Test conventional get call
+ variable_command.variables_set(self.parser.parse_args([
+ 'variables', 'set', 'foo', '{"foo":"bar"}']))
+ variable_command.variables_get(self.parser.parse_args([
+ 'variables', 'get', 'foo']))
+ self.assertEqual(mock_stdout.getvalue(), '{"foo":"bar"}\n')
with self.assertRaises(SystemExit):
-
variable_command.variables_get(self.parser.parse_args(['variables', 'get',
'no-existing-VAR']))
+
variable_command.variables_get(self.parser.parse_args(['variables', 'get',
'no-existing-VAR'])
Review comment:
```suggestion
variable_command.variables_get(self.parser.parse_args(['variables', 'get',
'no-existing-VAR']))
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]