MCPcopy Create free account
hub / github.com/Codeplain-ai/codeplain / test_promo_credit_buckets

Method test_promo_credit_buckets

tests/test_cli_output.py:418–457  ·  view source on GitHub ↗

Test status display includes promo credit buckets.

(self, mock_console, mock_api_class)

Source from the content-addressed store, hash-verified

416 @patch("cli_output.status.codeplain_api.CodeplainAPI")
417 @patch("cli_output.status.console")
418 def test_promo_credit_buckets(self, mock_console, mock_api_class):
419 """Test status display includes promo credit buckets."""
420 mock_api = Mock()
421 mock_api_class.return_value = mock_api
422 mock_api.connection_check.return_value = {
423 "client_version_valid": True,
424 "min_client_version": "0.3.0",
425 }
426 mock_api.status.return_value = {
427 "user": {
428 "first_name": "John",
429 "last_name": "Doe",
430 "email": "john@example.com",
431 },
432 "api_key_label": "test-key",
433 "organization_owner_email": "owner@example.com",
434 "plan_credits": None,
435 "purchased_credits": [
436 {
437 "total": 100,
438 "remaining": 50,
439 "expiry_date": "2030-06-12T00:00:00+00:00",
440 },
441 ],
442 "promo_credits": [
443 {
444 "total": 30,
445 "remaining": 15,
446 "expiry_date": "2030-12-31T00:00:00+00:00",
447 },
448 ],
449 }
450
451 print_status("fake-key", "http://localhost:5000", "0.3.0")
452
453 calls = [str(call) for call in mock_console.print.call_args_list]
454 promo_calls = [c for c in calls if "Promo" in c]
455 assert len(promo_calls) == 1
456 # Active credits remain, so no "no credits remaining" warning
457 assert not any("No rendering credits remaining" in c for c in calls)
458
459 @patch("cli_output.status.codeplain_api.CodeplainAPI")
460 @patch("cli_output.status.console")

Callers

nothing calls this directly

Calls 1

print_statusFunction · 0.90

Tested by

no test coverage detected