pEp macOS Desktop adapter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

66 lines
1.8 KiB

//
// pEpUpdater_Test.m
// pEpUpdater Test
//
// Created by Volker Birk on 27.05.20.
// Copyright © 2020 p≡p foundation. All rights reserved.
// This file is under GNU General Public License 3.0
//
#import <XCTest/XCTest.h>
#import "../pEpMacOSAdapter/pEpUpdater.h"
@interface pEpUpdater_Test : XCTestCase
@end
@implementation pEpUpdater_Test
pEpUpdater* updater;
XCTestExpectation* downloadingExpectation;
- (void)setUp {
downloadingExpectation = [XCTestExpectation alloc];
updater = [[pEpUpdater alloc] initWithSubscriber:^(enum DNType notification, NSString* name, NSString* download) { NSLog(@"notification: %d %@", notification, download); [downloadingExpectation fulfill]; }];
NSString *path = [[NSBundle bundleForClass:[pEpUpdater_Test class]] pathForResource:@"test.der" ofType:nil];
updater.configPath = [path stringByDeletingLastPathComponent];
}
- (void)tearDown {
}
- (void)testUpdate {
[updater update:@"test" usingUrl:@"https://fdik.org/cgidownload?hash=42232323234242"];
}
- (void)testUpdateWithFile {
NSError *err = nil;
[updater updateWithFile:[NSString stringWithFormat:@"%@/%@", updater.configPath, @"test.plist"] error:&err];
XCTAssertNil(err);
}
- (void)testUpdateAll {
[updater updateAll:nil];
}
- (void)testScheduleUpdate {
downloadingExpectation = [[XCTestExpectation alloc] initWithDescription:@"downloading update"];
XCTWaiter* waiter = [XCTWaiter new];
waiter.delegate = self;
[updater scheduleUpdates];
[updater.timer fire]; // don't wait 2 hours now
[waiter waitForExpectations:@[downloadingExpectation] timeout:30];
}
/*
- (void)testPerformanceExample {
// This is an example of a performance test case.
[self measureBlock:^{
// Put the code you want to measure the time of here.
}];
}
*/
@end