MCPcopy Create free account
hub / github.com/IBM/mcp-cli / test_provider_commands

Function test_provider_commands

diagnostics/cli_command_diagnostic.py:166–215  ·  view source on GitHub ↗

Test provider-related commands.

()

Source from the content-addressed store, hash-verified

164
165
166def test_provider_commands():
167 """Test provider-related commands."""
168 print("\n" + "=" * 50)
169 print("🧪 Testing Provider Commands")
170 print("=" * 50)
171
172 provider_tests = [
173 (["providers"], "Providers list (default)"),
174 (["providers", "list"], "Providers list explicit"),
175 (["provider"], "Provider status"),
176 (["provider", "list"], "Provider list"),
177 (["models"], "Models for current provider"),
178 (["models", "openai"], "Models for openai"),
179 ]
180
181 results = []
182 for args, description in provider_tests:
183 print(f"\n📝 {description}")
184 success, stdout, stderr = test_mcp_cli_command(args, timeout=15)
185
186 if success:
187 print(f"✅ PASS: {description}")
188 if stdout:
189 # Show first few lines, filtering out startup messages
190 lines = stdout.strip().split("\n")
191 content_lines = [
192 line
193 for line in lines
194 if not (
195 "MCP CLI ready" in line
196 or "Available commands:" in line
197 or "Use --help" in line
198 or (
199 line.startswith(" ")
200 and "commands:" in lines[max(0, lines.index(line) - 1)]
201 )
202 )
203 ]
204 preview_lines = content_lines[:3] if content_lines else lines[:3]
205 for line in preview_lines:
206 if line.strip():
207 print(f" 📄 {line[:80]}...")
208 else:
209 print(f"❌ FAIL: {description}")
210 if stderr:
211 print(f" Error: {stderr[:200]}...")
212
213 results.append((description, success))
214
215 return results
216
217
218def test_advanced_commands(config_file="server_config.json"):

Callers 1

mainFunction · 0.85

Calls 1

test_mcp_cli_commandFunction · 0.85

Tested by

no test coverage detected