コード例 #1
0
 public function testUploadFailbadSig()
 {
     $localfile = FileUtils::join(NIMBLE_ROOT, 'test', 'data', 'joes_other_package-1.0.4.tgz');
     $sig = PackageVerifyTest::calculatePackageSignature($localfile);
     $user = User::find_by_username('joe');
     try {
         $p = Package::from_upload(array('file' => $localfile, 'sig' => $sig, 'user' => $user), true);
     } catch (NimbleException $e) {
         $this->assertEquals("Invalid package signature", $e->getMessage());
     }
 }
コード例 #2
0
 public function testUploadFromXMLFailedBadSig()
 {
     require_once __DIR__ . '/../unit/PackageVerifyTest.php';
     $localfile = FileUtils::join(NIMBLE_ROOT, 'test', 'data', 'bobs_other_package-1.0.4.tgz');
     $sig = md5(PackageVerifyTest::calculatePackageSignature($localfile));
     $_FILES = array();
     $_FILES['file'] = array();
     $_FILES['file']['tmp_name'] = $localfile;
     $key = md5(time());
     $this->post('upload', array(), array('signatureBase64' => $sig), array(), 'xml');
     $this->responseIncludes('Invalid package signature');
     $this->assertResponse('error');
 }