Skip to content

Commit af04429

Browse files
committed
Move tests to local
1 parent d2a862f commit af04429

File tree

5 files changed

+32
-38
lines changed

5 files changed

+32
-38
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,7 @@ dmypy.json
136136

137137
# Poetry local config
138138
poetry.toml
139+
140+
# MacOS annoyance
141+
.DS_Store
142+
**/.DS_Store

infra/docker-compose.yaml

+20-17
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
1-
version: "3"
1+
# docker-compose.yml
2+
version: '3'
23
services:
3-
server:
4-
image: postgrest/postgrest
4+
rest:
5+
image: postgrest/postgrest:v11.2.2
56
ports:
6-
- "3000:3000"
7+
- '3000:3000'
78
environment:
8-
PGRST_DB_URI: postgres://app_user:password@db:5432/app_db
9-
PGRST_DB_SCHEMA: public
10-
PGRST_DB_ANON_ROLE: app_user # In production this role should not be the same as the one used for connection
11-
PGRST_OPENAPI_SERVER_PROXY_URI: "http://127.0.0.1:3000"
9+
PGRST_DB_URI: postgres://postgres:postgres@infra-db:5432/postgres
10+
PGRST_DB_SCHEMAS: public,personal
11+
PGRST_DB_EXTRA_SEARCH_PATH: extensions
12+
PGRST_DB_ANON_ROLE: postgres
13+
PGRST_DB_PLAN_ENABLED: 1
14+
PGRST_DB_TX_END: commit-allow-override
1215
depends_on:
1316
- db
1417
db:
15-
image: postgres
18+
image: supabase/postgres:15.1.0.37
1619
ports:
17-
- "5432:5432"
18-
environment:
19-
POSTGRES_DB: app_db
20-
POSTGRES_USER: app_user
21-
POSTGRES_PASSWORD: password
22-
# Uncomment this if you want to persist the data. Create your boostrap SQL file in the project root
20+
- '5432:5432'
2321
volumes:
24-
# - "./pgdata:/var/lib/postgresql/data"
25-
- "./init.sql:/docker-entrypoint-initdb.d/init.sql"
22+
- .:/docker-entrypoint-initdb.d/
23+
environment:
24+
POSTGRES_DB: postgres
25+
POSTGRES_USER: postgres
26+
POSTGRES_PASSWORD: postgres
27+
POSTGRES_HOST: /var/run/postgresql
28+
POSTGRES_PORT: 5432

infra/init.sql

-3
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,3 @@ create or replace function public.list_stored_countries()
7676
as $function$
7777
select * from countries;
7878
$function$;
79-
80-
alter role authenticator set pgrst.db_plan_enabled to true;
81-
notify pgrst, 'reload config';

tests/_async/client.py

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
from postgrest import AsyncPostgrestClient
22

3-
REST_URL = "https://kzwoknoxuuvryajohvij.supabase.co/rest/v1/"
4-
headers = {}
5-
headers[
6-
"apikey"
7-
] = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imt6d29rbm94dXV2cnlham9odmlqIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MDgxOTAxNzgsImV4cCI6MjAyMzc2NjE3OH0.Nz3iqSWRryPmvLpCTb-6tyMe5X4I8NATQmy9xfr13l0"
8-
headers[
9-
"Authorization"
10-
] = "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imt6d29rbm94dXV2cnlham9odmlqIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MDgxOTAxNzgsImV4cCI6MjAyMzc2NjE3OH0.Nz3iqSWRryPmvLpCTb-6tyMe5X4I8NATQmy9xfr13l0"
3+
REST_URL = "http://127.0.0.1:3000"
114

125

136
def rest_client():
14-
return AsyncPostgrestClient(base_url=REST_URL, headers=headers)
7+
return AsyncPostgrestClient(
8+
base_url=REST_URL,
9+
)

tests/_sync/client.py

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
from postgrest import SyncPostgrestClient
22

3-
REST_URL = "https://kzwoknoxuuvryajohvij.supabase.co/rest/v1/"
4-
headers = {}
5-
headers[
6-
"apikey"
7-
] = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imt6d29rbm94dXV2cnlham9odmlqIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MDgxOTAxNzgsImV4cCI6MjAyMzc2NjE3OH0.Nz3iqSWRryPmvLpCTb-6tyMe5X4I8NATQmy9xfr13l0"
8-
headers[
9-
"Authorization"
10-
] = "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imt6d29rbm94dXV2cnlham9odmlqIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MDgxOTAxNzgsImV4cCI6MjAyMzc2NjE3OH0.Nz3iqSWRryPmvLpCTb-6tyMe5X4I8NATQmy9xfr13l0"
3+
REST_URL = "http://127.0.0.1:3000"
114

125

136
def rest_client():
14-
return SyncPostgrestClient(base_url=REST_URL, headers=headers)
7+
return SyncPostgrestClient(
8+
base_url=REST_URL,
9+
)

0 commit comments

Comments
 (0)