99#import < XCTest/XCTest.h>
1010#import " CCPackageUnzipper.h"
1111#import " CCPackage.h"
12- #import " CCPackageInstallData.h"
13- #import " CCPackage+InstallData.h"
1412#import " CCPackageConstants.h"
1513#import " CCPackageUnzipperDelegate.h"
1614#import " CCUnitTestAssertions.h"
15+ #import " CCPackage_private.h"
1716
1817@interface CCPackageUnzipperTests : XCTestCase <CCPackageUnzipperDelegate>
1918
2019@property (nonatomic , strong ) CCPackage *package;
21- @property (nonatomic , strong ) CCPackageInstallData *installData;
2220@property (nonatomic , copy ) NSString *unzipFolderPath;
2321@property (nonatomic , strong ) NSCondition *condition;
2422@property (nonatomic ) BOOL unzipperReturned;
@@ -38,7 +36,6 @@ - (void)setUp
3836 self.unzipperReturned = NO ;
3937 self.unzippingError = nil ;
4038 self.unzippingSuccessful = NO ;
41-
4239 self.unzipFolderPath = [NSTemporaryDirectory () stringByAppendingPathComponent: PACKAGE_REL_UNZIP_FOLDER];
4340
4441 [self createUnzipFolder ];
@@ -48,14 +45,9 @@ - (void)setUp
4845 os: @" iOS"
4946 remoteURL: [NSURL URLWithString: @" http://foo.fake/Foo-iOS-phonehd.zip" ]];
5047
51- self.installData = [[CCPackageInstallData alloc ] initWithPackage: _package];
52- [_package setInstallData: _installData];
53-
5448 NSString *pathToZip = [[NSBundle mainBundle ] pathForResource: @" Resources-shared/Packages/testpackage-iOS-phonehd" ofType: @" zip" ];
55- _installData.localDownloadURL = [NSURL fileURLWithPath: pathToZip];
56- _installData.unzipURL = [NSURL fileURLWithPath: [_unzipFolderPath stringByAppendingPathComponent: [_package standardIdentifier ]]];
57-
58- NSLog (@" %@ " , _installData.unzipURL .path );
49+ _package.localDownloadURL = [NSURL fileURLWithPath: pathToZip];
50+ _package.unzipURL = [NSURL fileURLWithPath: [_unzipFolderPath stringByAppendingPathComponent: [_package standardIdentifier ]]];
5951}
6052
6153- (void )createUnzipFolder
@@ -92,7 +84,7 @@ - (void)testUnzipping
9284 [self unzipUntilDelegateMethodsReturn: nil ];
9385
9486 NSFileManager *fileManager = [NSFileManager defaultManager ];
95- NSArray *contents = [fileManager contentsOfDirectoryAtURL: [_installData .unzipURL URLByAppendingPathComponent: @" testpackage-iOS-phonehd" ]
87+ NSArray *contents = [fileManager contentsOfDirectoryAtURL: [_package .unzipURL URLByAppendingPathComponent: @" testpackage-iOS-phonehd" ]
9688 includingPropertiesForKeys: @[NSURLNameKey , NSURLIsDirectoryKey ]
9789 options: NSDirectoryEnumerationSkipsSubdirectoryDescendants
9890 error: nil ];
@@ -103,7 +95,7 @@ - (void)testUnzipping
10395
10496- (void )testUnzippingOfNonExistingArchive
10597{
106- _installData .localDownloadURL = [NSURL fileURLWithPath: @" /foo.zip" ];
98+ _package .localDownloadURL = [NSURL fileURLWithPath: @" /foo.zip" ];
10799
108100 [self unzipUntilDelegateMethodsReturn: nil ];
109101
@@ -126,11 +118,11 @@ - (void)testUnzippingOfInaccessibleUnzipFolder
126118- (void )testUnzipOfPasswordProtectedPackage
127119{
128120 NSString *pathToZip = [[NSBundle mainBundle ] pathForResource: @" Resources-shared/Packages/password-iOS-phone" ofType: @" zip" ];
129- _installData .localDownloadURL = [NSURL fileURLWithPath: pathToZip];
121+ _package .localDownloadURL = [NSURL fileURLWithPath: pathToZip];
130122
131123 [self unzipUntilDelegateMethodsReturn: @" foobar" ];
132124
133- NSString *secretFilePath = [_installData .unzipURL.path stringByAppendingPathComponent: @" password-iOS-phone/secret.txt" ];
125+ NSString *secretFilePath = [_package .unzipURL.path stringByAppendingPathComponent: @" password-iOS-phone/secret.txt" ];
134126 NSError *error;
135127 NSString *contentsOfSecretFile = [NSString stringWithContentsOfFile: secretFilePath encoding: NSUTF8StringEncoding error: &error];
136128 XCTAssertNil (error);
0 commit comments