Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LemonLDAP NG
lemonldap-ng
Commits
b50e985e
Commit
b50e985e
authored
Jan 15, 2016
by
Yadd
Browse files
Check for removed apps (
#907
)
Not completly verified
parent
1c93769e
Changes
2
Hide whitespace changes
Inline
Side-by-side
lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Parser.pm
View file @
b50e985e
...
...
@@ -432,8 +432,18 @@ sub _scanNodes {
if
(
ref
$subNodes
)
{
$self
->
_scanNodes
(
$subNodes
)
or
return
0
;
}
my
@listCatRef
=
keys
%
{
$cmp
->
{
$app
}
};
my
@listCatNew
=
keys
%
{
$cn
->
{
$s
}
};
# TODO: check for deleted
# Check for deleted
unless
(
@listCatRef
==
@listCatNew
)
{
$self
->
confChanged
(
1
);
push
@
{
$self
->
changes
},
{
key
=>
join
(
'
,
',
'
applicationList
',
@path
),
new
=>
'
New cat(s)/app(s)
',
};
}
}
# Create new apps
...
...
lemonldap-ng-manager/t/12-save-changed-conf.t
View file @
b50e985e
...
...
@@ -23,20 +23,29 @@ my ( $res, $resBody );
ok
(
$res
=
&client
->
_post
(
'
/confs/
',
'
cfgNum=1
',
&body
,
'
application/json
'
),
"
Request succeed
"
);
ok
(
$res
->
[
0
]
==
200
,
"
Result code is 200
"
);
ok
(
$resBody
=
from_json
(
$res
->
[
2
]
->
[
0
]
),
"
Result body contains JSON text
"
);
ok
(
$resBody
=
from_json
(
$res
->
[
2
]
->
[
0
]
),
"
Result body contains JSON text
"
);
ok
(
$resBody
->
{
result
}
==
1
,
"
JSON response contains
\"
result:1
\"
"
)
or
print
STDERR
Dumper
(
$resBody
);
ok
(
-
f
$confFiles
->
[
1
],
'
File is created
'
);
my
@changes
=
@
{
&changes
};
my
@cmsg
=
@
{
$resBody
->
{
details
}
->
{
__changes__
}
};
ok
(
@changes
==
@cmsg
,
'
Same changes count
'
);
my
$bug
;
ok
(
@changes
==
@cmsg
,
'
Same changes count
'
)
or
$bug
=
1
;
while
(
my
$c
=
shift
@
{
$resBody
->
{
details
}
->
{
__changes__
}
}
)
{
my
$cmp1
=
@changes
;
my
$cmp2
=
@cmsg
;
@changes
=
grep
{
$_
->
{
key
}
ne
$c
->
{
key
}
}
@changes
;
@cmsg
=
grep
{
$_
->
{
key
}
ne
$c
->
{
key
}
}
@cmsg
;
ok
(
(
$cmp1
-
@changes
)
==
(
$cmp2
-
@cmsg
),
"
$c
->{key} found
"
);
count
(
1
);
}
ok
(
!
@changes
,
'
All changes detected
'
)
or
$bug
=
1
;
if
(
$bug
)
{
print
STDERR
Dumper
(
\
@changes
,
\
@cmsg
);
}
ok
(
!
@changes
,
'
All changes detected
'
);
#print STDERR Dumper(\@changes,\@cmsg);
...
...
@@ -67,6 +76,10 @@ sub changes {
'
new
'
=>
'
Application Test 3
',
'
key
'
=>
'
applicationList, Sample applications
'
},
{
'
key
'
=>
'
applicationList
',
'
new
'
=>
'
New cat(s)/app(s)
'
},
{
'
key
'
=>
'
userDB
',
'
new
'
=>
'
LDAP
',
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment