Bugzilla – Attachment 92355 Details for
Bug 20254
Forbid the download of duplicate EDI messages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20254: Add tests for transport ingest
Bug-20254-Add-tests-for-transport-ingest.patch (text/plain), 2.14 KB, created by
Kyle M Hall (khall)
on 2019-08-19 18:42:56 UTC
(
hide
)
Description:
Bug 20254: Add tests for transport ingest
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2019-08-19 18:42:56 UTC
Size:
2.14 KB
patch
obsolete
>From 7c3e5d8bf777392b0c690b0f9c34bb9f1a457a57 Mon Sep 17 00:00:00 2001 >From: Colin Campbell <colin.campbell@ptfs-europe.com> >Date: Mon, 10 Dec 2018 12:57:50 +0000 >Subject: [PATCH] Bug 20254: Add tests for transport ingest > >Add test framework for Koha::Edifact::Transport >Add specific test that ingest does not duplicate >an existing filename > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > t/EdiTransport.t | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 57 insertions(+) > create mode 100644 t/EdiTransport.t > >diff --git a/t/EdiTransport.t b/t/EdiTransport.t >new file mode 100644 >index 0000000000..fb2442ea7e >--- /dev/null >+++ b/t/EdiTransport.t >@@ -0,0 +1,57 @@ >+#!/usr/bin/perl >+ >+use Modern::Perl; >+use FindBin qw( $Bin ); >+use Test::More; >+use Test::MockModule; >+use Module::Load::Conditional qw/check_install/; >+ >+BEGIN { >+ if ( check_install( module => 'Test::DBIx::Class' ) ) { >+ plan tests => 5; >+ } >+ else { >+ plan skip_all => 'Need Test::DBIx::Class'; >+ } >+ >+} >+ >+use Test::DBIx::Class; >+ >+fixtures_ok [ >+ VendorEdiAccount => >+ [ [ 'id', 'description', 'transport' ], [ 1, 'test vendor', 'FILE' ], ], >+ EdifactMessage => [ >+ [ 'message_type', 'filename', 'raw_msg' ], >+ [ 'TEST', 'duplicate', 'message_contents' ], >+ ], >+ ], >+ 'add_fixtures'; >+ >+my $filename = 'QUOTES_413514.CEQ'; >+ >+my $db = Test::MockModule->new('Koha::Database'); >+$db->mock( _new_schema => sub { return Schema(); } ); >+ >+use_ok('Koha::Edifact::Transport'); >+ >+my $trans = Koha::Edifact::Transport->new(1); >+ >+isa_ok( $trans, 'Koha::Edifact::Transport' ); >+ >+$trans->working_directory("$Bin/edi_testfiles"); >+ >+my $mhash = $trans->message_hash(); >+$mhash->{message_type} = 'TEST'; # set a bogus message type >+ >+$trans->ingest( $mhash, $filename ); >+ >+my $cnt = ResultSet('EdifactMessage')->count(); >+ >+is( $cnt, 2, 'unique message name ingested' ); >+ >+$trans->ingest( $mhash, $filename ); # try a repeat ingest >+ >+my $cnt2 = ResultSet('EdifactMessage')->count(); >+ >+is( $cnt2, 2, 'duplicate message name not ingested' ); >-- >2.20.1 (Apple Git-117)
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 20254
:
74002
|
83013
|
83014
|
83015
|
91412
|
91413
|
91414
|
92353
|
92354
| 92355