From 6db28b3899e0ec275f58bbd274a9112e14f78245 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 10 Sep 2007 18:23:44 +0000 Subject: [PATCH] Added Subversion repository unit tests. git-svn-id: http://redmine.rubyforge.org/svn/trunk@722 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- .../repositories/subversion_repository.dump | Bin 0 -> 15812 bytes test/unit/repository_subversion_test.rb | 55 ++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 test/fixtures/repositories/subversion_repository.dump create mode 100644 test/unit/repository_subversion_test.rb diff --git a/test/fixtures/repositories/subversion_repository.dump b/test/fixtures/repositories/subversion_repository.dump new file mode 100644 index 0000000000000000000000000000000000000000..322f0c102387af341c5e98f19bf6bd675ea9fbfd GIT binary patch literal 15812 zcmeHuc|4Tu_y0Y{GBX$>vZQoJgenMAX(AzB1+Y*-c)Ycks+h{B>+ zSQDub8P5tLQP}XTb+JbltUC0+$u=o*TC_-$(gCc^(Auu%x#`)JK z%mR>#5k*GWvYBEC;{y_HFho4w#sW{XAmF_T6k9UI7EiV$TaySxYkv%V=@R-f3)jUi zf54aU$9xF{;xCNH+hEQ%6P$VcV3;w%8Z$qFE9NqJAU9mV7m6+60R;TS2&P0F!WWK9 zhY1z@ONp(?wj`=0nM%gv@jpqtn9qhR1k7<|h$KPZ^}SjQiNu(Rt}t!{+ZJSVh2LJ8 zEb)Xrm~8f+tPKC_!tj_Mb@Z!oh<`%re?dvsL`x!`^zSRl%2FWYheE8Mw8i1_pnqRo z-cXeI7sn(LXqcZm!r9igAce)Gk*Pr>GCl}TWU{Ow$ePTekZo8j8imZJv42rLkx2Vd z_jdE5!g=6#BhNJ;SmF&pD1yajb0dQ18Z7sAv!EKxvscB~eP5IdBw`7t!TRl zW;kU34{l;-HPJfW&EkiL!@JAg&g%E4@z(FOL=zOOetHX%aCz)y0*Ljk@8{PDrdT3` zzEAu6i{0-eeijb%P2qp&$yOXbj}3kI;Qt1P{_{QbowHT25Q4;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m?1O{c7#RzHVPiZ<}$-A!9`4n1x3Ikc-&wKj|qmu_&BCH7|9fJVfOG7Y+?Z{JiL-% z31kjJ60RtmKOwg{7|w<1(}jF)1UQcO6>}$K6YhB>*wyuZt12~NB)g)GVMB8yls zQCO90BoG)01NC5b6Y5_hVTxgNpEm!90IV24=8ve+WT;6~YeV?qLW!h58?$vwxQ32SEF;&|6jrGa?xJIhy^BfFxKG zf9{w-V+WDh6o>=iiDWjLz+pkwY={N}v6(~ykwhl2X}{_ZCIiRxarEr}W?uPkO(FkG zjW%$(#jjvx0>y^S!CSMb94ZWCCqj5~P!Nn!W|EjekPV6OE2w>(4Cepmi2tb^@&BXu z|HILn{3p>HE)sJ7hr%WT-1ZOA8$J&^PegC{B*li|0v?Xmf3NK_o#ISHd&o71@FY@_0Et80tMc>mg$cJwj=M#Ds4l6l)Ue7q!7uF#lDV?2q!; F{{c%Xbua(` literal 0 HcmV?d00001 diff --git a/test/unit/repository_subversion_test.rb b/test/unit/repository_subversion_test.rb new file mode 100644 index 000000000..dd1c5eb6e --- /dev/null +++ b/test/unit/repository_subversion_test.rb @@ -0,0 +1,55 @@ +# redMine - project management software +# Copyright (C) 2006-2007 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +require File.dirname(__FILE__) + '/../test_helper' + +class RepositorySubversionTest < Test::Unit::TestCase + fixtures :projects + + # No '..' in the repository path for svn + REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/subversion_repository' + + def setup + @project = Project.find(1) + assert @repository = Repository::Subversion.create(:project => @project, :url => "file:///#{REPOSITORY_PATH}") + end + + if File.directory?(REPOSITORY_PATH) + def test_fetch_changesets_from_scratch + @repository.fetch_changesets + @repository.reload + + assert_equal 8, @repository.changesets.count + assert_equal 16, @repository.changes.count + assert_equal 'Initial import.', @repository.changesets.find_by_revision(1).comments + end + + def test_fetch_changesets_incremental + @repository.fetch_changesets + # Remove changesets with revision > 5 + @repository.changesets.find(:all, :conditions => 'revision > 5').each(&:destroy) + @repository.reload + assert_equal 5, @repository.changesets.count + + @repository.fetch_changesets + assert_equal 8, @repository.changesets.count + end + else + puts "Subversion test repository NOT FOUND. Skipping tests !!!" + def test_fake; assert false end + end +end -- 2.39.5