diff options
author | Lukas Reschke <lukas@owncloud.com> | 2016-01-15 14:14:32 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2016-01-20 20:38:18 +0100 |
commit | ea367b598a98f8889383c917ceb7a6deb0c6ab7f (patch) | |
tree | 251f6f3f274081b51496379a6d5816f90bd011f5 /tests/lib/command | |
parent | 647d8ea5decad8140f9c280ae90039aa71c4eb93 (diff) | |
download | nextcloud-server-ea367b598a98f8889383c917ceb7a6deb0c6ab7f.tar.gz nextcloud-server-ea367b598a98f8889383c917ceb7a6deb0c6ab7f.zip |
Use path instead of app id
This change requires the usage of a path instead of the App ID when signing code. This has the advantage that developers can also sign code under a different location to make it easier. (e.g. remove `.git`, …)
Also it adds an example command usage as well as a link to the documentation
Diffstat (limited to 'tests/lib/command')
-rw-r--r-- | tests/lib/command/integrity/SignAppTest.php | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/tests/lib/command/integrity/SignAppTest.php b/tests/lib/command/integrity/SignAppTest.php index b7c34585c5c..44a644c45df 100644 --- a/tests/lib/command/integrity/SignAppTest.php +++ b/tests/lib/command/integrity/SignAppTest.php @@ -23,6 +23,7 @@ namespace Test\Command\Integrity; use OC\Core\Command\Integrity\SignApp; use OC\IntegrityCheck\Checker; use OC\IntegrityCheck\Helpers\FileAccessHelper; +use OCP\IURLGenerator; use Test\TestCase; class SignAppTest extends TestCase { @@ -32,6 +33,8 @@ class SignAppTest extends TestCase { private $signApp; /** @var FileAccessHelper */ private $fileAccessHelper; + /** @var IURLGenerator */ + private $urlGenerator; public function setUp() { parent::setUp(); @@ -39,20 +42,23 @@ class SignAppTest extends TestCase { ->disableOriginalConstructor()->getMock(); $this->fileAccessHelper = $this->getMockBuilder('\OC\IntegrityCheck\Helpers\FileAccessHelper') ->disableOriginalConstructor()->getMock(); + $this->urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator') + ->disableOriginalConstructor()->getMock(); $this->signApp = new SignApp( $this->checker, - $this->fileAccessHelper + $this->fileAccessHelper, + $this->urlGenerator ); } - public function testExecuteWithMissingAppId() { + public function testExecuteWithMissingPath() { $inputInterface = $this->getMock('\Symfony\Component\Console\Input\InputInterface'); $outputInterface = $this->getMock('\Symfony\Component\Console\Output\OutputInterface'); $inputInterface ->expects($this->at(0)) ->method('getOption') - ->with('appId') + ->with('path') ->will($this->returnValue(null)); $inputInterface ->expects($this->at(1)) @@ -68,7 +74,7 @@ class SignAppTest extends TestCase { $outputInterface ->expects($this->at(0)) ->method('writeln') - ->with('--appId, --privateKey and --certificate are required.'); + ->with('This command requires the --path, --privateKey and --certificate.'); $this->invokePrivate($this->signApp, 'execute', [$inputInterface, $outputInterface]); } @@ -80,7 +86,7 @@ class SignAppTest extends TestCase { $inputInterface ->expects($this->at(0)) ->method('getOption') - ->with('appId') + ->with('path') ->will($this->returnValue('AppId')); $inputInterface ->expects($this->at(1)) @@ -94,9 +100,9 @@ class SignAppTest extends TestCase { ->will($this->returnValue('Certificate')); $outputInterface - ->expects($this->at(0)) - ->method('writeln') - ->with('--appId, --privateKey and --certificate are required.'); + ->expects($this->at(0)) + ->method('writeln') + ->with('This command requires the --path, --privateKey and --certificate.'); $this->invokePrivate($this->signApp, 'execute', [$inputInterface, $outputInterface]); } @@ -108,7 +114,7 @@ class SignAppTest extends TestCase { $inputInterface ->expects($this->at(0)) ->method('getOption') - ->with('appId') + ->with('path') ->will($this->returnValue('AppId')); $inputInterface ->expects($this->at(1)) @@ -124,7 +130,7 @@ class SignAppTest extends TestCase { $outputInterface ->expects($this->at(0)) ->method('writeln') - ->with('--appId, --privateKey and --certificate are required.'); + ->with('This command requires the --path, --privateKey and --certificate.'); $this->invokePrivate($this->signApp, 'execute', [$inputInterface, $outputInterface]); } @@ -136,7 +142,7 @@ class SignAppTest extends TestCase { $inputInterface ->expects($this->at(0)) ->method('getOption') - ->with('appId') + ->with('path') ->will($this->returnValue('AppId')); $inputInterface ->expects($this->at(1)) @@ -170,7 +176,7 @@ class SignAppTest extends TestCase { $inputInterface ->expects($this->at(0)) ->method('getOption') - ->with('appId') + ->with('path') ->will($this->returnValue('AppId')); $inputInterface ->expects($this->at(1)) @@ -209,7 +215,7 @@ class SignAppTest extends TestCase { $inputInterface ->expects($this->at(0)) ->method('getOption') - ->with('appId') + ->with('path') ->will($this->returnValue('AppId')); $inputInterface ->expects($this->at(1)) |