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
PIM
libkleo
Commits
93113467
Commit
93113467
authored
Jun 01, 2021
by
Ingo Klöcker
Browse files
Add test for support for flags in LDAP server "URLs"
The flags are stored as fragment of a QUrl.
parent
b45c40d9
Pipeline
#63757
passed with stage
in 8 minutes and 6 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/tests/test_cryptoconfig.cpp
View file @
93113467
...
...
@@ -23,6 +23,8 @@ using namespace QGpgME;
#include <stdlib.h>
#include <gpgme++/gpgmepp_version.h>
int
main
(
int
argc
,
char
**
argv
)
{
...
...
@@ -325,11 +327,16 @@ int main(int argc, char **argv)
// Test setting the option, sync'ing, then querying again
QList
<
QUrl
>
lst
;
lst
<<
QUrl
(
QStringLiteral
(
"ldap://a:389?b"
));
lst
<<
QUrl
(
QStringLiteral
(
"ldap://foo:389?a:b c"
));
lst
<<
QUrl
(
QStringLiteral
(
"ldap://server:389?a=b,c=DE"
));
// the query contains a literal ','
//cout << " trying to set: " << lst.toStringList().join(", ").local8Bit() << endl;
Q_ASSERT
(
lst
[
0
].
query
()
==
QLatin1Char
(
'b'
));
lst
<<
QUrl
(
QStringLiteral
(
"ldap://foo:389?a:b c"
));
Q_ASSERT
(
lst
[
1
].
query
()
==
QStringLiteral
(
"a:b c"
));
// see, the space got _not_escaped
lst
<<
QUrl
(
QStringLiteral
(
"ldap://server:389?a=b,c=DE"
));
Q_ASSERT
(
lst
[
2
].
query
()
==
QStringLiteral
(
"a=b,c=DE"
));
// the query contains a literal ','
#if GPGMEPP_VERSION >= 0x10F02 // 1.15.2
lst
<<
QUrl
(
QStringLiteral
(
"ldap://foo:389?a#ldaps"
));
Q_ASSERT
(
lst
[
3
].
fragment
()
==
QStringLiteral
(
"ldaps"
));
#endif
//cout << " trying to set: " << lst.toStringList().join(", ").local8Bit() << endl;
entry
->
setURLValueList
(
lst
);
Q_ASSERT
(
entry
->
isDirty
());
config
->
sync
(
true
);
...
...
@@ -349,13 +356,16 @@ int main(int argc, char **argv)
const
QList
<
QUrl
>
newlst
=
entry
->
urlValueList
();
cout
<<
"URL list now: "
;
for
(
const
QUrl
&
url
:
newlst
)
{
cout
<<
url
.
toString
().
toLocal8Bit
().
constData
()
<<
endl
;
cout
<<
url
.
toString
().
toLocal8Bit
().
constData
()
<<
", "
;
}
cout
<<
endl
;
Q_ASSERT
(
newlst
.
count
()
==
3
);
Q_ASSERT
(
newlst
.
size
()
==
lst
.
size
()
);
Q_ASSERT
(
newlst
[
0
].
url
()
==
lst
[
0
].
url
());
Q_ASSERT
(
newlst
[
1
].
url
()
==
lst
[
1
].
url
());
Q_ASSERT
(
newlst
[
2
].
url
()
==
lst
[
2
].
url
());
#if GPGMEPP_VERSION >= 0x10F02 // 1.15.2
Q_ASSERT
(
newlst
[
3
].
url
()
==
lst
[
3
].
url
());
#endif
// Reset old value
entry
->
setURLValueList
(
val
);
...
...
Write
Preview
Markdown
is supported
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