Skip to content

Commit a549d6b

Browse files
committed
Add transcript tests for org restrictions
1 parent 6386b43 commit a549d6b

8 files changed

+123
-2
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"body": [
3+
{
4+
"createdAt": "<TIMESTAMP>",
5+
"isFaved": false,
6+
"numFavs": 0,
7+
"owner": {
8+
"handle": "@acme",
9+
"name": "ACME",
10+
"type": "organization"
11+
},
12+
"slug": "proj",
13+
"summary": null,
14+
"tags": [],
15+
"updatedAt": "<TIMESTAMP>",
16+
"visibility": "private"
17+
}
18+
],
19+
"status": [
20+
{
21+
"status_code": 200
22+
}
23+
]
24+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Create new projects in both the `@acme` and `@noncom` organizations.
2+
3+
```ucm
4+
scratch/main> push @acme/proj
5+
scratch/main> push @noncom/proj
6+
```
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Create new projects in both the `@acme` and `@noncom` organizations.
2+
3+
``` ucm
4+
scratch/main> push @acme/proj
5+
6+
Uploaded 1 entities.
7+
8+
I just created @acme/proj on http://localhost:5424
9+
10+
View it here: @acme/proj/main on http://localhost:5424
11+
12+
scratch/main> push @noncom/proj
13+
14+
Uploaded 1 entities.
15+
16+
I just created @noncom/proj on http://localhost:5424
17+
18+
View it here: @noncom/proj/main on http://localhost:5424
19+
```
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"body": "Please upgrade to a commercial org to enable private projects.",
3+
"status": [
4+
{
5+
"status_code": 403
6+
}
7+
]
8+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"body": [
3+
{
4+
"createdAt": "<TIMESTAMP>",
5+
"isFaved": false,
6+
"numFavs": 0,
7+
"owner": {
8+
"handle": "@noncom",
9+
"name": "Noncom",
10+
"type": "organization"
11+
},
12+
"slug": "proj",
13+
"summary": null,
14+
"tags": [],
15+
"updatedAt": "<TIMESTAMP>",
16+
"visibility": "public"
17+
}
18+
],
19+
"status": [
20+
{
21+
"status_code": 200
22+
}
23+
]
24+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"body": {
3+
"isCommercial": false,
4+
"orgId": "ORG-<UUID>",
5+
"user": {
6+
"avatarUrl": "https://example.com/peace.png",
7+
"handle": "noncom",
8+
"name": "Noncom",
9+
"userId": "U-<UUID>"
10+
}
11+
},
12+
"status": [
13+
{
14+
"status_code": 200
15+
}
16+
]
17+
}

transcripts/share-apis/orgs/run.zsh

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,19 @@ fetch "$unauthorized_user" POST org-create-unauthorized '/orgs' '{
1616
"avatarUrl": "https://example.com/anvil.png",
1717
"owner": "unauthorized",
1818
"email": "[email protected]",
19-
"isCommercial": false
19+
"isCommercial": true
2020
}'
2121

2222
# Admin can create an org and assign any owner.
23-
fetch "$admin_user" POST org-create-by-admin '/orgs' '{
23+
fetch "$admin_user" POST org-create-by-admin-non-commercial '/orgs' '{
24+
"name": "Noncom",
25+
"handle": "noncom",
26+
"avatarUrl": "https://example.com/peace.png",
27+
"owner": "transcripts",
28+
"isCommercial": false
29+
}'
30+
31+
fetch "$admin_user" POST org-create-by-admin-commercial '/orgs' '{
2432
"name": "ACME",
2533
"handle": "acme",
2634
"avatarUrl": "https://example.com/anvil.png",
@@ -74,3 +82,18 @@ fetch "$transcripts_user" DELETE org-remove-members '/orgs/acme/members' '{
7482
}'
7583

7684
fetch "$transcripts_user" GET org-get-members-after-removing '/orgs/acme/members'
85+
86+
# Create projects in each org.
87+
transcript_ucm transcript create-org-projects.md
88+
89+
# Get projects for each org
90+
# Commercial projects should be private by default
91+
fetch "$transcripts_user" GET commercial-org-projects '/users/acme/projects'
92+
93+
# Non-commercial projects must be public by default
94+
fetch "$transcripts_user" GET non-commercial-org-projects '/users/noncom/projects'
95+
96+
# Updating a non-commercial org's project to private should fail
97+
fetch "$transcripts_user" PATCH non-com-project-privatization '/users/noncom/projects/proj' '{
98+
"visibility": "private"
99+
}'

0 commit comments

Comments
 (0)