FRAAccountTableViewControllerTests.m revision ff2edace1e77f0e80bc2f5da30344d21c3274885
/*
* 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 "FRAHotpOathMechanism.h"
#import "FRAIdentityModel.h"
#import "FRAIdentity.h"
#import "FRAModelUtils.h"
#import "FRANotification.h"
#import "FRAPushMechanism.h"
#import "FRAPushMechanismTableViewCell.h"
#import "FRATotpOathMechanism.h"
@interface FRAAccountTableViewControllerTests : XCTestCase
@end
}
- (void)setUp {
[super setUp];
identity = [FRAIdentity identityWithDatabase:nil identityModel:nil accountName:@"Alice" issuer:@"ForgeRock" image:nil backgroundColor: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");
}
// Given
// When
// Then
XCTAssertTrue([self isShowingCellAtIndexPath:oathMechanismIndexPath], @"OATH mechanism UI should be displayed");
XCTAssertFalse([self isShowingCellAtIndexPath:pushMechanismIndexPath], @"Push mechanism UI should not be displayed");
}
// Given
FRAPushMechanism *pushMechanism = [FRAPushMechanism pushMechanismWithDatabase:nil identityModel:nil];
// When
// Then
XCTAssertFalse([self isShowingCellAtIndexPath:oathMechanismIndexPath], @"OATH mechanism UI should not be displayed");
XCTAssertTrue([self isShowingCellAtIndexPath:pushMechanismIndexPath], @"Push mechanism UI should be displayed");
}
// Given
FRAPushMechanism *pushMechanism = [FRAPushMechanism pushMechanismWithDatabase:nil identityModel:nil];
// When
// Then
}
- (void)simulateLoadingOfView {
} else {
}
}
- (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