Skip to content

Commit

Permalink
rust plugin: mock downloads in unit tests (#713)
Browse files Browse the repository at this point in the history
LP: #1610996

Signed-off-by: Sergio Schvezov <[email protected]>
  • Loading branch information
sergiusens authored Aug 8, 2016
1 parent b869650 commit c8e8e3c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion snapcraft/tests/test_plugin_rust.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ def test_build(self, run_mock):
'--root', plugin.installdir], env=plugin._build_env())
])

@mock.patch.object(rust.sources, 'Script')
@mock.patch.object(rust.RustPlugin, 'run')
def test_pull(self, run_mock):
def test_pull(self, run_mock, script_mock):
plugin = rust.RustPlugin('test-part', self.options,
self.project_options)
os.makedirs(plugin.sourcedir)
Expand All @@ -91,3 +92,8 @@ def test_pull(self, run_mock):
"--prefix=%s" % plugin._rustpath,
"--disable-sudo", "--save"])
])

rustdir = os.path.join(plugin.partdir, 'rust')
run_mock.assert_called_once_with([
os.path.join(rustdir, 'rustup.sh'), '--prefix={}'.format(rustdir),
'--disable-sudo', '--save'])

0 comments on commit c8e8e3c

Please sign in to comment.