summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndoni Morales Alastruey <ylatuya@gmail.com>2012-06-25 11:57:14 +0200
committerAndoni Morales Alastruey <ylatuya@gmail.com>2012-06-25 12:27:34 +0200
commit344fbc9721a2e721e831a3c5895e911977ba7ed1 (patch)
tree9938af87cc254a61804e32bd104b18c00d47e568 /test
parentbb092276471acd4cb1b08a26749c62df456b2795 (diff)
Add initial support for application packages
Diffstat (limited to 'test')
-rw-r--r--test/test_build_common.py1
-rw-r--r--test/test_cerbero_packages_package.py49
-rw-r--r--test/test_packages_common.py19
3 files changed, 65 insertions, 4 deletions
diff --git a/test/test_build_common.py b/test/test_build_common.py
index e2cfa608..7a0e08a6 100644
--- a/test/test_build_common.py
+++ b/test/test_build_common.py
@@ -92,6 +92,7 @@ def add_files(tmp):
'README2 '
'README3 '
'README4 '
+ 'README5 '
'bin/gst-launch.exe '
'bin/gst-launch '
'bin/windows.exe '
diff --git a/test/test_cerbero_packages_package.py b/test/test_cerbero_packages_package.py
index dc4e3083..7344a4a2 100644
--- a/test/test_cerbero_packages_package.py
+++ b/test/test_cerbero_packages_package.py
@@ -22,7 +22,7 @@ import tempfile
from cerbero.config import Platform, Distro, DistroVersion
from cerbero.packages import PackageType
-from test.test_packages_common import Package1, Package4, MetaPackage
+from test.test_packages_common import Package1, Package4, MetaPackage, App
from test.test_build_common import create_cookbook, add_files
from test.test_packages_common import create_store
from test.test_common import DummyConfig
@@ -111,8 +111,6 @@ class PackageTest(unittest.TestCase):
self.assertEquals(package.get_sys_deps(), ['python27'])
-
-
class TestMetaPackages(unittest.TestCase):
def setUp(self):
@@ -158,3 +156,48 @@ class TestMetaPackages(unittest.TestCase):
def testAllFilesList(self):
self._compareList('all_files_list')
+
+
+class AppPackageTest(unittest.TestCase):
+
+ def setUp(self):
+ self.tmp = tempfile.mkdtemp()
+ config = Config(self.tmp, Platform.LINUX)
+ self.store = create_store(config)
+ self.cookbook = create_cookbook(config)
+ self.app = App(config, self.store, self.cookbook)
+
+ def tearDown(self):
+ shutil.rmtree(self.tmp)
+
+ def testListFilesWithEmbededDepsOnLinux(self):
+ self.app.embed_deps = True
+ expected = self.app._app_recipe.files_list()
+ result = self.app.files_list()
+ self.assertEquals(expected, result)
+
+ def testListFilesWithEmbededDeps(self):
+ self.app.embed_deps = True
+ self.app.config.target_platform = Platform.WINDOWS
+ files = []
+ packages_deps = [self.store.get_package(x) for x in self.app.deps]
+ for dep in self.app.deps:
+ packages_deps.extend(self.store.get_package_deps(dep))
+ packages_deps = list(set(packages_deps))
+ for package in packages_deps:
+ files.extend(package.files_list())
+ files.extend(self.app._app_recipe.files_list())
+ files = sorted(set(files))
+ self.assertEquals(files, self.app.files_list())
+
+ def testListFilesWithoutEmbededDeps(self):
+ self.app.embed_deps = False
+ expected = self.app._app_recipe.files_list()
+ result = self.app.files_list()
+ self.assertEquals(expected, result)
+
+ def testDevelFilesList(self):
+ self.assertEquals(self.app.devel_files_list(), [])
+
+ def testAllFilesList(self):
+ self.assertEquals(self.app.files_list(), self.app.all_files_list())
diff --git a/test/test_packages_common.py b/test/test_packages_common.py
index 33ff2a70..adc9d385 100644
--- a/test/test_packages_common.py
+++ b/test/test_packages_common.py
@@ -96,6 +96,23 @@ class MetaPackage(package.MetaPackage):
icon = "gstreamer.ico"
+class App(package.App):
+
+ name = "gstreamer-app"
+ shortdesc = "GStreamer sample app"
+ longdesc = "GStreamer sample app"
+ title = "GStreamer sample app"
+ url = "http://www.gstreamer.net"
+ version = '1.0'
+ uuid = '3ffe67b2-4565-411f-8287-e8faa892f853'
+ vendor = "GStreamer Project"
+ org = 'net.gstreamer'
+ app_recipe = 'recipe3'
+ deps = ['gstreamer-test1']
+ icon = "share/images/gstreamer.png"
+ embed_deps = True
+
+
class DummyConfig(object):
pass
@@ -104,7 +121,7 @@ def create_store(config):
cookbook = create_cookbook(config)
store = PackagesStore(config, False)
- for klass in [Package1, Package2, Package3, Package4]:
+ for klass in [Package1, Package2, Package3, Package4, App]:
package = klass(config, store, cookbook)
store.add_package(package)
for klass in [MetaPackage]: