Skip to content

Commit

Permalink
fix PURL GET, update create & delete test
Browse files Browse the repository at this point in the history
  • Loading branch information
ejstreet committed Feb 22, 2023
1 parent 30124e6 commit 67780ce
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
8 changes: 4 additions & 4 deletions omglol/purl.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (c *Client) GetPersistentURL(domain string, purlName string) (*PersistentUR
Name string `json:"name"`
URL string `json:"url"`
Counter *string `json:"counter"`
Listed *string `json:"listed"`
Listed *int64 `json:"listed"`
} `json:"purl"`
} `json:"response"`
}
Expand Down Expand Up @@ -137,9 +137,9 @@ func (c *Client) ListPersistentURLs(address string) (*[]PersistentURL, error) {
Response struct {
Message string `json:"message"`
PURLs []struct {
Name string `json:"name"`
URL string `json:"url"`
Counter *int64 `json:"counter"`
Name string `json:"name"`
URL string `json:"url"`
Counter *int64 `json:"counter"`
Listed *int64 `json:"listed"`
} `json:"purls"`
} `json:"response"`
Expand Down
32 changes: 28 additions & 4 deletions omglol/purl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,40 @@ func TestCreateAndDeletePersistentURL(t *testing.T) {
t.Errorf(err.Error())
}

name := "test" + RunUID
name1 := "testunlisted" + RunUID

p := NewPersistentURL(name, "https://example.com", false)
unlisted := NewPersistentURL(name1, "https://example.com", false)

err = c.CreatePersistentURL(testOwnedDomain, *p)
err = c.CreatePersistentURL(testOwnedDomain, *unlisted)
if err != nil {
t.Errorf(err.Error())
}

err = c.DeletePersistentURL(testOwnedDomain, name)
_, err = c.GetPersistentURL(testOwnedDomain, name1)
if err != nil {
t.Errorf(err.Error())
}

err = c.DeletePersistentURL(testOwnedDomain, name1)
if err != nil {
t.Errorf(err.Error())
}

name2 := "testlisted" + RunUID

listed := NewPersistentURL(name2, "https://example.com", true)

err = c.CreatePersistentURL(testOwnedDomain, *listed)
if err != nil {
t.Errorf(err.Error())
}

_, err = c.GetPersistentURL(testOwnedDomain, name2)
if err != nil {
t.Errorf(err.Error())
}

err = c.DeletePersistentURL(testOwnedDomain, name2)
if err != nil {
t.Errorf(err.Error())
}
Expand Down

0 comments on commit 67780ce

Please sign in to comment.