2 # Copyright (c) 2016 Samsung Electronics Co., Ltd
4 # Licensed under the Flora License, Version 1.1 (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
8 # http://floralicense.org/license/
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.
21 from tic.repo import get_repodata_from_repos
23 CWD = os.path.dirname(__file__) or '.'
24 TEST_REPODATA_LOC=os.path.join(CWD, 'dependency_fixtures')
25 DEFAULT_CACHEDIR='/var/tmp/tic-core/cached'
28 return unittest.makeSuite(RepodataTest)
30 class RepodataTest(unittest.TestCase):
32 # test environment setup
33 self.local_repo = [{'name': 'local_base',
34 'url': 'file:/' + TEST_REPODATA_LOC + '/base'},
35 {'name': 'local_mobile',
36 'url': 'file:/' + TEST_REPODATA_LOC + '/mobile'}]
38 self.remote_repo = [{'name': 'local_base',
39 'url': 'http://download.tizen.org/snapshots/tizen/base/latest/repos/arm64/packages'},
40 {'name': 'local_mobile',
41 'url': 'http://download.tizen.org/snapshots/tizen/mobile/latest/repos/arm64-wayland/packages'}]
44 # clear environment after test
48 def test_local_repodata(self):
49 repodata_list = get_repodata_from_repos(self.local_repo, DEFAULT_CACHEDIR)
51 for repo_info in repodata_list:
52 self.assertNotEqual(repo_info, None)
53 self.assertNotEqual(repo_info.get('repomd'), None)
54 self.assertNotEqual(repo_info.get('primary'), None)
55 if not os.path.exists(repo_info.get('repomd')):
56 raise self.failureException
57 if not os.path.exists(repo_info.get('primary')):
58 raise self.failureException
60 def test_remote_repodata(self):
61 repodata_list = get_repodata_from_repos(self.remote_repo, DEFAULT_CACHEDIR)
63 for repo_info in repodata_list:
64 self.assertNotEqual(repo_info, None)
65 self.assertNotEqual(repo_info.get('repomd'), None)
66 self.assertNotEqual(repo_info.get('primary'), None)
67 if not os.path.exists(repo_info.get('repomd')):
68 raise self.failureException
69 if not os.path.exists(repo_info.get('primary')):
70 raise self.failureException
72 if __name__ == "__main__":
73 #import sys;sys.argv = ['', 'Test.testName']