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
immerda
Immerda Apps
iapi
Commits
bf5a32f8
Commit
bf5a32f8
authored
Oct 23, 2021
by
o
Browse files
add some tests for whois api
parent
8c02e33c
Pipeline
#9215
passed with stage
in 3 minutes and 19 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
spec/users_admin_spec.rb
View file @
bf5a32f8
...
@@ -180,4 +180,38 @@ describe "iApi users admin route" do
...
@@ -180,4 +180,38 @@ describe "iApi users admin route" do
end
end
end
end
end
end
context
'/whois'
do
it
'queries users'
do
get_as
(
'admin'
,
'/users_admin/whois'
,
search:
'user1@example.com'
)
expect
(
last_response
.
parsed_body
[
"matches"
].
size
).
to
eq
(
1
)
expect
(
last_response
.
parsed_body
[
"matches"
][
0
][
"email_object"
]).
to
eq
(
"EmailUser"
)
get_as
(
'admin'
,
'/users_admin/whois'
,
search:
'user1@'
)
expect
(
last_response
.
parsed_body
[
"matches"
].
size
).
to
eq
(
1
)
expect
(
last_response
.
parsed_body
[
"matches"
][
0
][
"email"
]).
to
eq
(
"user1@example.com"
)
expect
(
last_response
.
parsed_body
[
"matches"
][
0
][
"email_object"
]).
to
eq
(
"EmailUser"
)
end
it
'queries forwards'
do
get_as
(
'admin'
,
'/users_admin/whois'
,
search:
'fwd3@'
)
expect
(
last_response
.
parsed_body
[
"matches"
].
size
).
to
eq
(
1
)
expect
(
last_response
.
parsed_body
[
"matches"
][
0
][
"email_object"
]).
to
eq
(
"EmailAlias"
)
expect
(
last_response
.
parsed_body
[
"matches"
][
0
][
"resource"
]).
to
eq
(
"mail_alias"
)
expect
(
last_response
.
parsed_body
[
"matches"
][
0
][
"forwards"
]).
to
eq
([
"user1@example.com"
])
get_as
(
'admin'
,
'/users_admin/whois'
,
search:
'fwd5@'
)
expect
(
last_response
.
parsed_body
[
"matches"
].
size
).
to
eq
(
1
)
expect
(
last_response
.
parsed_body
[
"matches"
][
0
][
"email_object"
]).
to
be_nil
expect
(
last_response
.
parsed_body
[
"matches"
][
0
][
"forwards"
]).
to
eq
([
"external@test.com"
])
end
it
'queries resources'
do
u
=
EmailUser
.
active
.
all
.
sample
ResourceManager
.
create!
(
"schleuder"
,
u
.
email
,
{
name:
"testcreation"
,
domain:
"example.com"
,
schleuder_host:
"schleuder1"
})
get_as
(
'admin'
,
'/users_admin/whois'
,
search:
'testcreation@example.com'
)
expect
(
last_response
.
parsed_body
[
"matches"
].
size
).
to
eq
(
1
)
expect
(
last_response
.
parsed_body
[
"matches"
][
0
][
"resource"
]).
to
eq
(
"schleuder"
)
end
end
end
end
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