1
# Copyright (C) 2014 Canonical Ltd.
2
# Author: Michael Vogt <michael.vogt@ubuntu.com>
4
# This program is free software: you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; version 3 of the License.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
"""Integration tests for the click CLI buildsource command."""
24
from .helpers import (
30
class TestBuildSource(ClickTestCase):
32
def test_buildsource(self):
33
temp_dir = tempfile.mkdtemp()
34
self.addCleanup(shutil.rmtree, temp_dir)
36
with open(os.path.join(temp_dir, "README"), "w") as f:
37
f.write("I'm a source package")
38
os.mkdir(os.path.join(temp_dir, ".git"))
39
os.mkdir(os.path.join(temp_dir, ".bzr"))
40
os.mkdir(os.path.join(temp_dir, ".normal"))
41
self._create_manifest(os.path.join(temp_dir, "manifest.json"),
42
"srcfoo", "1.2", "ubuntu-sdk-13.10")
43
subprocess.check_call(
44
[self.click_binary, "buildsource", temp_dir],
45
universal_newlines=True)
46
# ensure we have the content we expect
47
source_file = "srcfoo_1.2.tar.gz"
48
tar = tarfile.open(source_file)
50
sorted(tar.getnames()),
51
sorted([".", "./.normal", "./manifest.json", "./README"]))