@@ -65,4 +65,83 @@ - (void)testUpUnAuth {
6565 XCTAssert (testInfo.reqId , @" Pass" );
6666}
6767
68+ - (void )testNoData {
69+ __block QNResponseInfo *testInfo = nil ;
70+ __block NSDictionary *testResp = nil ;
71+ NSString *token = @" noauth" ;
72+ [self .upManager putData: nil key: @" hello" token: token complete: ^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {
73+ testInfo = info;
74+ testResp = resp;
75+ } option: nil ];
76+
77+ AGWW_WAIT_WHILE (testInfo == nil , 100.0 );
78+ NSLog (@" %@ " , testInfo);
79+ XCTAssert (testInfo.statusCode == kQNInvalidArgument , @" Pass" );
80+ }
81+
82+ - (void )testNoFile {
83+ __block QNResponseInfo *testInfo = nil ;
84+ __block NSDictionary *testResp = nil ;
85+ NSString *token = @" noauth" ;
86+ [self .upManager putFile: nil key: @" hello" token: token complete: ^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {
87+ testInfo = info;
88+ testResp = resp;
89+ } option: nil ];
90+
91+ AGWW_WAIT_WHILE (testInfo == nil , 100.0 );
92+ NSLog (@" %@ " , testInfo);
93+ XCTAssert (testInfo.statusCode == kQNInvalidArgument , @" Pass" );
94+ }
95+
96+
97+ - (void )testNoToken {
98+ __block QNResponseInfo *testInfo = nil ;
99+ __block NSDictionary *testResp = nil ;
100+ NSData *data = [@" Hello, World!" dataUsingEncoding : NSUTF8StringEncoding];
101+ [self .upManager putData: data key: @" hello" token: nil complete: ^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {
102+ testInfo = info;
103+ testResp = resp;
104+ } option: nil ];
105+
106+ AGWW_WAIT_WHILE (testInfo == nil , 100.0 );
107+ NSLog (@" %@ " , testInfo);
108+ XCTAssert (testInfo.statusCode == kQNInvalidArgument , @" Pass" );
109+
110+ testInfo = nil ;
111+ testResp = nil ;
112+ [self .upManager putData: data key: @" hello" token: @" " complete: ^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {
113+ testInfo = info;
114+ testResp = resp;
115+ } option: nil ];
116+
117+ AGWW_WAIT_WHILE (testInfo == nil , 100.0 );
118+ NSLog (@" %@ " , testInfo);
119+ XCTAssert (testInfo.statusCode == kQNInvalidArgument , @" Pass" );
120+
121+ testInfo = nil ;
122+ testResp = nil ;
123+ [self .upManager putData: nil key: @" hello" token: nil complete: ^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {
124+ testInfo = info;
125+ testResp = resp;
126+ } option: nil ];
127+
128+ AGWW_WAIT_WHILE (testInfo == nil , 100.0 );
129+ NSLog (@" %@ " , testInfo);
130+ XCTAssert (testInfo.statusCode == kQNInvalidArgument , @" Pass" );
131+ }
132+
133+ - (void )testNoComplete {
134+ NSException *e;
135+ @try {
136+ [self .upManager putFile: nil key: nil token: nil complete: nil option: nil ]; }
137+ @catch (NSException *exception) {
138+ e = exception;
139+ }
140+
141+ XCTAssert (e != nil , @" Pass" );
142+ XCTAssert ([e.name isEqualToString: NSInvalidArgumentException ], @" Pass" );
143+ }
144+
145+
146+
68147@end
0 commit comments