forked from cms/tibi-svelte-starter
renamed to tibi-svelte-starter
This commit is contained in:
@@ -53,32 +53,32 @@ module.exports = (on, config) => {
|
||||
// is continous integration test run, so initialize database
|
||||
console.log("CI RUN: init database")
|
||||
|
||||
const wmbasicDbPrefix = config.env.wmbasicDbPrefix
|
||||
const tibiDbPrefix = config.env.tibiDbPrefix
|
||||
const projectNamespace = config.env.projectApiNamespace
|
||||
|
||||
// drop database from tests before
|
||||
console.log(" - connecting to mongodb: " + config.env.mongodbUri)
|
||||
const dbClient = new MongoClient(config.env.mongodbUri)
|
||||
await dbClient.connect()
|
||||
console.log(" - removing project from wmbasic db")
|
||||
let db = dbClient.db(wmbasicDbPrefix)
|
||||
console.log(" - removing project from tibi db")
|
||||
let db = dbClient.db(tibiDbPrefix)
|
||||
db.collection("project").deleteMany({ namespace: projectNamespace })
|
||||
|
||||
const dbName = wmbasicDbPrefix + "_" + projectNamespace
|
||||
const dbName = tibiDbPrefix + "_" + projectNamespace
|
||||
console.log(" - dropping database: " + dbName)
|
||||
db = dbClient.db(dbName)
|
||||
await db.dropDatabase()
|
||||
|
||||
// login
|
||||
const apiUrl = config.env.wmbasicApiUrl
|
||||
const apiUrl = config.env.tibiApiUrl
|
||||
const l = await axios.post(apiUrl + "/login", {
|
||||
username: config.env.wmbasicUsername,
|
||||
password: config.env.wmbasicPassword,
|
||||
username: config.env.tibiUsername,
|
||||
password: config.env.tibiPassword,
|
||||
})
|
||||
const wmbasicToken = l.data.token
|
||||
const tibiToken = l.data.token
|
||||
|
||||
// create project
|
||||
console.log(" - creating wmbasic project: " + projectNamespace)
|
||||
console.log(" - creating tibi project: " + projectNamespace)
|
||||
let project
|
||||
try {
|
||||
const p = await axios.post(
|
||||
@@ -91,7 +91,7 @@ module.exports = (on, config) => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
"X-Auth-Token": wmbasicToken,
|
||||
"X-Auth-Token": tibiToken,
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -105,7 +105,7 @@ module.exports = (on, config) => {
|
||||
try {
|
||||
const p = await axios.get(apiUrl + "/project/" + project.id, {
|
||||
headers: {
|
||||
"X-Auth-Token": wmbasicToken,
|
||||
"X-Auth-Token": tibiToken,
|
||||
},
|
||||
})
|
||||
if (!p.data.api.isOnline) {
|
||||
@@ -116,7 +116,7 @@ module.exports = (on, config) => {
|
||||
throw e
|
||||
}
|
||||
|
||||
// TODO fill wmbasic database with test data
|
||||
// TODO fill tibi database with test data
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user