Add frontend
This commit is contained in:
parent
4f0bd8670b
commit
c47b7334eb
@ -2,32 +2,48 @@ import requests as req
|
|||||||
|
|
||||||
|
|
||||||
class CreateItemChecks:
|
class CreateItemChecks:
|
||||||
def createAuthor (result):
|
def createAuthor (this, result):
|
||||||
|
return 'response' in result
|
||||||
|
|
||||||
|
def invalidType (this, result):
|
||||||
return 'response' in result
|
return 'response' in result
|
||||||
|
|
||||||
|
|
||||||
class CreateItemActions:
|
class CreateItemActions:
|
||||||
def createAuthor ():
|
def createAuthor (this):
|
||||||
return req.post(
|
return req.post(
|
||||||
"http://127.0.0.1:8080/api/v/1.0/create-item?response_format=json",
|
"http://127.0.0.1:8080/api/v/1.0/create-item?response_format=json",
|
||||||
json={
|
json={
|
||||||
"type" : "author"
|
"type" : "author",
|
||||||
|
"name" : "TestAuthor"
|
||||||
|
}
|
||||||
|
).json()
|
||||||
|
|
||||||
|
def invalidType (this):
|
||||||
|
return req.post(
|
||||||
|
"http://127.0.0.1:8080/api/v/1.0/create-item?response_format=json",
|
||||||
|
json={
|
||||||
|
"type" : "asdasdsad",
|
||||||
|
"name" : "TestAuthor"
|
||||||
}
|
}
|
||||||
).json()
|
).json()
|
||||||
|
|
||||||
createItemActions = CreateItemActions()
|
createItemActions = CreateItemActions()
|
||||||
createItemChecks = CreateItemChecks()
|
createItemChecks = CreateItemChecks()
|
||||||
|
|
||||||
def test (id, action, isDone):
|
def test (id, action, isDone, nextTest=lambda:None):
|
||||||
try:
|
try:
|
||||||
print("""Test {id} runned..""")
|
print("""Test {id} runned..""")
|
||||||
result = action()
|
result = action()
|
||||||
if isDone(result):
|
if isDone(result):
|
||||||
print("""Test {id} success!""")
|
print("""Test {id} success!""")
|
||||||
|
nextTest()
|
||||||
else:
|
else:
|
||||||
print("""Test {id} ERROR""")
|
print("""Test {id} ERROR""")
|
||||||
print(result)
|
print(result)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
print(exc)
|
print(exc)
|
||||||
|
|
||||||
test(1, createItemActions.createAuthor, createItemChecks.createAuthor)
|
test_3 = lambda : test(3, createItemActions.createAuthor, createItemChecks.createAuthor)
|
||||||
|
test_2 = lambda : test(2, createItemActions.createAuthor, createItemChecks.createAuthor)
|
||||||
|
test_1 = test(1, createItemActions.invalidType, createItemChecks.invalidType, test)
|
@ -64,8 +64,8 @@ app.use((req, res, next) => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.use("/", async (rq, rs, next) => next(), require("./page-view"));
|
app.use("/", require("./page-view"));
|
||||||
app.use("/api", async (rq, rs, next) => next(), require("./api"));
|
app.use("/api", require("./api"));
|
||||||
|
|
||||||
// Подключение через HTTPS
|
// Подключение через HTTPS
|
||||||
let server;
|
let server;
|
||||||
|
Loading…
Reference in New Issue
Block a user