Added KeePassKit dependency to MacPassTest

This commit is contained in:
michael starke
2016-01-05 10:42:20 +01:00
parent 06d24f4870
commit a51ddbbe1b
9 changed files with 60 additions and 25 deletions

View File

@@ -7,9 +7,9 @@
//
#import <XCTest/XCTest.h>
#import <KeePassKit/KeePassKit.h>
#import "MPDocument.h"
#import "KeePassKit/KeePassKit.h"
@interface MPDatabaseLoading : XCTestCase

View File

@@ -8,8 +8,7 @@
#import <Cocoa/Cocoa.h>
#import <XCTest/XCTest.h>
#import "KeePassKit/KeePassKit.h"
#import <KeePassKit/KeePassKit.h>
@interface MPDatabaseSearch : XCTestCase

View File

@@ -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;

View File

@@ -7,33 +7,64 @@
//
#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];
// Put setup code here. This method is called before the invocation of each test method in the class.
[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 {
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
[super tearDown];
}
- (void)testExample {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
- (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)testPerformanceExample {
// This is an example of a performance test case.
[self measureBlock:^{
// Put the code you want to measure the time of here.
}];
- (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

View File

@@ -7,9 +7,10 @@
//
#import <XCTest/XCTest.h>
#import <KeePassKit/KeePassKit.h>
#import "MPDocument.h"
#import "KeePassKit/KeePassKit.h"
@interface MPTestDocument : XCTestCase
@end