make_post_sell/test_dogecoin_client.py
Russell Ballestrini 800b7965b5 Fix crypto watcher stuck payments and improve cart deactivation
- Exclude already-swept payments from watcher queue to prevent endless processing
- Mark swept payments as "swept" status to remove from future cycles
- Fix cart deactivation by ensuring shop/user objects are attached to session
- Add debug logging for cart deactivation to track behavior
- Resolves issue where confirmed payments were processed every 20 seconds indefinitely

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-23 12:35:56 -04:00

67 lines
1.9 KiB
Python

#!/usr/bin/env python3
"""
Test the DogecoinClient with requests library.
"""
import sys
import os
# Add the current directory to path so we can import the module
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from make_post_sell.lib.crypto_clients import DogecoinClient
def test_dogecoin_mock():
"""Test DogecoinClient with mock implementation (no real RPC needed)"""
print("=== Testing DogecoinClient (Mock mode) ===")
# This uses the MockDogecoinClient which doesn't need a real server
from make_post_sell.lib.crypto_clients import MockDogecoinClient
client = MockDogecoinClient()
try:
# Test basic operations
address = client.getnewaddress("test")
print(f"✓ Generated address: {address}")
balance = client.getbalance()
print(f"✓ Balance: {balance} DOGE")
height = client.getblockcount()
print(f"✓ Block height: {height}")
print("✓ MockDogecoinClient working correctly")
return True
except Exception as e:
print(f"✗ MockDogecoinClient failed: {e}")
return False
def test_dogecoin_real():
"""Test DogecoinClient with real RPC (would need running dogecoind)"""
print("\n=== Testing DogecoinClient (Real RPC - will likely fail) ===")
# This would need a real Dogecoin RPC running
client = DogecoinClient("http://127.0.0.1:22555", "test_user", "test_pass")
try:
info = client.getnetworkinfo()
print(f"✓ Network info: {info}")
return True
except Exception as e:
print(f"✗ EXPECTED FAILURE (no Dogecoin RPC running): {e}")
return False
if __name__ == "__main__":
print("Dogecoin Client Test")
print("=" * 40)
test_dogecoin_mock()
test_dogecoin_real()
print("\nNote: Real RPC test expected to fail unless dogecoind is running")
print("The important thing is that the mock client works correctly.")