(t *testing.T)
| 271 | } |
| 272 | |
| 273 | func TestHandleJoinRequest(t *testing.T) { //nolint:paralleltest |
| 274 | for _, tc := range []struct { //nolint:paralleltest |
| 275 | Name string |
| 276 | NewServer func(*assertions.Assertion) *httptest.Server |
| 277 | NetID types.NetID |
| 278 | NSID *types.EUI64 |
| 279 | Request *ttnpb.JoinRequest |
| 280 | ResponseAssertion func(*assertions.Assertion, *ttnpb.JoinResponse) bool |
| 281 | ErrorAssertion func(*assertions.Assertion, error) bool |
| 282 | }{ |
| 283 | { |
| 284 | Name: "Backend Interfaces 1.0/MICFailed", |
| 285 | NewServer: func(a *assertions.Assertion) *httptest.Server { |
| 286 | return newTLSServer(9183, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 287 | a := a |
| 288 | a.So(r.Method, should.Equal, http.MethodPost) |
| 289 | b := test.Must(io.ReadAll(r.Body)) |
| 290 | var req map[string]any |
| 291 | test.Must[any](nil, json.Unmarshal(b, &req)) |
| 292 | a.So(req, should.Resemble, map[string]any{ |
| 293 | "ProtocolVersion": "1.0", |
| 294 | "TransactionID": 0.0, |
| 295 | "MessageType": "JoinReq", |
| 296 | "SenderID": "42FFFF", |
| 297 | "ReceiverID": "70B3D57ED0000000", |
| 298 | "MACVersion": "1.0.3", |
| 299 | "PHYPayload": "00000000D07ED5B370080706050403020100003851F0B6", |
| 300 | "DevEUI": "0102030405060708", |
| 301 | "DevAddr": "01020304", |
| 302 | "DLSettings": "00", |
| 303 | "RxDelay": 5.0, |
| 304 | }) |
| 305 | test.Must[any](nil, json.NewEncoder(w).Encode(map[string]any{ |
| 306 | "ProtocolVersion": "1.0", |
| 307 | "TransactionID": 0.0, |
| 308 | "MessageType": "JoinAns", |
| 309 | "SenderID": "70B3D57ED0000000", |
| 310 | "ReceiverID": "42FFFF", |
| 311 | "Result": map[string]any{ |
| 312 | "ResultCode": "MICFailed", |
| 313 | }, |
| 314 | })) |
| 315 | })) |
| 316 | }, |
| 317 | NetID: types.NetID{0x42, 0xff, 0xff}, |
| 318 | Request: &ttnpb.JoinRequest{ |
| 319 | SelectedMacVersion: ttnpb.MACVersion_MAC_V1_0_3, |
| 320 | DevAddr: types.DevAddr{0x01, 0x02, 0x03, 0x04}.Bytes(), |
| 321 | RxDelay: ttnpb.RxDelay_RX_DELAY_5, |
| 322 | DownlinkSettings: &ttnpb.DLSettings{}, |
| 323 | Payload: &ttnpb.Message{ |
| 324 | Payload: &ttnpb.Message_JoinRequestPayload{ |
| 325 | JoinRequestPayload: &ttnpb.JoinRequestPayload{ |
| 326 | JoinEui: types.EUI64{0x70, 0xb3, 0xd5, 0x7e, 0xd0, 0x00, 0x00, 0x00}.Bytes(), |
| 327 | DevEui: types.EUI64{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}.Bytes(), |
| 328 | }, |
| 329 | }, |
| 330 | }, |
nothing calls this directly
no test coverage detected