FRAAccountTableViewControllerTests.m revision a3970d0ea62388e4ede01470a6436eb5c6c92353
/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2016 ForgeRock AS.
*/
#import <OCMock/OCMock.h>
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
#import "FRAAccountTableViewController.h"
#import "FRAApplicationAssembly.h"
#import "FRAIdentityModel.h"
#import "FRAIdentity.h"
#import "FRANotification.h"
#import "FRAOathMechanism.h"
#import "FRAPushMechanism.h"
#import "FRAPushMechanismTableViewCell.h"
@interface FRAAccountTableViewControllerTests : XCTestCase
@end
}
- (void)setUp {
[super setUp];
identity = [FRAIdentity identityWithDatabase:nil accountName:@"Alice" issuer:@"ForgeRock" image:nil];
// load accounts controller from storyboard
viewController = [storyboard instantiateViewControllerWithIdentifier:@"AccountTableViewController"];
}
- (void)tearDown {
[super tearDown];
}
// Given
// When
// Then
}
// Given
// When
// Then
XCTAssertFalse([self isShowingCellAtIndexPath:oathMechanismIndexPath], @"OATH mechanism UI should not be displayed");
XCTAssertFalse([self isShowingCellAtIndexPath:pushMechanismIndexPath], @"Push mechanism UI should not be displayed");
}
// FIXME: This test failing because FRAIdentity mechanismsList sees oath mechanism as FRAMechanism rather than FRAOathMechanism!
//- (void)testShowsOathMechanismIfIdentityHasOneRegistered {
// // Given
// FRAOathMechanism *oathMechanism = [FRAOathMechanism oathMechanismWithDatabase:nil type:nil usingSecretKey:nil andHMACAlgorithm:nil withKeyLength:nil andEitherPeriod:nil orCounter:nil];
// [identity addMechanism:oathMechanism];
//
// // When
// [self simulateLoadingOfView];
//
// // Then
// XCTAssertTrue([self isShowingCellAtIndexPath:oathMechanismIndexPath], @"OATH mechanism UI should be displayed");
// XCTAssertFalse([self isShowingCellAtIndexPath:pushMechanismIndexPath], @"Push mechanism UI should not be displayed");
//}
// Given
// When
// Then
XCTAssertFalse([self isShowingCellAtIndexPath:oathMechanismIndexPath], @"OATH mechanism UI should not be displayed");
XCTAssertTrue([self isShowingCellAtIndexPath:pushMechanismIndexPath], @"Push mechanism UI should be displayed");
}
// Given
// When
// Then
}
- (void)simulateLoadingOfView {
}
- (void)simulateUnloadingOfView {
}
}
messageId:@"dummy"
challenge:@"dummy"
timeToLive:120.0];
}
return notification;
}
return (FRAOathMechanismTableViewCell*) [viewController tableView:viewController.tableView cellForRowAtIndexPath:oathMechanismIndexPath];
}
return (FRAPushMechanismTableViewCell*) [viewController tableView:viewController.tableView cellForRowAtIndexPath:pushMechanismIndexPath];
}
@end