streamdata: edit metadata
This edits metadata in a robust way. Signed-off-by: Yonah <contrib@gensokyo.uk>
This commit is contained in:
@@ -356,6 +356,28 @@ func TestChannel(t *testing.T) {
|
||||
t.Errorf("(rf) Add: %#v", data)
|
||||
}
|
||||
|
||||
wantVODEdit := streamdata.VOD{
|
||||
Title: "edit\x00",
|
||||
Date: time.Unix(0xdeadbeef, 0).UTC(),
|
||||
Category: "\t\x00",
|
||||
Mirror: "https://satori.hifuu.internal/edit.mp4\x00",
|
||||
}
|
||||
if err := c.Edit(&streamdata.Ident{Channel: 0xcafe}, func(v *streamdata.VOD) error {
|
||||
if *v != (streamdata.VOD{}) {
|
||||
t.Errorf("Edit: v = %#v", v)
|
||||
}
|
||||
|
||||
*v = wantVODEdit
|
||||
return nil
|
||||
}); err != nil {
|
||||
t.Fatalf("Edit: error = %v", err)
|
||||
}
|
||||
if gotVODEdit, err := c.Load(&streamdata.Ident{Channel: 0xcafe}); err != nil {
|
||||
t.Fatalf("(edit) Load: error = %v", err)
|
||||
} else if *gotVODEdit != wantVODEdit {
|
||||
t.Errorf("Edit: %#v, want %#v", *gotVODEdit, wantVODEdit)
|
||||
}
|
||||
|
||||
if err := os.Chmod(path.Join(d, "vod", wantIdent), 0); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user