2 # Copyright (c) 2000 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
5 # @author Chulwoo Shin <cw1.shin@samsung.com>
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
24 from tic.repo import get_repodata_from_repos
26 CWD = os.path.dirname(__file__) or '.'
27 TEST_REPODATA_LOC=os.path.join(CWD, 'dependency_fixtures')
28 DEFAULT_CACHEDIR='/var/tmp/tic-core/cached'
31 return unittest.makeSuite(RepodataTest)
33 class RepodataTest(unittest.TestCase):
35 # test environment setup
36 self.local_repo = [{'name': 'local_base',
37 'url': 'file:/' + TEST_REPODATA_LOC + '/base'},
38 {'name': 'local_mobile',
39 'url': 'file:/' + TEST_REPODATA_LOC + '/mobile'}]
41 self.remote_repo = [{'name': 'local_base',
42 'url': 'http://download.tizen.org/snapshots/tizen/base/latest/repos/arm64/packages'},
43 {'name': 'local_mobile',
44 'url': 'http://download.tizen.org/snapshots/tizen/mobile/latest/repos/arm64-wayland/packages'}]
47 # clear environment after test
51 def test_local_repodata(self):
52 repodata_list = get_repodata_from_repos(self.local_repo, DEFAULT_CACHEDIR)
54 for repo_info in repodata_list:
55 self.assertNotEqual(repo_info, None)
56 self.assertNotEqual(repo_info.get('repomd'), None)
57 self.assertNotEqual(repo_info.get('primary'), None)
58 if not os.path.exists(repo_info.get('repomd')):
59 raise self.failureException
60 if not os.path.exists(repo_info.get('primary')):
61 raise self.failureException
63 def test_remote_repodata(self):
64 repodata_list = get_repodata_from_repos(self.remote_repo, DEFAULT_CACHEDIR)
66 for repo_info in repodata_list:
67 self.assertNotEqual(repo_info, None)
68 self.assertNotEqual(repo_info.get('repomd'), None)
69 self.assertNotEqual(repo_info.get('primary'), None)
70 if not os.path.exists(repo_info.get('repomd')):
71 raise self.failureException
72 if not os.path.exists(repo_info.get('primary')):
73 raise self.failureException
75 if __name__ == "__main__":
76 #import sys;sys.argv = ['', 'Test.testName']