-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #318 set username when retrieving project from storage
- Loading branch information
Patrik Meijer
committed
Oct 10, 2023
1 parent
2476c23
commit b1eb8bb
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/*eslint-env node, mocha*/ | ||
/** | ||
* @author pmeijer / https://github.com/pmeijer | ||
*/ | ||
|
||
var testFixture = require('../_globals.js'); | ||
|
||
describe('UserProject_Auth', function () { | ||
'use strict'; | ||
const gmeConfig = testFixture.getGmeConfig(); | ||
gmeConfig.authentication.enable = true; | ||
const logger = testFixture.logger.fork('core.intrapersist'); | ||
const expect = testFixture.expect; | ||
const projectName = 'UserProject_Auth'; | ||
let gmeAuth; | ||
let projectId; | ||
let storage; | ||
|
||
before(async function () { | ||
gmeAuth = await testFixture.clearDBAndGetGMEAuth(gmeConfig, null); | ||
storage = testFixture.getMemoryStorage(logger, gmeConfig, gmeAuth); | ||
await storage.openDatabase(); | ||
const { project, commitHash, projectId: projectId_ } = await testFixture.importProject(storage, { | ||
projectSeed: './seeds/EmptyProject.webgmex', | ||
username: 'admin', | ||
ownerId: 'admin', | ||
projectName: projectName, | ||
gmeConfig: gmeConfig, | ||
logger: logger | ||
}); | ||
|
||
projectId = projectId_; | ||
|
||
project.createTag('tag', commitHash); | ||
}); | ||
|
||
after(async function () { | ||
gmeAuth && await gmeAuth.unload(); | ||
storage && await storage.closeDatabase(); | ||
}); | ||
|
||
it('should pass on username at OpenProject', async function () { | ||
const project = await storage.openProject({ username: 'admin', projectId }); | ||
const tags = await project.getTags(); | ||
expect(Object.keys(tags)).to.deep.equal(['tag']); | ||
}); | ||
|
||
it('should pass on username at CreateProject', async function () { | ||
const project = await storage.createProject({ username: 'admin', projectName: 'newProject' }); | ||
const tags = await project.getTags(); | ||
expect(Object.keys(tags)).to.deep.equal([]); | ||
}); | ||
|
||
it('should pass on username at DuplicateProject', async function () { | ||
const project = await storage.duplicateProject({ username: 'admin', projectName: 'newProjectDup', projectId }); | ||
const tags = await project.getTags(); | ||
expect(Object.keys(tags)).to.deep.equal(['tag']); | ||
}); | ||
}); |