mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-13 21:42:32 +00:00
Stubbed entry proxy to enable better model editing behaviour
This commit is contained in:
46
MacPassTests/MPTextEntryProxy.m
Normal file
46
MacPassTests/MPTextEntryProxy.m
Normal 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
|
||||
Reference in New Issue
Block a user