aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2017-05-28 14:53:04 +0200
committerThomas Citharel <tcit@tcit.fr>2017-05-28 14:53:04 +0200
commitd5fbb570c974fe8b6f64356772f7cd60b96419da (patch)
treec4cfdd0459473d28707b373b53ddee3cc32ac844 /tests/Wallabag
parent35941d57ee4d06ec3557d4b126d5f6fd263bcf3a (diff)
downloadwallabag-d5fbb570c974fe8b6f64356772f7cd60b96419da.tar.gz
wallabag-d5fbb570c974fe8b6f64356772f7cd60b96419da.tar.zst
wallabag-d5fbb570c974fe8b6f64356772f7cd60b96419da.zip
Hash the urls to check if they exist
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Diffstat (limited to 'tests/Wallabag')
-rw-r--r--tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
index bf7d373a..e3a44390 100644
--- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
@@ -686,7 +686,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
686 686
687 public function testGetEntriesExists() 687 public function testGetEntriesExists()
688 { 688 {
689 $this->client->request('GET', '/api/entries/exists?url=http://0.0.0.0/entry2'); 689 $this->client->request('GET', '/api/entries/exists?hashedurl=' . hash('sha512', 'http://0.0.0.0/entry2'));
690 690
691 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 691 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
692 692
@@ -699,21 +699,21 @@ class EntryRestControllerTest extends WallabagApiTestCase
699 { 699 {
700 $url1 = 'http://0.0.0.0/entry2'; 700 $url1 = 'http://0.0.0.0/entry2';
701 $url2 = 'http://0.0.0.0/entry10'; 701 $url2 = 'http://0.0.0.0/entry10';
702 $this->client->request('GET', '/api/entries/exists?urls[]='.$url1.'&urls[]='.$url2); 702 $this->client->request('GET', '/api/entries/exists?hashedurls[]='.hash('sha512',$url1).'&hashedurls[]='.hash('sha512',$url2));
703 703
704 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 704 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
705 705
706 $content = json_decode($this->client->getResponse()->getContent(), true); 706 $content = json_decode($this->client->getResponse()->getContent(), true);
707 707
708 $this->assertArrayHasKey($url1, $content); 708 $this->assertArrayHasKey(hash('sha512', $url1), $content);
709 $this->assertArrayHasKey($url2, $content); 709 $this->assertArrayHasKey(hash('sha512', $url2), $content);
710 $this->assertEquals(2, $content[$url1]); 710 $this->assertEquals(2, $content[hash('sha512', $url1)]);
711 $this->assertEquals(false, $content[$url2]); 711 $this->assertEquals(false, $content[hash('sha512', $url2)]);
712 } 712 }
713 713
714 public function testGetEntriesExistsWhichDoesNotExists() 714 public function testGetEntriesExistsWhichDoesNotExists()
715 { 715 {
716 $this->client->request('GET', '/api/entries/exists?url=http://google.com/entry2'); 716 $this->client->request('GET', '/api/entries/exists?hashedurl='.hash('sha512','http://google.com/entry2'));
717 717
718 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 718 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
719 719
@@ -724,7 +724,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
724 724
725 public function testGetEntriesExistsWithNoUrl() 725 public function testGetEntriesExistsWithNoUrl()
726 { 726 {
727 $this->client->request('GET', '/api/entries/exists?url='); 727 $this->client->request('GET', '/api/entries/exists?hashedurl=');
728 728
729 $this->assertEquals(403, $this->client->getResponse()->getStatusCode()); 729 $this->assertEquals(403, $this->client->getResponse()->getStatusCode());
730 } 730 }