Stubbed entry proxy to enable better model editing behaviour

This commit is contained in:
michael starke
2016-03-07 19:55:35 +01:00
parent cd901cb227
commit d408c925bf
4 changed files with 117 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
//
// MPTextEntryProxy.m
// MacPass
//
// Created by Michael Starke on 07/03/16.
// Copyright © 2016 HicknHack Software GmbH. All rights reserved.
//
#import <XCTest/XCTest.h>
#import <KeePassKit/KeePassKit.h>
#import "MPEntryProxy.h"
@interface MPTextEntryProxy : XCTestCase
@property (strong) KPKEntry *entry;
@property (strong) MPEntryProxy *proxy;
@end
@implementation MPTextEntryProxy
- (void)setUp {
[super setUp];
self.entry = [[KPKEntry alloc] init];
self.entry.title = @"Entry Title";
self.entry.url = @"http://www.internet.com";
self.entry.password = @"1234";
self.entry.username = @"Entry Username";
self.entry.autotype.defaultKeystrokeSequence = @"{TAB 3}";
self.proxy = [[MPEntryProxy alloc] initWithEntry:self.entry];
}
- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}
- (void)testMethodForwarding {
NSString *newPassword = @"new password";
[((id)self.proxy) setPassword:newPassword];
XCTAssertEqualObjects(self.entry.password, newPassword, @"Proxy has forwared password setting to KPKEntry!");
}
@end