def test_invalid_params(self, sys_patched, empty_options, empty_suboptions, test_data_source): # query test_data_source takes four required params buffer_ = dumps({'type': 'test', 'name': 'stdout', 'foo': 1, 'bar': 1}) sys_patched.stdin.read.return_value = buffer_ command = build_datasource_echo_type(test_data_source) with pytest.raises(InvalidParams): command.execute(empty_options, empty_suboptions, "-")
def test_execute(self, empty_options, empty_suboptions, test_data_source): # otupus returns a hardcoded name and the type of the # datasource along with the expected keys of datasource output = { 'type': 'test', 'name': 'stdout', 'foo': 1, 'bar': 2 } command = build_datasource_echo_type(test_data_source) with patch("__builtin__.print") as print_patched: command.execute(empty_options, empty_suboptions, 1, 2) print_patched.assert_called_with(dumps(output))
def test_invalid_params(self, empty_options, empty_suboptions, test_data_source): # test_data_source takes two params command = build_datasource_echo_type(test_data_source) with pytest.raises(InvalidParams): command.execute(empty_options, empty_suboptions, 1)