1
# test_mark_uploaded.py -- Blackbox tests for mark-uploaded.
2
# Copyright (C) 2007 James Westby <jw+debian@jameswestby.net>
4
# This file is part of bzr-builddeb.
6
# bzr-builddeb is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
11
# bzr-builddeb is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with bzr-builddeb; if not, write to the Free Software
18
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
from debian_bundle.changelog import Changelog, Version
23
from bzrlib.plugins.builddeb.tests import BuilddebTestCase
26
class TestMarkUploaded(BuilddebTestCase):
28
def make_unuploaded(self):
29
self.wt = self.make_branch_and_tree('.')
30
self.build_tree(['debian/'])
33
cl.new_block(package='package',
34
version=Version('0.1-1'),
35
distributions='unstable',
37
author='James Westby <jw+debian@jameswestby.net>',
38
date='Thu, 3 Aug 2006 19:16:22 +0100',
41
cl.add_change(' * Initial packaging.');
43
f = open('debian/changelog', 'wb')
45
cl.write_to_open_file(f)
48
self.wt.add(["debian/", "debian/changelog"])
51
def test_mark_uploaded_available(self):
52
self.run_bzr('mark-uploaded --help')
54
def test_mark_uploaded_changes(self):
55
self.make_unuploaded()
56
self.build_tree(['foo'])
58
self.run_bzr_error(["There are uncommitted changes"],
61
def test_mark_uploaded_unkown_dist(self):
62
self.make_unuploaded()
65
cl.new_block(package='package',
66
version=Version('0.1-1'),
67
distributions='UNRELEASED',
69
author='James Westby <jw+debian@jameswestby.net>',
70
date='Thu, 3 Aug 2006 19:16:22 +0100',
73
cl.add_change(' * Initial packaging.');
75
f = open('debian/changelog', 'wb')
77
cl.write_to_open_file(f)
81
self.run_bzr_error(["The changelog still targets 'UNRELEASED', so "
82
"apparently hasn't been uploaded."], "mark-uploaded")
84
def test_mark_uploaded_already(self):
85
self.make_unuploaded()
86
self.run_bzr("mark-uploaded")
87
self.build_tree(["foo"])
90
self.run_bzr_error(["This version has already been marked uploaded"],
93
def test_mark_uploaded(self):
94
self.make_unuploaded()
95
self.run_bzr("mark-uploaded")
96
tagged_revision = self.wt.branch.tags.lookup_tag('0.1-1')
97
self.assertEqual(tagged_revision, self.wt.branch.last_revision())
99
def test_mark_uploaded_force(self):
100
self.make_unuploaded()
101
self.run_bzr("mark-uploaded")
102
self.build_tree(["foo"])
104
self.wt.commit("two")
105
self.run_bzr("mark-uploaded --force")
106
tagged_revision = self.wt.branch.tags.lookup_tag('0.1-1')
107
self.assertEqual(tagged_revision, self.wt.branch.last_revision())