|
@@ -1371,8 +1371,6 @@ func TestUpdateEnclosure(t *testing.T) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func boolPtr(b bool) *bool { return &b }
|
|
|
|
|
-
|
|
|
|
|
func TestEntryIDsFilterSerialization(t *testing.T) {
|
|
func TestEntryIDsFilterSerialization(t *testing.T) {
|
|
|
tests := []struct {
|
|
tests := []struct {
|
|
|
name string
|
|
name string
|
|
@@ -1389,7 +1387,7 @@ func TestEntryIDsFilterSerialization(t *testing.T) {
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
name: "starred_false",
|
|
name: "starred_false",
|
|
|
- filter: &EntryIDsFilter{Starred: boolPtr(false)},
|
|
|
|
|
|
|
+ filter: &EntryIDsFilter{Starred: new(false)},
|
|
|
query: "?starred=false",
|
|
query: "?starred=false",
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -1479,12 +1477,12 @@ func TestEntryIDsFilterSerialization(t *testing.T) {
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
name: "globally_visible_true",
|
|
name: "globally_visible_true",
|
|
|
- filter: &EntryIDsFilter{GloballyVisible: boolPtr(true)},
|
|
|
|
|
|
|
+ filter: &EntryIDsFilter{GloballyVisible: new(true)},
|
|
|
query: "?globally_visible=true",
|
|
query: "?globally_visible=true",
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
name: "globally_visible_false",
|
|
name: "globally_visible_false",
|
|
|
- filter: &EntryIDsFilter{GloballyVisible: boolPtr(false)},
|
|
|
|
|
|
|
+ filter: &EntryIDsFilter{GloballyVisible: new(false)},
|
|
|
query: "?globally_visible=false",
|
|
query: "?globally_visible=false",
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -1588,7 +1586,7 @@ func TestEntryIDsWithAllFilters(t *testing.T) {
|
|
|
filter := &EntryIDsFilter{
|
|
filter := &EntryIDsFilter{
|
|
|
Limit: 2,
|
|
Limit: 2,
|
|
|
Offset: 5,
|
|
Offset: 5,
|
|
|
- Starred: boolPtr(false),
|
|
|
|
|
|
|
+ Starred: new(false),
|
|
|
Status: "removed",
|
|
Status: "removed",
|
|
|
Order: "published_at",
|
|
Order: "published_at",
|
|
|
Direction: "asc",
|
|
Direction: "asc",
|
|
@@ -1605,7 +1603,7 @@ func TestEntryIDsWithAllFilters(t *testing.T) {
|
|
|
Search: `go & "rss"`,
|
|
Search: `go & "rss"`,
|
|
|
Statuses: []string{EntryStatusUnread, EntryStatusRead},
|
|
Statuses: []string{EntryStatusUnread, EntryStatusRead},
|
|
|
Tags: []string{"go", "release notes"},
|
|
Tags: []string{"go", "release notes"},
|
|
|
- GloballyVisible: boolPtr(false),
|
|
|
|
|
|
|
+ GloballyVisible: new(false),
|
|
|
}
|
|
}
|
|
|
expected := &EntryIDsResultSet{Total: 1, EntryIDs: []int64{42}}
|
|
expected := &EntryIDsResultSet{Total: 1, EntryIDs: []int64{42}}
|
|
|
const expectedURL = "http://mf/v1/entries/ids?after=1700000000&after_entry_id=10" +
|
|
const expectedURL = "http://mf/v1/entries/ids?after=1700000000&after_entry_id=10" +
|
|
@@ -1685,7 +1683,7 @@ func TestEntryIDsWithStarredFilter(t *testing.T) {
|
|
|
expectRequest(t, http.MethodGet, "http://mf/v1/entries/ids?starred=true", nil, req)
|
|
expectRequest(t, http.MethodGet, "http://mf/v1/entries/ids?starred=true", nil, req)
|
|
|
return jsonResponseFrom(t, http.StatusOK, http.Header{}, expected)
|
|
return jsonResponseFrom(t, http.StatusOK, http.Header{}, expected)
|
|
|
})))
|
|
})))
|
|
|
- res, err := client.EntryIDsContext(t.Context(), &EntryIDsFilter{Starred: boolPtr(true)})
|
|
|
|
|
|
|
+ res, err := client.EntryIDsContext(t.Context(), &EntryIDsFilter{Starred: new(true)})
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
t.Fatalf("Expected no error, got %v", err)
|
|
t.Fatalf("Expected no error, got %v", err)
|
|
|
}
|
|
}
|
|
@@ -1727,7 +1725,7 @@ func TestEntryIDsWithCombinedFilter(t *testing.T) {
|
|
|
expectRequest(t, http.MethodGet, "http://mf/v1/entries/ids?limit=2&offset=5&starred=false&status=read", nil, req)
|
|
expectRequest(t, http.MethodGet, "http://mf/v1/entries/ids?limit=2&offset=5&starred=false&status=read", nil, req)
|
|
|
return jsonResponseFrom(t, http.StatusOK, http.Header{}, expected)
|
|
return jsonResponseFrom(t, http.StatusOK, http.Header{}, expected)
|
|
|
})))
|
|
})))
|
|
|
- res, err := client.EntryIDsContext(t.Context(), &EntryIDsFilter{Limit: 2, Offset: 5, Starred: boolPtr(false), Status: EntryStatusRead})
|
|
|
|
|
|
|
+ res, err := client.EntryIDsContext(t.Context(), &EntryIDsFilter{Limit: 2, Offset: 5, Starred: new(false), Status: EntryStatusRead})
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
t.Fatalf("Expected no error, got %v", err)
|
|
t.Fatalf("Expected no error, got %v", err)
|
|
|
}
|
|
}
|