aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2022-03-22 00:39:40 +0800
committerJesús <heckyel@hyperbola.info>2022-03-22 00:39:40 +0800
commit3fca03988b42adaf8e67cc7137dd1fdba327e197 (patch)
treead39a5bc12a03c82b9a4fd980c1b92ca0a1dac93 /test
downloadheroeapi-3fca03988b42adaf8e67cc7137dd1fdba327e197.tar.lz
heroeapi-3fca03988b42adaf8e67cc7137dd1fdba327e197.tar.xz
heroeapi-3fca03988b42adaf8e67cc7137dd1fdba327e197.zip
initial commit
Diffstat (limited to 'test')
-rw-r--r--test/heroes.delete.http6
-rw-r--r--test/heroes.get.http6
-rw-r--r--test/heroes.post.http167
-rw-r--r--test/test.py10
-rw-r--r--test/users.post.http45
5 files changed, 234 insertions, 0 deletions
diff --git a/test/heroes.delete.http b/test/heroes.delete.http
new file mode 100644
index 0000000..950575d
--- /dev/null
+++ b/test/heroes.delete.http
@@ -0,0 +1,6 @@
+# -*- restclient -*-
+
+DELETE http://localhost:5000/api/v1/heroes/<id>
+Authorization: Bearer <token>
+User-Agent: Emacs27
+Accept-Encoding: compress, gzip, json
diff --git a/test/heroes.get.http b/test/heroes.get.http
new file mode 100644
index 0000000..5026166
--- /dev/null
+++ b/test/heroes.get.http
@@ -0,0 +1,6 @@
+# -*- restclient -*-
+
+GET http://localhost:5000/api/v1/heroes
+Authorization: Bearer <token>
+User-Agent: Emacs27
+Accept-Encoding: compress, gzip, json
diff --git a/test/heroes.post.http b/test/heroes.post.http
new file mode 100644
index 0000000..462516c
--- /dev/null
+++ b/test/heroes.post.http
@@ -0,0 +1,167 @@
+# -*- restclient -*-
+
+#
+# Create Heroes
+#
+
+# Iroman
+POST http://localhost:5000/api/v1/heroes
+Authorization: Bearer <token>
+Content-Type: application/json
+
+{
+ "name": "Ironman",
+ "powerstats": {
+ "intelligence": "100",
+ "strength": "85",
+ "speed": "58",
+ "durability": "85",
+ "power": "100",
+ "combat": "64"
+ },
+ "biography": {
+ "full-name": "Tony Stark",
+ "alter-egos": "No alter egos found.",
+ "aliases": [
+ "Iron Knight",
+ "Hogan Potts",
+ "Spare Parts Man",
+ "Cobalt Man II",
+ "Crimson Dynamo",
+ "Ironman"
+ ],
+ "place-of-birth": "Long Island, New York",
+ "first-appearance": "Tales of Suspence #39 (March, 1963)",
+ "publisher": "Marvel Comics",
+ "alignment": "good"
+ },
+ "appearance": {
+ "gender": "Male",
+ "race": "Human",
+ "height": [
+ "6'6",
+ "198 cm"
+ ],
+ "weight": [
+ "425 lb",
+ "191 kg"
+ ],
+ "eye-color": "Blue",
+ "hair-color": "Black"
+ },
+ "work": {
+ "occupation": "Inventor, Industrialist; former United States Secretary of Defense",
+ "base": "Seattle, Washington"
+ },
+ "connections": {
+ "group-affiliation": "Avengers, Illuminati, Stark Resilient; formerly S.H.I.E.L.D., leader of Stark Enterprises, the Pro-Registration Superhero Unit, New Avengers, Mighty Avengers, Hellfire Club, Force Works, Avengers West Coast, United States Department of Defense.",
+ "relatives": "Howard Anthony Stark (father, deceased), Maria Stark (mother, deceased), Morgan Stark (cousin), Isaac Stark (ancestor)"
+ },
+ "image": {
+ "url": "https://www.superherodb.com/pictures2/portraits/10/100/85.jpg"
+ }
+}
+
+# Zoom
+POST http://localhost:5000/api/v1/heroes
+Authorization: Bearer <token>
+Content-Type: application/json
+{
+ "name": "Zoom",
+ "powerstats": {
+ "intelligence": "50",
+ "strength": "10",
+ "speed": "100",
+ "durability": "28",
+ "power": "100",
+ "combat": "28"
+ },
+ "biography": {
+ "full-name": "Hunter Zolomon",
+ "alter-egos": "No alter egos found.",
+ "aliases": [
+ "-"
+ ],
+ "place-of-birth": "-",
+ "first-appearance": "Flash Secret Files #3",
+ "publisher": "DC Comics",
+ "alignment": "bad"
+ },
+ "appearance": {
+ "gender": "Male",
+ "race": "null",
+ "height": [
+ "6'1",
+ "185 cm"
+ ],
+ "weight": [
+ "181 lb",
+ "81 kg"
+ ],
+ "eye-color": "Red",
+ "hair-color": "Brown"
+ },
+ "work": {
+ "occupation": "-",
+ "base": "Keystone City, Kansas"
+ },
+ "connections": {
+ "group-affiliation": "Secret Society of Super Villains, formerly Keystone Police Department, F.B.I.",
+ "relatives": "Ashley Zolomon (ex-wife)"
+ },
+ "image": {
+ "url": "https://www.superherodb.com/pictures2/portraits/10/100/1384.jpg"
+ }
+}
+
+# A-Bomb
+POST http://localhost:5000/api/v1/heroes
+Authorization: Bearer <token>
+Content-Type: application/json
+{
+ "name": "A-Bomb",
+ "powerstats": {
+ "intelligence": "38",
+ "strength": "100",
+ "speed": "17",
+ "durability": "80",
+ "power": "24",
+ "combat": "64"
+ },
+ "biography": {
+ "full-name": "Richard Milhouse Jones",
+ "alter-egos": "No alter egos found.",
+ "aliases": [
+ "Rick Jones"
+ ],
+ "place-of-birth": "Scarsdale, Arizona",
+ "first-appearance": "Hulk Vol 2 #2 (April, 2008) (as A-Bomb)",
+ "publisher": "Marvel Comics",
+ "alignment": "good"
+ },
+ "appearance": {
+ "gender": "Male",
+ "race": "Human",
+ "height": [
+ "6'8",
+ "203 cm"
+ ],
+ "weight": [
+ "980 lb",
+ "441 kg"
+ ],
+ "eye-color": "Yellow",
+ "hair-color": "No Hair"
+ },
+ "work": {
+ "occupation": "Musician, adventurer, author; formerly talk show host",
+ "base": "-"
+ },
+ "connections": {
+ "group-affiliation": "Hulk Family; Excelsior (sponsor), Avengers (honorary member); formerly partner of the Hulk, Captain America and Captain Marvel; Teen Brigade; ally of Rom",
+ "relatives": "Marlo Chandler-Jones (wife); Polly (aunt); Mrs. Chandler (mother-in-law); Keith Chandler, Ray Chandler, three unidentified others (brothers-in-law); unidentified father (deceased); Jackie Shorr (alleged mother; unconfirmed)"
+ },
+ "image": {
+ "url": "https://www.superherodb.com/pictures2/portraits/10/100/10060.jpg"
+ }
+}
diff --git a/test/test.py b/test/test.py
new file mode 100644
index 0000000..c541803
--- /dev/null
+++ b/test/test.py
@@ -0,0 +1,10 @@
+"""
+Test
+"""
+# import requests
+
+# BASE = "http://127.0.0.1:5000"
+
+# response = requests.post(f"{BASE}/api/v1/heroes")
+
+# print(response.json())
diff --git a/test/users.post.http b/test/users.post.http
new file mode 100644
index 0000000..f9de355
--- /dev/null
+++ b/test/users.post.http
@@ -0,0 +1,45 @@
+# -*- restclient -*-
+
+#
+# Create User for make Heroe
+#
+
+# Register - Admin User
+POST http://localhost:5000/api/v1/auth/signup
+Content-Type: application/json
+
+{
+ "username": "admin",
+ "email": "admin@example.com",
+ "password": "adminpass",
+ "admin": true
+}
+
+# Register - Standar User
+POST http://localhost:5000/api/v1/auth/signup
+Content-Type: application/json
+
+{
+ "username": "user",
+ "email": "user@example.com",
+ "password": "userpass",
+ "admin": false
+}
+
+# Generate Token for User admin
+POST http://localhost:5000/api/v1/auth/token
+Content-Type: application/json
+
+{
+ "email": "admin@example.com",
+ "password": "adminpass"
+}
+
+# Generate Token for User Standar
+POST http://localhost:5000/api/v1/auth/token
+Content-Type: application/json
+
+{
+ "email": "user@example.com",
+ "password": "userpass"
+}