Ubuntu Pastebin

Paste from asac at Wed, 23 Dec 2015 16:00:39 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
diff --git a/snapcraft/tests/test_plugin_nodejs.py b/snapcraft/tests/test_plugin_nodejs.py
index 912cb78..6fec8c1 100644
--- a/snapcraft/tests/test_plugin_nodejs.py
+++ b/snapcraft/tests/test_plugin_nodejs.py
@@ -58,6 +58,29 @@ class NodePluginTestCase(tests.TestCase):
                 path.join(os.path.abspath('.'), 'parts', 'test-part', 'npm')),
             mock.call().pull()])
 
+    def test_build_local_sources_and_node_folder(self):
+        class Options:
+            source = '.'
+            node_packages = []
+            node_folder = [ 'subdir' ]
+
+        plugin = nodejs.NodePlugin('test-part', Options())
+
+        os.makedirs(plugin.sourcedir)
+        os.makedirs(os.path.join(plugin.sourcedir, plugin.node_folder))
+        open(os.path.join(plugin.sourcedir, plugin.node_folder,
+                          'package.json'), 'w').close()
+
+        plugin.build()
+
+        self.run_mock.assert_has_calls([
+            mock.call(['npm', 'install', '-g'], cwd=plugin.builddir)])
+        self.tar_mock.assert_has_calls([
+            mock.call(
+                nodejs._get_nodejs_release(),
+                path.join(os.path.abspath('.'), 'parts', 'test-part', 'npm')),
+            mock.call().provision(plugin.installdir)])
+
     def test_build_local_sources(self):
         class Options:
             source = '.'
Download as text