package sessionimport import ( "os" "path/filepath" "testing" ) // Real protocol-number session file lives at D:\spider\tgs\13252753163\13252753163.session // Test skips when that file is missing so CI environments don't break. func TestConvertPyrogramSession_RealFile(t *testing.T) { path := `D:\spider\tgs\13252753163\13252753163.session` if _, err := os.Stat(path); err != nil { t.Skipf("real session file absent: %v", err) } data, err := ConvertPyrogramSession(path) if err != nil { t.Fatalf("convert failed: %v", err) } if data.DC < 1 || data.DC > 5 { t.Errorf("unexpected dc: %d", data.DC) } if len(data.AuthKey) != 256 { t.Errorf("auth_key length = %d, want 256", len(data.AuthKey)) } if len(data.AuthKeyID) != 8 { t.Errorf("auth_key_id length = %d, want 8", len(data.AuthKeyID)) } if data.Addr == "" { t.Error("addr empty") } } func TestConvertPyrogramSession_MissingFile(t *testing.T) { missing := filepath.Join(t.TempDir(), "does-not-exist.session") if _, err := ConvertPyrogramSession(missing); err == nil { t.Error("expected error for missing file") } }