Add Fleet Core and Fleet Basic user/team creation scripts for manual QA (#919)

- Add `teams/create_core` script
- Add `teams/create_basic` script
- Rename existing script to `teams/create_figma`
This commit is contained in:
noahtalerman
2021-06-01 14:50:07 -04:00
committed by GitHub
parent 9469cb0bf1
commit 2dca66c33d
4 changed files with 134 additions and 2 deletions
+16 -2
View File
@@ -244,10 +244,24 @@ Next, set the `FLEET_ENV_PATH` to point to the `env` file. This will let the scr
export FLEET_ENV_PATH=/Users/victor/fleet_env
```
Finally run the `teams/create` bash script located in the [/tools/api](../../tools/api/README.md) directory. This script will create 3 teams and 12 users with various roles.
Finally run one of the bash scripts located in the [/tools/api](../../tools/api/README.md) directory.
The `fleet/create_core` script will generate an environment to roughly reflect an installation of Fleet Core. The script creates 3 users with different roles.
```
./tools/api/fleet/teams/create
./tools/api/fleet/teams/create_core
```
The `fleet/create_basic` script will generate an environment to roughly reflect an installation of Fleet Basic. The script will create 2 teams 4 users with different roles.
```
./tools/api/fleet/teams/create_basic
```
The `fleet/create_figma` script will generate an environment to reflect the mockups in the Fleet EE (current) Figma file. The script creates 3 teams and 12 users with different roles.
```
./tools/api/fleet/teams/create_figma
```
Each user generated by the script has their password set to `user123#`.
+77
View File
@@ -0,0 +1,77 @@
#!/bin/bash
# This script creates 2 teams and 4 users with various roles.
source $FLEET_ENV_PATH
# Create teams
create_team_endpoint="api/v1/fleet/teams"
# Create Apples
data='{
"name": "Apples"
}'
curl -X POST $CURL_FLAGS -H "Authorization: Bearer $TOKEN" "$SERVER_URL/$create_team_endpoint" -d "$data" --insecure
# Create Oranges
data='{
"name": "Oranges"
}'
curl -X POST $CURL_FLAGS -H "Authorization: Bearer $TOKEN" "$SERVER_URL/$create_team_endpoint" -d "$data" --insecure
# Create users
create_user_endpoint="api/v1/fleet/users/admin"
# Create Anna
data='{
"name": "Anna",
"username": "Anna",
"email": "anna@organization.com",
"password": "user123#",
"invited_by": 1,
"global_role": "admin"
}'
curl -X POST $CURL_FLAGS -H "Authorization: Bearer $TOKEN" "$SERVER_URL/$create_user_endpoint" -d "$data" --insecure
# Create Mary
data='{
"name": "Mary",
"username": "Mary",
"email": "mary@organization.com",
"password": "user123#",
"invited_by": 1,
"global_role": "maintainer"
}'
curl -X POST $CURL_FLAGS -H "Authorization: Bearer $TOKEN" "$SERVER_URL/$create_user_endpoint" -d "$data" --insecure
# Create Oliver
data='{
"name": "Oliver",
"username": "Oliver",
"email": "oliver@organization.com",
"password": "user123#",
"invited_by": 1,
"global_role": "observer"
}'
curl -X POST $CURL_FLAGS -H "Authorization: Bearer $TOKEN" "$SERVER_URL/$create_user_endpoint" -d "$data" --insecure
# Create Marco
data='{
"name": "Marco",
"username": "Marco",
"email": "marco@organization.com",
"password": "user123#",
"invited_by": 1,
"global_role": null,
"teams": [
{
"id": 1,
"role": "observer"
},
{
"id": 2,
"role": "maintainer"
}
]
}'
curl -X POST $CURL_FLAGS -H "Authorization: Bearer $TOKEN" "$SERVER_URL/$create_user_endpoint" -d "$data" --insecure
+41
View File
@@ -0,0 +1,41 @@
#!/bin/bash
# This script creates 3 users with various roles.
source $FLEET_ENV_PATH
# Create users
create_user_endpoint="api/v1/fleet/users/admin"
# Create Anna
data='{
"name": "Anna",
"username": "Anna",
"email": "anna@organization.com",
"password": "user123#",
"invited_by": 1,
"global_role": "admin"
}'
curl -X POST $CURL_FLAGS -H "Authorization: Bearer $TOKEN" "$SERVER_URL/$create_user_endpoint" -d "$data" --insecure
# Create Mary
data='{
"name": "Mary",
"username": "Mary",
"email": "mary@organization.com",
"password": "user123#",
"invited_by": 1,
"global_role": "maintainer"
}'
curl -X POST $CURL_FLAGS -H "Authorization: Bearer $TOKEN" "$SERVER_URL/$create_user_endpoint" -d "$data" --insecure
# Create Oliver
data='{
"name": "Oliver",
"username": "Oliver",
"email": "oliver@organization.com",
"password": "user123#",
"invited_by": 1,
"global_role": "observer"
}'
curl -X POST $CURL_FLAGS -H "Authorization: Bearer $TOKEN" "$SERVER_URL/$create_user_endpoint" -d "$data" --insecure
View File