import os import sys # Ensure the root path is in sys.path sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from ingestion.graph_client import GraphClient def main(): print("=== PHASE 1 & 2 SMOKE TEST ===") client = GraphClient() print(f"Tenant ID: {client.tenant_id}") print(f"Client ID: {client.client_id}") try: token = client.get_access_token() print(">> PHASE 1 PASS: Successfully obtained and validated token.") except Exception as e: print(f">> PHASE 1 FAIL: {e}") return hostname = "285pdg.sharepoint.com" site_path = "/sites/poc_system" site_id = None try: print(f"\n--- GET /sites/{hostname} ---") site_info = client.get_site_by_hostname(hostname) print(">> SUCCESS") except Exception as e: print(f">> FAIL: {e}") try: print(f"\n--- GET /sites/{hostname}:{site_path} ---") site_info = client.get_site_by_path(hostname, site_path) site_id = site_info.get("id") print(f">> SUCCESS - Site ID: {site_id}") except Exception as e: print(f">> FAIL: {e}") if not site_id: print("Cannot proceed to drive steps without site_id.") return try: print(f"\n--- GET /sites/{site_id}/drive ---") drive_info = client.get_drive(site_id) drive_id = drive_info.get("id") print(f">> SUCCESS - Drive ID: {drive_id}") except Exception as e: print(f">> FAIL: {e}") try: print(f"\n--- GET /sites/{site_id}/drive/root/children ---") children_info = client.get_drive_root_children(site_id) print(f">> SUCCESS - Found {len(children_info.get('value', []))} items.") except Exception as e: print(f">> FAIL: {e}") try: print(f"\n--- GET /sites/{site_id}/drive/root/delta ---") delta_info = client.get_drive_root_delta(site_id) print(">> SUCCESS") except Exception as e: print(f">> FAIL: {e}") if __name__ == "__main__": main()