-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ANKUR DWIVEDI
authored and
ANKUR DWIVEDI
committed
Jul 26, 2024
1 parent
4f2194f
commit 3e84921
Showing
4 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,7 @@ class ErrorMessages | |
public static $UPLOAD_FILE_PARAMETER_OPTIONS_INVALID_TRANSFORMATION = [ "message" => "Invalid transformation parameter. Please include at least pre, post, or both.", "help" => "For support kindly contact us at [email protected] ."]; | ||
public static $UPLOAD_FILE_PARAMETER_OPTIONS_INVALID_PRE_TRANSFORMATION = [ "message" => "Invalid pre transformation parameter.", "help" => "For support kindly contact us at [email protected] ."]; | ||
public static $UPLOAD_FILE_PARAMETER_OPTIONS_INVALID_POST_TRANSFORMATION = [ "message" => "Invalid post transformation parameter.", "help" => "For support kindly contact us at [email protected] ."]; | ||
public static $UPLOAD_FILE_PARAMETER_OPTIONS_INVALID_CHECKS = [ "message" => "The value provided for the checks parameter is invalid.", "help" => "For support kindly contact us at [email protected] ."]; | ||
public static $MISSING_UPLOAD_DATA = ['message' => 'Missing data for upload', 'help' => 'For support kindly contact us at [email protected] .']; | ||
public static $MISSING_UPLOAD_FILE_PARAMETER = ['message' => 'Missing file parameter for upload', 'help' => 'For support kindly contact us at [email protected] .']; | ||
public static $MISSING_UPLOAD_FILENAME_PARAMETER = ['message' => 'Missing fileName parameter for upload', 'help' => 'For support kindly contact us at [email protected] .']; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -172,6 +172,7 @@ public function testFileUploadIfSuccessful() | |
] | ||
] | ||
], | ||
'checks' => "'request.folder' : '/sample-folder'" | ||
]; | ||
|
||
$mockBodyResponse = Utils::streamFor(json_encode($this->uploadSuccessResponseObj)); | ||
|
@@ -215,6 +216,7 @@ public function testFileUploadIfSuccessful() | |
$this->checkFormData($stream,$boundary,"overwriteCustomMetadata","true"); | ||
$this->checkFormData($stream,$boundary,"customMetadata",json_encode($fileOptions['customMetadata'])); | ||
$this->checkFormData($stream,$boundary,"transformation",json_encode($fileOptions['transformation'])); | ||
$this->checkFormData($stream,$boundary,"checks",$fileOptions['checks']); | ||
|
||
// Assert Method | ||
$requestMethod = $container[0]['request']->getMethod(); | ||
|
@@ -785,6 +787,32 @@ public function testFileUploadWithInvalidTransformationTypePostTransformation() | |
UploadTest::assertEquals(json_encode($error),json_encode($response->error)); | ||
} | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
public function testFileUploadWithInvalidChecks() | ||
{ | ||
$fileOptions = [ | ||
'file' => 'http://lorempixel.com/640/480/', | ||
'fileName' => 'test_file_name', | ||
"useUniqueFileName" => true, // true|false | ||
"responseFields" => implode(",", ["tags", "customMetadata"]), // Comma Separated, check docs for more responseFields | ||
'checks' => true | ||
]; | ||
|
||
$error = [ | ||
"message" => "The value provided for the checks parameter is invalid.", | ||
"help" => "For support kindly contact us at [email protected] ." | ||
]; | ||
|
||
$this->stubHttpClient(new Response(403, ['X-Foo' => 'Bar'], json_encode($error))); | ||
|
||
$response = $this->client->uploadFile($fileOptions); | ||
|
||
// Request Body Check | ||
UploadTest::assertEquals(json_encode($error),json_encode($response->error)); | ||
} | ||
|
||
protected function setUp() | ||
{ | ||
|