mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-02-17 07:33:57 +00:00
test: migration from Python to JavaScript
This commit is contained in:
@@ -6,15 +6,18 @@ const path = require('path')
|
||||
const { execSync } = require('child_process')
|
||||
|
||||
describe('sogo-tool tests', function() {
|
||||
let tmpdir, userdir
|
||||
let tmpdir, isRoot
|
||||
|
||||
beforeAll(function() {
|
||||
const { homedir } = os.userInfo()
|
||||
userdir = homedir
|
||||
const { uid } = os.userInfo()
|
||||
isRoot = (uid == 0)
|
||||
})
|
||||
|
||||
beforeEach(function() {
|
||||
tmpdir = mkdtempSync(path.join(userdir, 'sogo-'))
|
||||
tmpdir = mkdtempSync(path.join(os.tmpdir(), 'sogo-'))
|
||||
if (isRoot) {
|
||||
execSync(`chown -R sogo:sogo ${tmpdir}`)
|
||||
}
|
||||
})
|
||||
|
||||
afterEach(function() {
|
||||
@@ -22,8 +25,7 @@ describe('sogo-tool tests', function() {
|
||||
})
|
||||
|
||||
it('backup', async function() {
|
||||
const { uid } = os.userInfo()
|
||||
const sudo = uid == 0 ? `sudo -u sogo ` : ``
|
||||
const sudo = isRoot ? `sudo -u sogo ` : ``
|
||||
execSync(`${sudo}sogo-tool backup ${tmpdir} ${config.username}`, (error, stdout, stderr) => {
|
||||
expect(error).not.toBeDefined()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user