hlathery / Virtual-Ecosystem

0 stars 0 forks source link

Test results (Katie Slobodsky) #18

Open katieslobodsky opened 6 days ago

katieslobodsky commented 6 days ago

Test Results

Reset (POST)

Request

curl -X 'POST' \
  'https://testinghosting-yyoz.onrender.com/admin/reset' \
  -H 'accept: application/json' \
  -H 'access_token: hlath' \
  -d ''

Response

Internal Server Error

Post Time (GET)

Request

curl -X 'GET' \
  'https://testinghosting-yyoz.onrender.com/info/current_time' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "year": 2024,
  "month": 11,
  "day": 11
}'

Response

Successful Response

Get Village Overview (GET)

Request

curl -X 'GET' \
  'https://testinghosting-yyoz.onrender.com/village/' \
  -H 'accept: application/json' \
  -H 'access_token: hlath'

Response

{
  "buildings": [
    "Mine",
    "Town Hall",
    "Villager Hut",
    "Hunter/Forager Hut",
    "Farm",
    "Lumber Mill"
  ],
  "num_buildings": [
    0,
    4,
    3,
    6,
    5,
    1
  ],
  "num_villager": 0
}

Catalog (GET)

Request

curl -X 'GET' \
  'https://testinghosting-yyoz.onrender.com/village/catalog' \
  -H 'accept: application/json' \
  -H 'access_token: hlath'

Response

{
  "buildings": [
    "Villager Hut",
    "Hunter/Forager Hut",
    "Farm",
    "Lumber Mill",
    "Mine"
  ],
  "costs": [
    30,
    35,
    40,
    25,
    25
  ],
  "funds": 45
}

Create Villager (PUT)

Request

{
  "buildings": [
    "Villager Hut",
    "Hunter/Forager Hut",
    "Farm",
    "Lumber Mill",
    "Mine"
  ],
  "costs": [
    30,
    35,
    40,
    25,
    25
  ],
  "funds": 45
}

Response

[
  "Villager(s) successfully created"
]

Kill Villager (POST)

Request

curl -X 'POST' \
  'https://testinghosting-yyoz.onrender.com/village/kill_villager?amount=3' \
  -H 'accept: application/json' \
  -H 'access_token: hlath' \
  -d ''

Response

"OK"

Build Structure (POST)

Request

curl -X 'POST' \
  'https://testinghosting-yyoz.onrender.com/village/build_building' \
  -H 'accept: application/json' \
  -H 'access_token: hlath' \
  -H 'Content-Type: application/json' \
  -d '[
  {
    "quantity": 5,
    "building_name": "string"
  }
]'

Response

"OK"

Adjust Storage (PUT)

Request

curl -X 'PUT' \
  'https://testinghosting-yyoz.onrender.com/village/fill_inventory' \
  -H 'accept: application/json' \
  -H 'access_token: hlath' \
  -H 'Content-Type: application/json' \
  -d '[
  {
    "resource_name": "wood",
    "amount": 10
  }
]'

Response

[
  "Success"
]

View Village Inventory (GET)

Request

curl -X 'GET' \
  'https://testinghosting-yyoz.onrender.com/village/village_inventory' \
  -H 'accept: application/json' \
  -H 'access_token: hlath'

Response

[
  {
    "resource_name": "wood",
    "quantity": 55
  },
  {
    "resource_name": "food",
    "quantity": 50
  },
  {
    "resource_name": "water",
    "quantity": 100
  }
]

Post Biome Counts (POST)

Request

curl -X 'POST' \
  'https://testinghosting-yyoz.onrender.com/eco/biomes/' \
  -H 'accept: application/json' \
  -H 'access_token: hlath' \
  -H 'Content-Type: application/json' \
  -d '{
  "additionalProp1": 1,
  "additionalProp2": 2,
  "additionalProp3": 3
}'

Response

null

Grow Plants (PUT)

Request

curl -X 'PUT' \
  'https://testinghosting-yyoz.onrender.com/eco/grow_plants' \
  -H 'accept: application/json' \
  -H 'access_token: hlath' \
  -H 'Content-Type: application/json' \
  -d '[
  {
    "quantity": 5,
    "nourishment": 8,
    "entity_type": "string",
    "biome_id": 12
  }
]'

Response

OK

Plants Overview (GET)

Request

curl -X 'GET' \
  'https://testinghosting-yyoz.onrender.com/eco/plants/' \
  -H 'accept: application/json' \
  -H 'access_token: hlath'

Response

[
  {
    "entity_type": "plants",
    "quantity": 250
  }
]

Prey Overview (GET)

Request

curl -X 'GET' \
  'https://testinghosting-yyoz.onrender.com/eco/prey/' \
  -H 'accept: application/json' \
  -H 'access_token: hlath'

Response

[
  {
    "entity_type": "prey",
    "quantity": 59
  }
]

Spawn Prey (POST)

Request

curl -X 'POST' \
  'https://testinghosting-yyoz.onrender.com/eco/spawn_prey' \
  -H 'accept: application/json' \
  -H 'access_token: hlath' \
  -H 'Content-Type: application/json' \
  -d '[
  {
    "quantity": 10,
    "nourishment": 5,
    "entity_type": "string",
    "biome_id": 15
  }
]'

Response

"OK"

Biome Prey (GET)

Request

curl -X 'GET' \
  'https://testinghosting-yyoz.onrender.com/eco/prey/55' \
  -H 'accept: application/json' \
  -H 'access_token: hlath'

Response

Internal Server Error

Spawn Predator (POST)

Request

curl -X 'POST' \
  'https://testinghosting-yyoz.onrender.com/eco/spawn_predator/' \
  -H 'accept: application/json' \
  -H 'access_token: hlath' \
  -H 'Content-Type: application/json' \
  -d '[
  {
    "quantity": 5,
    "nourishment": 7,
    "entity_type": "string",
    "biome_id": 8
  }
]'

Response

"OK"

Biome Predator (GET)

Request

curl -X 'GET' \
  'https://testinghosting-yyoz.onrender.com/eco/predator/7' \
  -H 'accept: application/json' \
  -H 'access_token: hlath'

Response

Internal Server Error

Get Job List (GET)

Request

curl -X 'GET' \
  'https://testinghosting-yyoz.onrender.com/assignments/get_job_list' \
  -H 'accept: application/json' \
  -H 'access_token: hlath'

Response

[
  {
    "job_id": 2,
    "job_title": "forager",
    "villagers_assigned": 0
  },
  {
    "job_id": 3,
    "job_title": "farmer",
    "villagers_assigned": 0
  },
  {
    "job_id": 5,
    "job_title": "lumberjack",
    "villagers_assigned": 0
  },
  {
    "job_id": 4,
    "job_title": "butcher",
    "villagers_assigned": 0
  },
  {
    "job_id": 6,
    "job_title": "miner",
    "villagers_assigned": 0
  },
  {
    "job_id": 0,
    "job_title": "unassigned",
    "villagers_assigned": 0
  },
  {
    "job_id": 1,
    "job_title": "hunter",
    "villagers_assigned": 0
  }
]

Assign Villager (PUT)

Request

curl -X 'PUT' \
  'https://testinghosting-yyoz.onrender.com/assignments/assign_villager' \
  -H 'accept: application/json' \
  -H 'access_token: hlath' \
  -H 'Content-Type: application/json' \
  -d '[
  {
    "job_id": 7,
    "job_title": "hunter",
    "villagers_assigned": 5
  }
]'

Response

"OK"

Additional Test Cases

Test Case 1: Attempting to Kill a Negative Amount of Villagers - Kill Villager (POST)

Request

curl -X 'POST' \
  'https://testinghosting-yyoz.onrender.com/village/kill_villager?amount=-10000' \
  -H 'accept: application/json' \
  -H 'access_token: hlath' \
  -d ''

Response

"OK"

Test Case 2: Attempting to grow plants without an entity_type - Grow Plants (PUT)

Request

curl -X 'PUT' \
  'https://testinghosting-yyoz.onrender.com/eco/grow_plants' \
  -H 'accept: application/json' \
  -H 'access_token: hlath' \
  -H 'Content-Type: application/json' \
  -d '[
  {
    "quantity": 10,
    "nourishment": 5,
    "biome_id": 222
  }
]'

Response

{
  "message": [
    "['body', 0, 'entity_type']: field required"
  ],
  "data": null
}

Test Case 3: Attempting to assign a villager as a farmer - Assign Villager (PUT)

Request

curl -X 'PUT' \
  'https://testinghosting-yyoz.onrender.com/assignments/assign_villager' \
  -H 'accept: application/json' \
  -H 'access_token: hlath' \
  -H 'Content-Type: application/json' \
  -d '[
  {
    "job_id": 12,
    "job_title": "farmer",
    "villagers_assigned": 1
  }
]'

Response

"OK"

Test Case 4: Attempting to access all villagers assigned as farmers - Get Job List (GET)

Request

curl -X 'GET' \
  'https://testinghosting-yyoz.onrender.com/assignments/get_job_list' \
  -H 'accept: application/json' \
  -H 'access_token: hlath'

Response

[
  {
    "job_id": 2,
    "job_title": "forager",
    "villagers_assigned": 0
  },
  {
    "job_id": 3,
    "job_title": "farmer",
    "villagers_assigned": 0
  },
  {
    "job_id": 5,
    "job_title": "lumberjack",
    "villagers_assigned": 0
  },
  {
    "job_id": 4,
    "job_title": "butcher",
    "villagers_assigned": 0
  },
  {
    "job_id": 6,
    "job_title": "miner",
    "villagers_assigned": 0
  },
  {
    "job_id": 0,
    "job_title": "unassigned",
    "villagers_assigned": 0
  },
  {
    "job_id": 1,
    "job_title": "hunter",
    "villagers_assigned": 0
  }
]