From 85823ba65489f3d10a7f2f040701e11a4cb7829f Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Thu, 18 Aug 2022 18:35:26 -0700 Subject: [PATCH] Removing invalid type (#22023) --- .../CHIP/MTROnboardingPayloadParser.h | 3 +- .../CHIP/MTROnboardingPayloadParser.m | 1 - .../CHIPTests/MTRSetupPayloadParserTests.m | 31 ------------------- 3 files changed, 1 insertion(+), 34 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTROnboardingPayloadParser.h b/src/darwin/Framework/CHIP/MTROnboardingPayloadParser.h index cb812ddc41e67a..ce59ff7922bdec 100644 --- a/src/darwin/Framework/CHIP/MTROnboardingPayloadParser.h +++ b/src/darwin/Framework/CHIP/MTROnboardingPayloadParser.h @@ -24,8 +24,7 @@ NS_ASSUME_NONNULL_BEGIN typedef NS_ENUM(NSUInteger, MTROnboardingPayloadType) { MTROnboardingPayloadTypeQRCode = 0, MTROnboardingPayloadTypeManualCode, - MTROnboardingPayloadTypeNFC, - MTROnboardingPayloadTypeAdmin, + MTROnboardingPayloadTypeNFC }; @interface MTROnboardingPayloadParser : NSObject diff --git a/src/darwin/Framework/CHIP/MTROnboardingPayloadParser.m b/src/darwin/Framework/CHIP/MTROnboardingPayloadParser.m index 3af4fe1a38bb9c..df68311d700914 100644 --- a/src/darwin/Framework/CHIP/MTROnboardingPayloadParser.m +++ b/src/darwin/Framework/CHIP/MTROnboardingPayloadParser.m @@ -29,7 +29,6 @@ + (nullable MTRSetupPayload *)setupPayloadForOnboardingPayload:(NSString *)onboa MTRSetupPayload * payload; switch (type) { case MTROnboardingPayloadTypeManualCode: - case MTROnboardingPayloadTypeAdmin: payload = [self setupPayloadForManualCodeOnboardingPayload:onboardingPayload error:error]; break; case MTROnboardingPayloadTypeQRCode: diff --git a/src/darwin/Framework/CHIPTests/MTRSetupPayloadParserTests.m b/src/darwin/Framework/CHIPTests/MTRSetupPayloadParserTests.m index aae5f60ead6575..beb638f777528c 100644 --- a/src/darwin/Framework/CHIPTests/MTRSetupPayloadParserTests.m +++ b/src/darwin/Framework/CHIPTests/MTRSetupPayloadParserTests.m @@ -66,26 +66,6 @@ - (void)testOnboardingPayloadParser_Manual_WrongType XCTAssertEqual(error.code, MTRErrorCodeInvalidArgument); } -- (void)testOnboardingPayloadParser_Admin_NoError -{ - NSError * error; - MTRSetupPayload * payload = [MTROnboardingPayloadParser setupPayloadForOnboardingPayload:@"636108753500001000015" - ofType:MTROnboardingPayloadTypeAdmin - error:&error]; - - XCTAssertNotNil(payload); - XCTAssertNil(error); - - XCTAssertTrue(payload.hasShortDiscriminator); - XCTAssertEqual(payload.discriminator.unsignedIntegerValue, 10); - XCTAssertEqual(payload.setUpPINCode.unsignedIntegerValue, 123456780); - XCTAssertEqual(payload.vendorID.unsignedIntegerValue, 1); - XCTAssertEqual(payload.productID.unsignedIntegerValue, 1); - XCTAssertEqual(payload.commissioningFlow, MTRCommissioningFlowCustom); - XCTAssertEqual(payload.version.unsignedIntegerValue, 0); - XCTAssertNil(payload.rendezvousInformation); -} - - (void)testOnboardingPayloadParser_Admin_WrongType { NSError * error; @@ -118,17 +98,6 @@ - (void)testOnboardingPayloadParser_QRCode_NoError XCTAssertEqual([payload.rendezvousInformation unsignedLongValue], MTRDiscoveryCapabilitiesSoftAP); } -- (void)testOnboardingPayloadParser_QRCode_WrongType -{ - NSError * error; - MTRSetupPayload * payload = [MTROnboardingPayloadParser setupPayloadForOnboardingPayload:@"MT:R5L90MP500K64J00000" - ofType:MTROnboardingPayloadTypeAdmin - error:&error]; - - XCTAssertNil(payload); - XCTAssertEqual(error.code, MTRErrorCodeIntegrityCheckFailed); -} - - (void)testOnboardingPayloadParser_NFC_NoError { NSError * error;