also fix broken text env After the last couple of commits the tests ran correctly only on a fresh db, in addition, the roles within the db were not created/dropped on each request and we need that since their privileges differ and we need to to have an absolute clean db on each execution
This commit is contained in:
Vendored
+3
-3
@@ -1,3 +1,3 @@
|
||||
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
||||
|
||||
ALTER DATABASE :db SET request.jwt.claim.id = '-1';
|
||||
set client_min_messages to warning;
|
||||
DROP SCHEMA IF EXISTS test, private, postgrest, jwt, تست CASCADE;
|
||||
DROP TYPE IF EXISTS jwt_token CASCADE;
|
||||
Vendored
+1
@@ -1,5 +1,6 @@
|
||||
-- From michelp/pgjwt commit c02bbd3
|
||||
BEGIN;
|
||||
set client_min_messages to warning;
|
||||
DROP SCHEMA IF EXISTS jwt CASCADE;
|
||||
CREATE SCHEMA jwt;
|
||||
|
||||
|
||||
Vendored
+3
-4
@@ -58,7 +58,6 @@ TO postgrest_test_anonymous;
|
||||
GRANT USAGE ON SCHEMA test TO postgrest_test_author;
|
||||
GRANT ALL ON TABLE authors_only TO postgrest_test_author;
|
||||
|
||||
GRANT USAGE ON SCHEMA postgrest,private,test to :test_user_name;
|
||||
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA postgrest,private,test TO :test_user_name;
|
||||
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA postgrest,private,test TO :test_user_name;
|
||||
|
||||
GRANT SELECT (article_id, user_id) ON TABLE limited_article_stars TO postgrest_test_anonymous;
|
||||
GRANT INSERT (article_id, user_id) ON TABLE limited_article_stars TO postgrest_test_anonymous;
|
||||
GRANT UPDATE (article_id, user_id) ON TABLE limited_article_stars TO postgrest_test_anonymous;
|
||||
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
\set AUTHENTICATOR current_user
|
||||
DROP ROLE IF EXISTS postgrest_test_anonymous, postgrest_test_default_role, postgrest_test_author;
|
||||
CREATE ROLE postgrest_test_anonymous;
|
||||
CREATE ROLE postgrest_test_default_role;
|
||||
CREATE ROLE postgrest_test_author;
|
||||
|
||||
GRANT postgrest_test_anonymous, postgrest_test_default_role, postgrest_test_author TO :USER;
|
||||
Vendored
+4
@@ -382,6 +382,10 @@ CREATE TABLE articles (
|
||||
|
||||
SET search_path = test, pg_catalog;
|
||||
|
||||
CREATE VIEW limited_article_stars AS
|
||||
SELECT article_id, user_id, created_at FROM private.article_stars;
|
||||
|
||||
|
||||
--
|
||||
-- Name: articleStars; Type: VIEW; Schema: test; Owner: -
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user