blob: b4ef1271420572dffe2430cdb49aff11e25bd7d0 [file] [log] [blame]
Tao Baoc9c1b862019-06-26 14:54:14 -07001#
2# Copyright (C) 2019 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17import os.path
18
19import common
20import sign_apex
21import test_utils
22
23
24class SignApexTest(test_utils.ReleaseToolsTestCase):
25
26 def setUp(self):
27 self.testdata_dir = test_utils.get_testdata_dir()
28 self.assertTrue(os.path.exists(self.testdata_dir))
29
30 common.OPTIONS.search_path = test_utils.get_search_path()
31
32 @test_utils.SkipIfExternalToolsUnavailable()
33 def test_SignApexFile(self):
34 foo_apex = os.path.join(self.testdata_dir, 'foo.apex')
35 payload_key = os.path.join(self.testdata_dir, 'testkey_RSA4096.key')
36 container_key = os.path.join(self.testdata_dir, 'testkey')
37 signed_foo_apex = sign_apex.SignApexFile(
Tao Bao1ac886e2019-06-26 11:58:22 -070038 'avbtool',
Tao Baoc9c1b862019-06-26 14:54:14 -070039 foo_apex,
40 payload_key,
41 container_key)
42 self.assertTrue(os.path.exists(signed_foo_apex))