public function post_fails_without_permissions_test() { access::deny(identity::everybody(), "edit", item::root()); identity::set_active_user(identity::guest()); try { $request->params->name = "test tag"; tags_rest::post($request); } catch (Exception $e) { $this->assert_equal(403, $e->getCode()); return; } $this->assert_true(false, "Shouldnt get here"); }
public function post_fails_without_permissions_test() { // We have to remove edit permissions from everywhere Database::instance()->query("UPDATE {access_caches} SET edit_1=0"); identity::set_active_user(identity::guest()); try { $request = new stdClass(); $request->params = new stdClass(); $request->params->name = "test tag"; tags_rest::post($request); } catch (Exception $e) { $this->assert_equal(403, $e->getCode()); return; } $this->assert_true(false, "Shouldnt get here"); }