clone

a desktop tv and program guide for over-the-air broadcasts: what's on air, what your tuner gets, live tv, recordings

Let apps change only the hours of listings

FelineStateMachine committed 71151f5
PUT /api/config took a whole config, so an app could move the server's
location; the location is the server's own, from its flags.
commit
71151f59be443b65522c7e2ccfd70859155e73e2
parent
b15ab0845c3b1b1e2e8f8a00c82e7e8c3e28ddd4
author
FelineStateMachine <226808055+FelineStateMachine@users.noreply.github.com>
kind
fix risk score 1.9 of 3, Jev's estimate
2 files changed, +15 -4
Minternal/api/api.go10+++++++++-
Minternal/api/api_test.go9++++++---
M internal/api/api.go +9 -1
M internal/api/api_test.go +6 -3
@@ -81,7 +81,7 @@ func (f *fake) Stop(_ context.Context, client string) error { f.stopped = client
8181 func (f *fake) Heartbeat(_ context.Context, client string) (bool, error) {8282 return client == "mac" && f.stopped == "", nil8383 }84-func (f *fake) DVR(context.Context) (*dvr.State, error) { return &dvr.State{Available: true}, nil }84+func (f *fake) DVR(context.Context) (*dvr.State, error) { return &dvr.State{Available: true}, nil }8585 func (f *fake) Record(_ context.Context, r dvr.Request) (*dvr.Rule, error) {8686 return &dvr.Rule{ID: "r1", Kind: r.Kind, Channel: r.Channel}, nil8787 }
@@ -137,8 +137,11 @@ func TestClientServerRoundTrip(t *testing.T) {
137137 if be.tuned != "mac:7.1" || pb.URL != srv.URL+"/live/abc/index.m3u8" {138138 t.Errorf("tune: backend saw %q, playback URL %q", be.tuned, pb.URL)139139 }140- if _, err := c.SetConfig(ctx, service.Config{ZIP: "80302"}); err != nil || be.cfg.ZIP != "80302" {141- t.Errorf("set config: %v, backend has %+v", err, be.cfg)140+ // An app changes the hours of listings, never the location.141+ be.cfg = service.Config{ZIP: "80302", RadiusKm: 160, GuideHours: 24}142+ if got, err := c.SetConfig(ctx, service.Config{ZIP: "10001", Lat: 40.7, Lon: -74, GuideHours: 48}); err != nil ||143+ be.cfg != (service.Config{ZIP: "80302", RadiusKm: 160, GuideHours: 48}) || got != be.cfg {144+ t.Errorf("set config: %+v, %v, backend has %+v", got, err, be.cfg)142145 }143146 if err := c.DeleteRecording(ctx, "e/1"); err != nil || be.deleted != "e/1" {144147 t.Errorf("delete: %v, backend saw %q", err, be.deleted)