summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-11-01 15:49:14 +0100
committerFlorian Pritz <bluewind@xinu.at>2016-11-01 17:26:18 +0100
commitecb9a19cfaf627af4fc316a2125cd10d7e233150 (patch)
tree2d2c87fb15c7e3c557fe34b244ebe7ec9846ee3e
parentea36cc8c5f15d02c7846764cace736ada6969e59 (diff)
mmultipaste->delete_id: Fix inverted return value
Broken in d2fdfc77f7a9485548869414d4377cd6848fe339 Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r--application/models/mmultipaste.php2
-rw-r--r--application/test/tests/test_api_v2.php29
2 files changed, 30 insertions, 1 deletions
diff --git a/application/models/mmultipaste.php b/application/models/mmultipaste.php
index fc0889377..52ea4dfb4 100644
--- a/application/models/mmultipaste.php
+++ b/application/models/mmultipaste.php
@@ -125,7 +125,7 @@ class Mmultipaste extends CI_Model {
$f = new \service\storage($this->get_tarball_path($id));
$f->unlink();
- return $this->id_exists($id);
+ return !$this->id_exists($id);
}
public function get_owner($id)
diff --git a/application/test/tests/test_api_v2.php b/application/test/tests/test_api_v2.php
index 7335c3bdd..0e52de50b 100644
--- a/application/test/tests/test_api_v2.php
+++ b/application/test/tests/test_api_v2.php
@@ -494,4 +494,33 @@ class test_api_v2 extends \test\Test {
),
), $ret, "expected error response");
}
+
+ public function test_delete_canDeleteMultipaste()
+ {
+ $apikey = $this->createUserAndApikey();
+ $ret = $this->uploadFile($apikey, "data/tests/small-file");
+ $id = $ret["data"]["ids"][0];
+ $ret = $this->CallEndpoint("POST", "file/create_multipaste", array(
+ "apikey" => $apikey,
+ "ids[1]" => $id,
+ ));
+ $this->expectSuccess("create multipaste", $ret);
+
+ $mid = $ret['data']['url_id'];
+ $ret = $this->CallEndpoint("POST", "file/delete", array(
+ "apikey" => $apikey,
+ "ids[1]" => $mid,
+ ));
+ $this->expectSuccess("delete uploaded file", $ret);
+
+ $this->t->ok(empty($ret["data"]["errors"]), "no errors");
+ $this->t->is_deeply(array(
+ $mid => array(
+ "id" => $mid
+ )
+ ), $ret["data"]["deleted"], "deleted wanted ID");
+ $this->t->is($ret["data"]["total_count"], 1, "total_count correct");
+ $this->t->is($ret["data"]["deleted_count"], 1, "deleted_count correct");
+ }
+
}