def test_execute(self, empty_options, empty_suboptions, test_data_source, nonedefault_store): empty_options.store = nonedefault_store.path output = { 'type': 'test', 'name': 'datasource one', 'bar': 'b', 'foo': 'a' } with patch("__builtin__.print") as print_patched: DataSourceCommand.execute(empty_options, empty_suboptions, "datasource one") print_patched.assert_called_with(dumps(output))
def test_invalid_params(self, empty_options, empty_suboptions, test_data_source, nonedefault_store): empty_options.store = nonedefault_store.path # DataSource takes one param with pytest.raises(InvalidParams): DataSourceCommand.execute(empty_options, empty_suboptions)
def test_execute_not_found(self, empty_options, empty_suboptions, test_data_source, nonedefault_store): empty_options.store = nonedefault_store.path with patch("__builtin__.print") as print_patched: DataSourceCommand.execute(empty_options, empty_suboptions, "xxxx") print_patched.assert_called_with("Datasource `xxxx` NOT FOUND")