Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
enedis_sge_konnector
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
web-et-numerique
Factory
LLLE_Project
enedis_sge_konnector
Commits
f753daba
Commit
f753daba
authored
2 years ago
by
Bastien DUMONT
Browse files
Options
Downloads
Patches
Plain Diff
test: test login flow from invoices
parent
58938747
No related branches found
No related tags found
1 merge request
!29
Resolve "[SGE] - Semi-automatiser les tests avec facture"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.vscode/settings.json
+1
-0
1 addition, 0 deletions
.vscode/settings.json
package.json
+1
-0
1 addition, 0 deletions
package.json
src/index.js
+28
-0
28 additions, 0 deletions
src/index.js
with
30 additions
and
0 deletions
.vscode/settings.json
+
1
−
0
View file @
f753daba
...
...
@@ -43,6 +43,7 @@
"grandlyon"
,
"HISTO"
,
"insee"
,
"konnector"
,
"konnectors"
,
"lastname"
,
"llle"
,
...
...
This diff is collapsed.
Click to expand it.
package.json
+
1
−
0
View file @
f753daba
...
...
@@ -42,6 +42,7 @@
"pretest"
:
"npm run clean"
,
"release"
:
"standard-version --no-verify"
,
"standalone"
:
"cozy-konnector-standalone"
,
"standalone-no-data"
:
"NO_DATA=true cozy-konnector-standalone src/index.js"
,
"start"
:
"node ./src/index.js"
,
"test:cov"
:
"jest --coverage"
,
"test"
:
"jest"
,
...
...
This diff is collapsed.
Click to expand it.
src/index.js
+
28
−
0
View file @
f753daba
...
...
@@ -56,6 +56,7 @@ const startLoadDate = moment().subtract(7, 'day')
const
endDate
=
moment
()
const
endDateString
=
endDate
.
format
(
'
YYYY-MM-DD
'
)
const
ACCOUNT_ID
=
isLocal
()
?
'
default_account_id
'
:
'
enedissgegrandlyon
'
const
NO_DATA
=
process
.
env
.
NO_DATA
===
'
true
'
module
.
exports
=
new
BaseKonnector
(
start
)
...
...
@@ -92,6 +93,13 @@ async function start(fields, cozyParameters) {
try
{
log
(
'
info
'
,
'
Konnector configuration ...
'
)
log
(
'
info
'
,
`isManual execution:
${
manualExecution
}
`
)
if
(
NO_DATA
)
{
log
(
'
debug
'
,
'
NO_DATA is enabled, konnector will stop after verifyUserIdentity()
'
)
}
const
transaction
=
Sentry
.
startTransaction
({
op
:
'
konnector
'
,
name
:
'
SGE Konnector
'
,
...
...
@@ -149,6 +157,8 @@ async function start(fields, cozyParameters) {
sgeLogin
)
exitIfDebug
(
user
)
let
consent
=
await
createBoConsent
(
boBaseUrl
,
boToken
,
...
...
@@ -230,6 +240,8 @@ async function start(fields, cozyParameters) {
accountData
.
data
.
inseeCode
)
exitIfDebug
(
user
)
if
(
!
userConsent
)
{
const
errorMessage
=
'
No user consent found
'
log
(
'
error
'
,
errorMessage
)
...
...
@@ -623,3 +635,19 @@ function isFirstStart(account) {
log
(
'
info
'
,
'
Konnector first start
'
)
return
true
}
/**
* Check if konnector is launched in local with NO_DATA option
* If so, logs result from verifyUserIdentity() and stops the konnector before getting any data
* @param {User} user - The user object to log
*/
function
exitIfDebug
(
user
)
{
if
(
NO_DATA
)
{
log
(
'
debug
'
,
`Stopping konnector before getting data, user found from verifyUserIdentity():`
)
log
(
'
debug
'
,
user
)
process
.
exit
()
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment