19 """ |
19 """ |
20 import unittest |
20 import unittest |
21 import string |
21 import string |
22 import sys,os |
22 import sys,os |
23 import shutil |
23 import shutil |
24 import __init__ |
|
25 from testautomation.base_testcase import BaseTestCase |
24 from testautomation.base_testcase import BaseTestCase |
26 |
25 |
27 from cone.public import exceptions, api |
26 from cone.public import exceptions, api |
28 from cone.confml.model import ConfmlMeta, ConfmlDescription |
27 from cone.confml.model import ConfmlMeta, ConfmlDescription |
29 from cone.storage.filestorage import FileStorage |
28 from cone.storage.filestorage import FileStorage |
55 self.project = api.Project(api.Storage.open(datafolder)) |
54 self.project = api.Project(api.Storage.open(datafolder)) |
56 |
55 |
57 def test_list_configurations(self): |
56 def test_list_configurations(self): |
58 confs = self.project.list_configurations() |
57 confs = self.project.list_configurations() |
59 self.assertTrue(confs) |
58 self.assertTrue(confs) |
60 self.assertEquals(confs[0],"morestuff.confml") |
59 self.assertEquals(sorted(confs), sorted(['morestuff.confml', 'prodX.confml', 'simple.confml'])) |
61 |
60 |
62 def test_get_configuration(self): |
61 def test_get_configuration(self): |
63 conf = self.project.get_configuration("morestuff.confml") |
62 conf = self.project.get_configuration("morestuff.confml") |
64 self.assertTrue(conf) |
63 self.assertTrue(conf) |
65 self.assertTrue(isinstance(conf,api.ConfigurationProxy)) |
64 self.assertTrue(isinstance(conf,api.ConfigurationProxy)) |
73 |
72 |
74 def test_get_configuration_and_list_layers(self): |
73 def test_get_configuration_and_list_layers(self): |
75 conf = self.project.get_configuration("morestuff.confml") |
74 conf = self.project.get_configuration("morestuff.confml") |
76 layers = conf.list_configurations() |
75 layers = conf.list_configurations() |
77 self.assertTrue(layers) |
76 self.assertTrue(layers) |
78 self.assertEquals(layers[0],'platform/s60/root.confml') |
77 self.assertEquals(sorted(layers), |
79 self.assertEquals(layers[1],'familyX/root.confml') |
78 sorted(['platform/s60/root.confml', |
|
79 'familyX/root.confml', |
|
80 'familyX/prodX/root.confml'])) |
80 |
81 |
81 def test_get_is_configuration(self): |
82 def test_get_is_configuration(self): |
82 self.assertTrue(self.project.is_configuration("morestuff.confml")) |
83 self.assertTrue(self.project.is_configuration("morestuff.confml")) |
83 # TODO: this is not working at the moment due to performance problem in |
84 # TODO: this is not working at the moment due to performance problem in |
84 # Project.list_all_configurations() |
85 # Project.list_all_configurations() |
124 self.assertEquals(config.get_path(),'familyX/prodX/root.confml') |
125 self.assertEquals(config.get_path(),'familyX/prodX/root.confml') |
125 |
126 |
126 def test_get_all_resources(self): |
127 def test_get_all_resources(self): |
127 conf = self.project.get_configuration("morestuff.confml") |
128 conf = self.project.get_configuration("morestuff.confml") |
128 resources = conf.get_all_resources() |
129 resources = conf.get_all_resources() |
129 self.assertEquals(resources[0].get_path(),'morestuff.confml') |
130 paths = [r.get_path() for r in resources] |
130 self.assertEquals(resources[1].get_path(),'platform/s60/root.confml') |
131 self.assertTrue('morestuff.confml' in paths) |
|
132 self.assertTrue('platform/s60/root.confml' in paths) |
131 |
133 |
132 def test_list_confmls(self): |
134 def test_list_confmls(self): |
133 conf = self.project.get_configuration("morestuff.confml") |
135 conf = self.project.get_configuration("morestuff.confml") |
134 confmls = conf.list_resources() |
136 confmls = conf.list_resources() |
135 self.assertEquals(confmls[0],'morestuff.confml') |
137 self.assertTrue('morestuff.confml' in confmls ) |
136 self.assertEquals(confmls[1],'platform/s60/root.confml') |
138 self.assertTrue('platform/s60/root.confml' in confmls) |
137 |
139 |
138 def test_list_implmls(self): |
140 def test_list_implmls(self): |
139 conf = self.project.get_configuration("morestuff.confml") |
141 conf = self.project.get_configuration("morestuff.confml") |
140 implmls = conf.get_configuration('platform/s60/root.confml').get_layer().list_implml() |
142 implmls = conf.get_configuration('platform/s60/root.confml').get_layer().list_implml() |
141 self.assertEquals(implmls[0],'implml/accessoryserver_1020505A.crml') |
143 self.assertTrue('implml/accessoryserver_1020505A.crml' in implmls) |
142 |
144 |
143 # def test_list_content(self): |
145 # def test_list_content(self): |
144 # conf = self.project.get_configuration("morestuff.confml") |
146 # conf = self.project.get_configuration("morestuff.confml") |
145 # contents = conf.list_content() |
147 # contents = conf.list_content() |
146 # self.assertEquals(contents[0],'platform/s60/content/.svn/all-wcprops') |
148 # self.assertEquals(contents[0],'platform/s60/content/.svn/all-wcprops') |