| 64 | } |
| 65 | |
| 66 | func TestLoggingCreate(t *testing.T, s Server) { |
| 67 | key := ari.NewKey(ari.LoggingKey, "n1") |
| 68 | runTest("ok", t, s, func(t *testing.T, m *mock, cl ari.Client) { |
| 69 | m.Logging.On("Create", key, "l1").Return(ari.NewLogHandle(key, m.Logging), nil) |
| 70 | |
| 71 | _, err := cl.Asterisk().Logging().Create(key, "l1") |
| 72 | if err != nil { |
| 73 | t.Errorf("Unexpected error in logging create: %s", err) |
| 74 | } |
| 75 | |
| 76 | m.Logging.AssertCalled(t, "Create", key, "l1") |
| 77 | }) |
| 78 | |
| 79 | runTest("err", t, s, func(t *testing.T, m *mock, cl ari.Client) { |
| 80 | m.Logging.On("Create", key, "l1").Return(nil, errors.New("error")) |
| 81 | |
| 82 | _, err := cl.Asterisk().Logging().Create(key, "l1") |
| 83 | if err == nil { |
| 84 | t.Errorf("Expected error in logging create") |
| 85 | } |
| 86 | |
| 87 | m.Logging.AssertCalled(t, "Create", key, "l1") |
| 88 | }) |
| 89 | } |
| 90 | |
| 91 | func TestLoggingDelete(t *testing.T, s Server) { |
| 92 | key := ari.NewKey(ari.LoggingKey, "n1") |