summaryrefslogtreecommitdiff
path: root/tools/binman/entry_test.py
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2016-12-20 08:42:04 -0500
committerTom Rini <trini@konsulko.com>2016-12-20 08:42:04 -0500
commit36737f22b78a475c6bbc8a0467b51e4d95b52a7d (patch)
tree0983212512bde84015bff16e1e0900c359e004fa /tools/binman/entry_test.py
parent23465119610f47b469a3929c077ece5859f77455 (diff)
parent68af10022442153f6f87958053fee030ad1cb57f (diff)
downloadu-boot-imx-36737f22b78a475c6bbc8a0467b51e4d95b52a7d.zip
u-boot-imx-36737f22b78a475c6bbc8a0467b51e4d95b52a7d.tar.gz
u-boot-imx-36737f22b78a475c6bbc8a0467b51e4d95b52a7d.tar.bz2
Merge git://git.denx.de/u-boot-dm
Diffstat (limited to 'tools/binman/entry_test.py')
-rw-r--r--tools/binman/entry_test.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/binman/entry_test.py b/tools/binman/entry_test.py
new file mode 100644
index 0000000..8a9ae01
--- /dev/null
+++ b/tools/binman/entry_test.py
@@ -0,0 +1,27 @@
+#
+# Copyright (c) 2016 Google, Inc
+# Written by Simon Glass <sjg@chromium.org>
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Test for the Entry class
+
+import collections
+import unittest
+
+import entry
+
+class TestEntry(unittest.TestCase):
+ def testEntryContents(self):
+ """Test the Entry bass class"""
+ base_entry = entry.Entry(None, None, None, read_node=False)
+ self.assertEqual(True, base_entry.ObtainContents())
+
+ def testUnknownEntry(self):
+ """Test that unknown entry types are detected"""
+ Node = collections.namedtuple('Node', ['name', 'path'])
+ node = Node('invalid-name', 'invalid-path')
+ with self.assertRaises(ValueError) as e:
+ entry.Entry.Create(None, node, node.name)
+ self.assertIn("Unknown entry type 'invalid-name' in node "
+ "'invalid-path'", str(e.exception))