Changeset View
Changeset View
Standalone View
Standalone View
cypress/plugins/index.js
/** | /** | ||||
* Copyright (C) 2019-2022 The Software Heritage developers | * Copyright (C) 2019-2022 The Software Heritage developers | ||||
* See the AUTHORS file at the top-level directory of this distribution | * See the AUTHORS file at the top-level directory of this distribution | ||||
* License: GNU Affero General Public License version 3, or any later version | * License: GNU Affero General Public License version 3, or any later version | ||||
* See top-level LICENSE file for more information | * See top-level LICENSE file for more information | ||||
*/ | */ | ||||
const axios = require('axios'); | const axios = require('axios'); | ||||
const {execFileSync} = require('child_process'); | |||||
const fs = require('fs'); | const fs = require('fs'); | ||||
const sqlite3 = require('sqlite3').verbose(); | const sqlite3 = require('sqlite3').verbose(); | ||||
async function httpGet(url) { | async function httpGet(url) { | ||||
const response = await axios.get(url); | const response = await axios.get(url); | ||||
return response.data; | return response.data; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 137 Lines • ▼ Show 20 Lines | 'db:add_forge_now:delete': () => { | ||||
db.run('DELETE FROM sqlite_sequence WHERE name="add_forge_request_history"'); | db.run('DELETE FROM sqlite_sequence WHERE name="add_forge_request_history"'); | ||||
}); | }); | ||||
db.serialize(function() { | db.serialize(function() { | ||||
db.run('DELETE FROM add_forge_request'); | db.run('DELETE FROM add_forge_request'); | ||||
db.run('DELETE FROM sqlite_sequence WHERE name="add_forge_request"'); | db.run('DELETE FROM sqlite_sequence WHERE name="add_forge_request"'); | ||||
}); | }); | ||||
db.close(); | db.close(); | ||||
return true; | return true; | ||||
}, | |||||
processAddForgeNowInboundEmail(emailSrc) { | |||||
try { | |||||
execFileSync('django-admin', | |||||
['process_inbound_email', '--settings=swh.web.settings.tests'], | |||||
{input: emailSrc}); | |||||
return true; | |||||
} catch (_) { | |||||
return false; | |||||
} | |||||
} | } | ||||
}); | }); | ||||
return config; | return config; | ||||
}; | }; |