feat(connector): [31188f42] Finalize production optimizations, filtering, and dashboard enhancements
This commit is contained in:
41
connector-superoffice/tools/test_selection_membership.py
Normal file
41
connector-superoffice/tools/test_selection_membership.py
Normal file
@@ -0,0 +1,41 @@
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
|
||||
# Absolute path setup
|
||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
connector_dir = os.path.abspath(os.path.join(current_dir, '..'))
|
||||
sys.path.insert(0, connector_dir)
|
||||
|
||||
from superoffice_client import SuperOfficeClient
|
||||
|
||||
def test_membership(contact_id: int):
|
||||
selection_id = 10960
|
||||
print(f"🔎 Testing if Contact {contact_id} is member of Selection {selection_id}...")
|
||||
client = SuperOfficeClient()
|
||||
|
||||
# Efficient Membership Check
|
||||
# GET Selection/{id}/MemberStatus/Contact/{contactId}
|
||||
endpoint = f"Selection/{selection_id}/MemberStatus/Contact/{contact_id}"
|
||||
|
||||
print(f"📡 Querying: {endpoint}")
|
||||
try:
|
||||
resp = client._get(endpoint)
|
||||
print(f"✅ Response: {json.dumps(resp, indent=2)}")
|
||||
|
||||
# Result format is usually a string: "Member", "NotMember", "Excluded"
|
||||
if resp == "Member":
|
||||
print("🎯 YES: Contact is a member.")
|
||||
else:
|
||||
print("⏭️ NO: Contact is NOT a member.")
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Membership check failed: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Test with Tanja Ullmann (171188) which we identified as Roboplanet
|
||||
test_membership(171188)
|
||||
|
||||
# Test with Wackler parent (ID 3)
|
||||
print("\n--- Control Test ---")
|
||||
test_membership(3)
|
||||
Reference in New Issue
Block a user