Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
33 lines (26 sloc) 1.68 KB
// Copyright 2010 Florian Duraffourg. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package openid
import (
// ParseXRDS Test
type ParseXRDSTest struct {
in []byte
OPEndPoint string
ClaimedId string
var ParseXRDSTests = []ParseXRDSTest{
ParseXRDSTest{[]byte("<?xml version=\"1.0\" encoding=\"UTF-8\"?><xrds:XRDS xmlns:xrds=\"xri://$xrds\" xmlns=\"xri://$xrd*($v*2.0)\"><XRD><Service xmlns=\"xri://$xrd*($v*2.0)\">\n<Type></Type>\n <URI></URI>\n <LocalID></LocalID>\n </Service></XRD></xrds:XRDS>"), "", ""},
ParseXRDSTest{[]byte("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<xrds:XRDS xmlns:xrds=\"xri://$xrds\" xmlns=\"xri://$xrd*($v*2.0)\">\n<XRD>\n <Service>\n <Type></Type>\n <Type></Type>\n <Type></Type>\n <Type></Type>\n <URI priority=\"20\"></URI>\n </Service>\n</XRD>\n</xrds:XRDS>"), "", ""},
func TestParseXRDS(t *testing.T) {
for _, xrds := range ParseXRDSTests {
var opep, ci = ParseXRDS(bytes.NewBuffer(
if !bytes.Equal([]byte(opep), []byte(xrds.OPEndPoint)) || !bytes.Equal([]byte(ci), []byte(xrds.ClaimedId)) {
t.Errorf("ParseXRDS(%s) = (%s, %s) want (%s, %s).",, opep, ci, xrds.OPEndPoint, xrds.ClaimedId)
Something went wrong with that request. Please try again.