1// Copyright (c) 2015 Ableton AG, Berlin. All rights reserved. 2// 3// Use of this source code is governed by a BSD-style 4// license that can be found in the LICENSE file. 5 6package travis 7 8import ( 9 "context" 10 "fmt" 11 "net/http" 12 "reflect" 13 "testing" 14) 15 16func TestLogsService_FindByJob(t *testing.T) { 17 client, mux, _, teardown := setup() 18 defer teardown() 19 20 mux.HandleFunc(fmt.Sprintf("/job/%d/log", testJobId), func(w http.ResponseWriter, r *http.Request) { 21 testMethod(t, r, http.MethodGet) 22 fmt.Fprint(w, `{"id":1,"content":"test"}`) 23 }) 24 25 log, _, err := client.Logs.FindByJob(context.Background(), testJobId) 26 27 if err != nil { 28 t.Errorf("Log.FindByJob returned error: %v", err) 29 } 30 31 want := &Log{Id: 1, Content: "test"} 32 if !reflect.DeepEqual(log, want) { 33 t.Errorf("Log.FindByJob returned %+v, want %+v", log, want) 34 } 35} 36