Tao Bao | c9c1b86 | 2019-06-26 14:54:14 -0700 | [diff] [blame] | 1 | # |
| 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 | |
| 17 | import os.path |
| 18 | |
| 19 | import common |
| 20 | import sign_apex |
| 21 | import test_utils |
| 22 | |
| 23 | |
| 24 | class 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 Bao | 1ac886e | 2019-06-26 11:58:22 -0700 | [diff] [blame] | 38 | 'avbtool', |
Tao Bao | c9c1b86 | 2019-06-26 14:54:14 -0700 | [diff] [blame] | 39 | foo_apex, |
| 40 | payload_key, |
| 41 | container_key) |
| 42 | self.assertTrue(os.path.exists(signed_foo_apex)) |