1
# -*- coding: utf-8 -*-
3
# Copyright (C) 2015 Canonical Ltd.
4
# Author: Łukasz 'sil2100' Zemczak <lukasz.zemczak@ubuntu.com>
6
# This program 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; version 3 of the License.
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with this program. If not, see <http://www.gnu.org/licenses/>.
27
from systemimage.helpers import chdir
28
from systemimage.testing.helpers import HAS_TEST_KEYS, MISSING_KEYS_WARNING
31
class TagImageScriptTests(unittest.TestCase):
33
bin_dir = os.path.dirname(os.path.dirname(__file__))
34
self.script_name = "tag-image"
35
self.script = imp.load_source(
37
os.path.join(bin_dir, self.script_name))
39
def test_set_tag(self):
40
"""Set a basic tag."""
41
version_detail_list = [
42
"device=20150821-736d127",
43
"custom=20150925-901-35-40-vivid",
44
"keyring=archive-master",
46
self.script.set_tag(version_detail_list, "OTA-x")
47
self.assertTrue("tag=OTA-x" in version_detail_list)
48
size = len([x for x in version_detail_list if x.startswith("tag=")])
49
self.assertEqual(size, 1)
51
def test_set_tag_rewrite(self):
52
"""Make sure tags can be rewritten."""
53
version_detail_list = [
54
"device=20150821-736d127",
55
"custom=20150925-901-35-40-vivid",
57
"keyring=archive-master",
60
self.script.set_tag(version_detail_list, "OTA-x")
61
self.assertTrue("tag=OTA-x" in version_detail_list)
62
size = len([x for x in version_detail_list if x.startswith("tag=")])
63
self.assertEqual(size, 1)
65
# @unittest.skipUnless(HAS_TEST_KEYS, MISSING_KEYS_WARNING)
66
# def test_channels(self):
b'\\ No newline at end of file'