Bugzilla – Attachment 38921 Details for
Bug 6874
Attach files to bibliographic records
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 6874: Catch warnings for clean tests.
Bug-6874-Catch-warnings-for-clean-tests.patch (text/plain), 4.73 KB, created by
Mark Tompsett
on 2015-05-06 21:14:18 UTC
(
hide
)
Description:
Bug 6874: Catch warnings for clean tests.
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2015-05-06 21:14:18 UTC
Size:
4.73 KB
patch
obsolete
>From a6964795b80a147671dc0aaa32ecc8b714c9ff2e Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Sat, 11 Apr 2015 23:57:43 -0400 >Subject: [PATCH] Bug 6874: Catch warnings for clean tests. > >I hate noisy tests, so I cleaned them up. > >MEGA TEST PLAN >-------------- >git checkout -b bug_6874 origin/master >git bz apply 6874 >-- yes, it should all apply smoothly. >I intentionally restored an old backup from a couple months ago to force the upgrade. >staff client: >-- upgrade >-- login >Koha administration >MARC Bibliographic framework >MARC structure (for BKS) >Search for 856 >Subfields >Edit (for u) >Other options >Plugin: upload.pl >Save changes >Search the catalog tab >{choose a word, any word. I used fancy, because I knew we had a cookbook} >click first link >Edit >Edit record >8 (that's the tab name) >click the name for 856 >scroll down to u and click the plugin icon >-- Correctly got a configuration error message. > >At a command prompt: >vi ~/koha-dev/etc/koha-conf.xml >/enable_plug >-- add in: ><upload_path>{appropriate path. I used /home/mtompset/uploads}</upload_path> >:wq >mkdir {appropriate path used} >-- I even added some subdirectories >sudo chown -R -v www-data.www-data {appropriate path used} > >Back in staff client: >click the plugin icon again >-- this time an upload screen pops up >click the 'Upload file' button >-- message about no file or destination >browse for a file, select one >click the 'Upload file' button >-- message about no destination >click the 'Cancel' button >click the plugin icon >click a destination radio button >click the 'Upload file' button >-- message about no file >browse for a file, select one >click the 'Upload file' button >-- message about success >click the 'close' button. >-- the text box has been filled in with a nice URL >click the plugin icon >click cancel >click the plugin icon >click delete >-- the test box should be blanked, and a success message given >click Close >-- reupload a file properly >click the plugin icon >click delete >click upload file >browse for a file, select a destination, click upload file >click close on success message >click 'Clone this subfield' >click the second plugin icon >click delete >click close >click the first plugin icon >-- Nice error message about a URL which points to nothing. >click cancel >In the second 856$u type in a URL (eg. www.google.com) >click the second plugin icon >-- this jumps immediately to the upload screen, but does not give an error message, because the URL does not have opac-retrieve-file in it. >click save (we need to save the bibliographic record) > >In OPAC: >search for the same word (I used fancy) >find the entry you just updated with links >click the two links. The dangling entry should give you a 500 error, and the other link should work just fine. >get back to the detail page > >In staff client: >edit >edit record >8 >change the 856$u to a valid file in the first link. >save > >In OPAC: >refresh the detail page, and click the first link again >this time it should get downloaded nicely. > >From a command line: >prove -v t/db_dependent/UploadedFiles.t >perldoc C4::Biblio >perldoc C4::UploadedFiles > >One more round of tests tomorrow, and this should be ready. :) >--- > t/db_dependent/UploadedFiles.t | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > >diff --git a/t/db_dependent/UploadedFiles.t b/t/db_dependent/UploadedFiles.t >index 8e04aa2..dfa1c47 100644 >--- a/t/db_dependent/UploadedFiles.t >+++ b/t/db_dependent/UploadedFiles.t >@@ -3,7 +3,8 @@ > use Modern::Perl; > use File::Temp qw/ tempdir /; > use Test::CGI::Multipart; >-use Test::More tests => 15; >+use Test::More tests => 17; >+use Test::Warn; > > use t::lib::Mocks; > >@@ -44,9 +45,13 @@ open my $fh,">",($file->{filepath}); > print $fh ""; > close $fh; > >-ok(C4::UploadedFiles::DelUploadedFile($id)==1, "DelUploadedFile($id) returned 1."); >-ok(C4::UploadedFiles::DelUploadedFile($id)==-1, "DelUploadedFile($id) returned -1 as expected."); >+my $DelResult; >+is(C4::UploadedFiles::DelUploadedFile($id),1, "DelUploadedFile($id) returned 1 as expected."); >+warning_like { $DelResult=C4::UploadedFiles::DelUploadedFile($id); } qr/file for id=/, "Expected warning for deleting Dangling Entry."; >+is($DelResult,-1, "DelUploadedFile($id) returned -1 as expected."); > ok(! -e $file->{filepath}, "File $file->{filepath} does not exist anymore"); > >-is(C4::UploadedFiles::UploadFile($testfilename, '../', $testfile_fh->handle), undef, 'UploadFile with $dir containing ".." return undef'); >+my $UploadResult; >+warning_like { $UploadResult=C4::UploadedFiles::UploadFile($testfilename,'../',$testfile_fh->handle); } qr/^Filename or dirname contains '..'. Aborting upload/, "Expected warning for bad file upload."; >+is($UploadResult, undef, "UploadFile with dir containing \"..\" return undef"); > is(C4::UploadedFiles::GetUploadedFile(), undef, 'GetUploadedFile without parameters returns undef'); >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6874
:
5439
|
5440
|
5764
|
7114
|
7980
|
8234
|
8468
|
10664
|
10673
|
10863
|
10982
|
11098
|
11634
|
12355
|
12356
|
12357
|
12358
|
14130
|
14131
|
14132
|
14133
|
16343
|
16354
|
16355
|
16356
|
16357
|
16370
|
16693
|
16694
|
16695
|
16696
|
16697
|
16698
|
16699
|
16712
|
16713
|
16714
|
16715
|
16716
|
16717
|
16718
|
16719
|
17368
|
17369
|
18767
|
18768
|
18769
|
18770
|
18771
|
18772
|
18773
|
18774
|
18775
|
18776
|
18777
|
18891
|
18892
|
18893
|
18894
|
20059
|
20060
|
20779
|
21432
|
21433
|
21434
|
21435
|
21436
|
21489
|
21543
|
21546
|
21635
|
21798
|
21799
|
21800
|
21801
|
21802
|
21803
|
23588
|
23589
|
23590
|
23591
|
23607
|
23608
|
23609
|
23610
|
23611
|
23612
|
23613
|
26418
|
26419
|
26420
|
26421
|
26422
|
26423
|
26424
|
26878
|
26879
|
26880
|
26881
|
26882
|
26883
|
26884
|
27114
|
27125
|
27154
|
27155
|
27225
|
30362
|
30363
|
30364
|
30365
|
30366
|
30367
|
30368
|
30369
|
30370
|
30371
|
32384
|
32385
|
32386
|
32387
|
32388
|
32389
|
32390
|
32391
|
32392
|
32393
|
36198
|
36199
|
36200
|
36201
|
36202
|
36203
|
36204
|
36205
|
36206
|
36207
|
36208
|
36209
|
36210
|
36211
|
36213
|
36214
|
36215
|
36216
|
36217
|
36218
|
36219
|
36220
|
36221
|
36222
|
36223
|
36224
|
36225
|
36226
|
36227
|
36228
|
36229
|
36230
|
36231
|
36232
|
37681
|
37682
|
37683
|
37684
|
37685
|
37686
|
37687
|
37688
|
37689
|
37690
|
37691
|
37692
|
37693
|
37694
|
37696
|
37697
|
37698
|
37699
|
37700
|
37701
|
37702
|
37703
|
37704
|
37705
|
37706
|
38911
|
38912
|
38913
|
38914
|
38915
|
38916
|
38917
|
38918
|
38919
|
38920
|
38921
|
38922
|
38923
|
38924
|
38925
|
38926
|
38927
|
38928
|
38929
|
38930
|
38931
|
38932
|
38933
|
38934
|
38935
|
38936
|
39113
|
39114
|
39115
|
39116
|
39117
|
39118
|
39119
|
39120
|
39121
|
39122
|
39123
|
39626
|
39627
|
39628
|
39629
|
39630
|
39631
|
39632
|
39633
|
39634
|
39635
|
39636
|
39637
|
39638
|
41275
|
41276
|
41277
|
41278
|
41279
|
41280
|
41281
|
41282
|
41283
|
41284
|
41285
|
41286
|
41287
|
41288
|
41448
|
41449
|
41450
|
41783