mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-13 21:42:32 +00:00
Merge branch 'master' of https://github.com/alex-petkevich/MacPass
This commit is contained in:
@@ -7,9 +7,9 @@
|
||||
//
|
||||
|
||||
#import <XCTest/XCTest.h>
|
||||
#import <KeePassKit/KeePassKit.h>
|
||||
|
||||
#import "MPDocument.h"
|
||||
#import "KeePassKit/KeePassKit.h"
|
||||
|
||||
@interface MPDatabaseLoading : XCTestCase
|
||||
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#import "KeePassKit/KeePassKit.h"
|
||||
#import <KeePassKit/KeePassKit.h>
|
||||
|
||||
@interface MPDatabaseSearch : XCTestCase
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <Carbon/Carbon.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
#import <KeePassKit/KeePassKit.h>
|
||||
|
||||
#import "MPAutotypeCommand.h"
|
||||
#import "MPAutotypeContext.h"
|
||||
@@ -17,7 +18,6 @@
|
||||
|
||||
#import "MPKeyMapper.h"
|
||||
|
||||
#import "KeePassKit/KeePassKit.h"
|
||||
|
||||
@interface MPTestAutotype : XCTestCase
|
||||
@property (strong) KPKEntry *entry;
|
||||
|
||||
70
MacPassTests/MPTestAutotypeDelay.m
Normal file
70
MacPassTests/MPTestAutotypeDelay.m
Normal file
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// MPTestAutotypeDelay.m
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 28/12/15.
|
||||
// Copyright © 2015 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import <XCTest/XCTest.h>
|
||||
#import <KeePassKit/KeePassKit.h>
|
||||
|
||||
#import "MPAutotypeContext.h"
|
||||
#import "MPAutotypeDelay.h"
|
||||
|
||||
@interface MPTestAutotypeDelay : XCTestCase
|
||||
@property (strong) KPKEntry *entry;
|
||||
@end
|
||||
|
||||
@implementation MPTestAutotypeDelay
|
||||
|
||||
- (void)setUp {
|
||||
[super setUp];
|
||||
self.entry = [[KPKEntry alloc] init];
|
||||
self.entry.title = @"Title";
|
||||
self.entry.url = @"www.myurl.com";
|
||||
self.entry.username = @"Username";
|
||||
self.entry.password = @"Password";
|
||||
}
|
||||
|
||||
- (void)tearDown {
|
||||
[super tearDown];
|
||||
}
|
||||
|
||||
- (void)testValidDelayCommands {
|
||||
/* Command 1 */
|
||||
MPAutotypeContext *context = [[MPAutotypeContext alloc] initWithEntry:self.entry andSequence:@"{DELAY 200}"];
|
||||
NSArray *commands = [MPAutotypeCommand commandsForContext:context];
|
||||
|
||||
XCTAssertTrue(commands.count == 1);
|
||||
/* {DELAY 200} */
|
||||
XCTAssertTrue([commands.firstObject isKindOfClass:[MPAutotypeDelay class]], @"Command is Delay command");
|
||||
MPAutotypeDelay *delay = commands.firstObject;
|
||||
XCTAssertEqual(delay.delay, 200, @"Delay is 200 ms");
|
||||
}
|
||||
|
||||
- (void)testDelayExecution {
|
||||
MPAutotypeDelay *delay = [[MPAutotypeDelay alloc] initWithDelay:200];
|
||||
XCTestExpectation *expectation = [self expectationWithDescription:delay.description];
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
[delay execute];
|
||||
[expectation fulfill];
|
||||
});
|
||||
|
||||
[self waitForExpectationsWithTimeout:(delay.delay/1000.0) handler:^(NSError *error) {
|
||||
if (error != nil) {
|
||||
NSLog(@"Error: %@", error.localizedDescription);
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
- (void)testDelayLimit {
|
||||
XCTFail(@"Missing Test");
|
||||
}
|
||||
|
||||
- (void)testMalformedDelay {
|
||||
XCTFail(@"Missing Test");
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -7,9 +7,10 @@
|
||||
//
|
||||
|
||||
#import <XCTest/XCTest.h>
|
||||
#import <KeePassKit/KeePassKit.h>
|
||||
|
||||
#import "MPDocument.h"
|
||||
#import "KeePassKit/KeePassKit.h"
|
||||
|
||||
@interface MPTestDocument : XCTestCase
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user