Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
1df1a7b9
Commit
1df1a7b9
authored
Aug 31, 2016
by
David Lawrence
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Fixed API tests to work after login/email changes
parent
3a903b41
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
5 deletions
+29
-5
RPC.pm
xt/lib/QA/RPC.pm
+10
-1
Util.pm
xt/lib/QA/Util.pm
+14
-0
bug_attachments.t
xt/webservice/bug_attachments.t
+2
-2
bug_comments.t
xt/webservice/bug_comments.t
+1
-0
user_get.t
xt/webservice/user_get.t
+2
-2
No files found.
xt/lib/QA/RPC.pm
View file @
1df1a7b9
...
@@ -236,7 +236,9 @@ sub bz_run_tests {
...
@@ -236,7 +236,9 @@ sub bz_run_tests {
}
}
sub
bz_test_bug
{
sub
bz_test_bug
{
my
(
$self
,
$fields
,
$bug
,
$expect
,
$t
,
$creation_time
)
=
@_
;
my
(
$self
,
$fields
,
$bug
,
$orig_expect
,
$t
,
$creation_time
)
=
@_
;
my
$expect
=
dclone
(
$orig_expect
);
foreach
my
$field
(
sort
@$fields
)
{
foreach
my
$field
(
sort
@$fields
)
{
# "description" is used by Bug.create but comments are not returned
# "description" is used by Bug.create but comments are not returned
...
@@ -253,6 +255,12 @@ sub bz_test_bug {
...
@@ -253,6 +255,12 @@ sub bz_test_bug {
next
;
next
;
}
}
foreach
my
$field
(
qw(assigned_to creator qa_contact)
)
{
if
(
!
$t
->
{
user
})
{
$expect
->
{
$field
}
=
email_filter
(
$expect
->
{
$field
});
}
}
if
(
$field
=~
/^is_/
)
{
if
(
$field
=~
/^is_/
)
{
ok
(
defined
$bug
->
{
$field
},
$self
->
TYPE
.
": $field is not null"
);
ok
(
defined
$bug
->
{
$field
},
$self
->
TYPE
.
": $field is not null"
);
is
(
$bug
->
{
$field
}
?
1
:
0
,
$expect
->
{
$field
}
?
1
:
0
,
is
(
$bug
->
{
$field
}
?
1
:
0
,
$expect
->
{
$field
}
?
1
:
0
,
...
@@ -260,6 +268,7 @@ sub bz_test_bug {
...
@@ -260,6 +268,7 @@ sub bz_test_bug {
}
}
elsif
(
$field
eq
'cc'
)
{
elsif
(
$field
eq
'cc'
)
{
foreach
my
$cc_item
(
@
{
$expect
->
{
cc
}
||
[]
})
{
foreach
my
$cc_item
(
@
{
$expect
->
{
cc
}
||
[]
})
{
$cc_item
=
email_filter
(
$cc_item
)
if
!
$t
->
{
user
};
ok
(
grep
(
$_
eq
$cc_item
,
@
{
$bug
->
{
cc
}
}),
ok
(
grep
(
$_
eq
$cc_item
,
@
{
$bug
->
{
cc
}
}),
$self
->
TYPE
.
": $field contains $cc_item"
);
$self
->
TYPE
.
": $field contains $cc_item"
);
}
}
...
...
xt/lib/QA/Util.pm
View file @
1df1a7b9
...
@@ -18,6 +18,7 @@ use lib "$RealBin/../../lib", "$RealBin/../../../local/lib/perl5";
...
@@ -18,6 +18,7 @@ use lib "$RealBin/../../lib", "$RealBin/../../../local/lib/perl5";
use
autodie
;
use
autodie
;
use
Data::
Dumper
;
use
Data::
Dumper
;
use
Email::
Address
;
use
Test::
More
;
use
Test::
More
;
use
parent
qw(Exporter)
;
use
parent
qw(Exporter)
;
...
@@ -25,6 +26,7 @@ use parent qw(Exporter);
...
@@ -25,6 +26,7 @@ use parent qw(Exporter);
trim
trim
url_quote
url_quote
random_string
random_string
email_filter
log_in
log_in
logout
logout
...
@@ -367,6 +369,18 @@ sub set_parameters {
...
@@ -367,6 +369,18 @@ sub set_parameters {
}
}
}
}
sub
email_filter
{
my
(
$toencode
)
=
@_
;
my
@emails
=
Email::
Address
->
parse
(
$toencode
);
if
(
scalar
@emails
)
{
my
@hosts
=
map
{
quotemeta
(
$_
->
host
)
}
@emails
;
my
$hosts_re
=
join
(
'|'
,
@hosts
);
$toencode
=~
s/\@(?:$hosts_re)//g
;
return
$toencode
;
}
return
$toencode
;
}
1
;
1
;
__END__
__END__
xt/webservice/bug_attachments.t
View file @
1df1a7b9
...
@@ -141,8 +141,8 @@ sub post_success {
...
@@ -141,8 +141,8 @@ sub post_success {
"content_type is correct");
"content_type is correct");
cmp_ok($attachment->{file_name}, '=~', qr/^\w+\.pl$/,
cmp_ok($attachment->{file_name}, '=~', qr/^\w+\.pl$/,
"filename is in the expected format");
"filename is in the expected format");
is($attachment->{creator},
$config->{QA_Selenium_TEST_user_login}
,
is($attachment->{creator},
($t->{user} ? $config->{QA_Selenium_TEST_user_login} : email_filter($config->{QA_Selenium_TEST_user_login}))
,
"creator is the correct user");
"creator is the correct user");
my $data = $attachment->{data};
my $data = $attachment->{data};
$data = decode_base64($data) if $rpc->isa('QA::RPC::JSONRPC');
$data = decode_base64($data) if $rpc->isa('QA::RPC::JSONRPC');
is($data, $content, 'data is correct');
is($data, $content, 'data is correct');
...
...
xt/webservice/bug_comments.t
View file @
1df1a7b9
...
@@ -47,6 +47,7 @@ sub test_comments {
...
@@ -47,6 +47,7 @@ sub test_comments {
is($comment->{text}, $expected_text, "comment has the correct text");
is($comment->{text}, $expected_text, "comment has the correct text");
my $priv_login = $rpc->bz_config->{PRIVATE_BUG_USER . '_user_login'};
my $priv_login = $rpc->bz_config->{PRIVATE_BUG_USER . '_user_login'};
$priv_login = $t->{user} ? $priv_login : email_filter($priv_login);
is($comment->{creator}, $priv_login, "comment creator is correct");
is($comment->{creator}, $priv_login, "comment creator is correct");
my $creation_day;
my $creation_day;
...
...
xt/webservice/user_get.t
View file @
1df1a7b9
...
@@ -137,8 +137,8 @@ sub post_success {
...
@@ -137,8 +137,8 @@ sub post_success {
'Admin correctly gets all user fields');
'Admin correctly gets all user fields');
}
}
elsif ($user) {
elsif ($user) {
ok(exists $item->{
email} && exists $item->{
can_login},
ok(exists $item->{can_login},
'Logged-in user correctly gets
email and
can_login');
'Logged-in user correctly gets can_login');
ok(!exists $item->{email_enabled}
ok(!exists $item->{email_enabled}
&& !exists $item->{login_denied_text},
&& !exists $item->{login_denied_text},
"Non-admin user doesn't get email_enabled and login_denied_text");
"Non-admin user doesn't get email_enabled and login_denied_text");
...
...
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