9
9
#import < XCTest/XCTest.h>
10
10
#import " CCPackageUnzipper.h"
11
11
#import " CCPackage.h"
12
- #import " CCPackageInstallData.h"
13
- #import " CCPackage+InstallData.h"
14
12
#import " CCPackageConstants.h"
15
13
#import " CCPackageUnzipperDelegate.h"
16
14
#import " CCUnitTestAssertions.h"
15
+ #import " CCPackage_private.h"
17
16
18
17
@interface CCPackageUnzipperTests : XCTestCase <CCPackageUnzipperDelegate>
19
18
20
19
@property (nonatomic , strong ) CCPackage *package;
21
- @property (nonatomic , strong ) CCPackageInstallData *installData;
22
20
@property (nonatomic , copy ) NSString *unzipFolderPath;
23
21
@property (nonatomic , strong ) NSCondition *condition;
24
22
@property (nonatomic ) BOOL unzipperReturned;
@@ -38,7 +36,6 @@ - (void)setUp
38
36
self.unzipperReturned = NO ;
39
37
self.unzippingError = nil ;
40
38
self.unzippingSuccessful = NO ;
41
-
42
39
self.unzipFolderPath = [NSTemporaryDirectory () stringByAppendingPathComponent: PACKAGE_REL_UNZIP_FOLDER];
43
40
44
41
[self createUnzipFolder ];
@@ -48,14 +45,9 @@ - (void)setUp
48
45
os: @" iOS"
49
46
remoteURL: [NSURL URLWithString: @" http://foo.fake/Foo-iOS-phonehd.zip" ]];
50
47
51
- self.installData = [[CCPackageInstallData alloc ] initWithPackage: _package];
52
- [_package setInstallData: _installData];
53
-
54
48
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 ]]];
59
51
}
60
52
61
53
- (void )createUnzipFolder
@@ -92,7 +84,7 @@ - (void)testUnzipping
92
84
[self unzipUntilDelegateMethodsReturn: nil ];
93
85
94
86
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" ]
96
88
includingPropertiesForKeys: @[NSURLNameKey , NSURLIsDirectoryKey ]
97
89
options: NSDirectoryEnumerationSkipsSubdirectoryDescendants
98
90
error: nil ];
@@ -103,7 +95,7 @@ - (void)testUnzipping
103
95
104
96
- (void )testUnzippingOfNonExistingArchive
105
97
{
106
- _installData .localDownloadURL = [NSURL fileURLWithPath: @" /foo.zip" ];
98
+ _package .localDownloadURL = [NSURL fileURLWithPath: @" /foo.zip" ];
107
99
108
100
[self unzipUntilDelegateMethodsReturn: nil ];
109
101
@@ -126,11 +118,11 @@ - (void)testUnzippingOfInaccessibleUnzipFolder
126
118
- (void )testUnzipOfPasswordProtectedPackage
127
119
{
128
120
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];
130
122
131
123
[self unzipUntilDelegateMethodsReturn: @" foobar" ];
132
124
133
- NSString *secretFilePath = [_installData .unzipURL.path stringByAppendingPathComponent: @" password-iOS-phone/secret.txt" ];
125
+ NSString *secretFilePath = [_package .unzipURL.path stringByAppendingPathComponent: @" password-iOS-phone/secret.txt" ];
134
126
NSError *error;
135
127
NSString *contentsOfSecretFile = [NSString stringWithContentsOfFile: secretFilePath encoding: NSUTF8StringEncoding error: &error];
136
128
XCTAssertNil (error);
0 commit comments