Changeset 54 for mergebot/trunk/utils


Ignore:
Timestamp:
Feb 23, 2010 7:45:25 PM (15 years ago)
Author:
retracile
Message:

Mergebot: add testcase for text conflict

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mergebot/trunk/utils/test.py

    r52 r54  
    1717from trac.tests.functional import FunctionalTestSuite, FunctionalTester, FunctionalTwillTestCaseSetup, tc, b, logfile
    1818from trac.tests.functional.svntestenv import SvnFunctionalTestEnvironment
    19 from trac.tests.contentgen import random_page #, random_sentence, random_word
     19from trac.tests.contentgen import random_page, random_sentence #, random_word
    2020
    2121
     
    227227        if files is None:
    228228            files = ['.']
    229         retval = call(['svn', 'commit', '-m', message] + list(files),
     229        commit_message = self.__class__.__name__ + ": " + message
     230        retval = call(['svn', 'commit', '-m', commit_message] + list(files),
    230231            cwd=self.get_workdir(),
    231232            stdout=logfile, stderr=logfile)
     
    322323        self.add_new_file(basename + '-trunk')
    323324        self.commit('Add a new file on trunk')
     325
     326        self._tester.rebranch(ticket_id, 'stuff')
     327
     328
     329class MergeBotTestRebranchWithConflict(FunctionalSvnTestCaseSetup):
     330    def runTest(self):
     331        """Verify that the 'rebranch' button works with conflicts on the branch and trunk"""
     332        ticket_id = self._tester.create_ticket(summary=self.__class__.__name__,
     333            info={'component':'stuff', 'version':'trunk'})
     334        basename = self.__class__.__name__
     335
     336        # create a file in which to have conflicts
     337        self.checkout()
     338        self.add_new_file(basename)
     339        self.commit('Add a new file on trunk')
     340
     341        # create the branch
     342        self._tester.branch(ticket_id, 'stuff')
     343
     344        # modify the file on trunk
     345        open(os.path.join(self.get_workdir(), basename), 'a').write(random_sentence())
     346        self.commit('Modify the file on trunk')
     347
     348        # modify the file on the branch
     349        self.switch(ticket_id)
     350        open(os.path.join(self.get_workdir(), basename), 'a').write(random_sentence())
     351        self.commit('Modify the file on branch')
    324352
    325353        self._tester.rebranch(ticket_id, 'stuff')
     
    366394    suite.addTest(MergeBotTestRebranchWithChange())
    367395    suite.addTest(MergeBotTestRebranchWithChangeAndTrunkChange())
     396    suite.addTest(MergeBotTestRebranchWithConflict())
    368397    suite.addTest(MergeBotTestSingleUseCase())
    369398    return suite
Note: See TracChangeset for help on using the changeset viewer.