def test_parse_args(self): """Option parser""" # XXX: Using cmd_commit makes these tests overly sensitive to changes # to cmd_commit, when they are meant to be about option parsing in # general. self.assertEqual(parse_args(cmd_commit(), ['--help']), ([], {'exclude': [], 'fixes': [], 'help': True})) self.assertEqual(parse_args(cmd_commit(), ['--message=biter']), ([], {'exclude': [], 'fixes': [], 'message': 'biter'}))
def test_parse_args(self): """Option parser""" # XXX: Using cmd_commit makes these tests overly sensitive to changes # to cmd_commit, when they are meant to be about option parsing in # general. self.assertEqual( ([], {'author': [], 'exclude': [], 'fixes': [], 'help': True}), parse_args(cmd_commit(), ['--help'])) self.assertEqual( ([], {'author': [], 'exclude': [], 'fixes': [], 'message': 'biter'}), parse_args(cmd_commit(), ['--message=biter']))
def test_no_more_opts(self): """Terminated options""" self.assertEqual(parse_args(cmd_commit(), ['--', '-file-with-dashes']), (['-file-with-dashes'], { 'exclude': [], 'fixes': [] }))
def test_commit_mine_modified(self): self.start_logging_connections() commit = builtins.cmd_commit() # commit do not provide a directory parameter, we have to change dir # manually os.chdir('local') commit.run(message=u'empty commit', unchanged=True) self.assertEquals(1, len(self.connections))
def test_commit_mine_modified(self): self.start_logging_connections() commit = builtins.cmd_commit() # commit do not provide a directory parameter, we have to change dir # manually os.chdir('local') commit.run(message=u'empty commit', unchanged=True) self.assertEqual(1, len(self.connections))
def test_commit_both_modified(self): self.master_wt.commit('empty commit on master') self.start_logging_connections() commit = builtins.cmd_commit() # commit do not provide a directory parameter, we have to change dir # manually os.chdir('local') self.assertRaises(errors.BoundBranchOutOfDate, commit.run, message=u'empty commit', unchanged=True) self.assertEquals(1, len(self.connections))
def test_commit_local(self): """Commits with --local should not connect to the master!""" self.start_logging_connections() commit = builtins.cmd_commit() # commit do not provide a directory parameter, we have to change dir # manually os.chdir('local') commit.run(message=u'empty commit', unchanged=True, local=True) #it shouldn't open any connections self.assertEquals(0, len(self.connections))
def test_commit_local(self): """Commits with --local should not connect to the master!""" self.start_logging_connections() commit = builtins.cmd_commit() # commit do not provide a directory parameter, we have to change dir # manually os.chdir('local') commit.run(message=u'empty commit', unchanged=True, local=True) #it shouldn't open any connections self.assertEqual(0, len(self.connections))
def test_commit_both_modified(self): self.master_wt.commit('empty commit on master') self.start_logging_connections() commit = builtins.cmd_commit() # commit do not provide a directory parameter, we have to change dir # manually os.chdir('local') self.assertRaises(errors.BoundBranchOutOfDate, commit.run, message=u'empty commit', unchanged=True) self.assertEqual(1, len(self.connections))
def test_allow_dash(self): """Test that we can pass a plain '-' as an argument.""" self.assertEqual((['-']), parse_args(cmd_commit(), ['-'])[0])
def test_no_more_opts(self): """Terminated options""" self.assertEqual(parse_args(cmd_commit(), ['--', '-file-with-dashes']), (['-file-with-dashes'], {'exclude': [], 'fixes': []}))