示例#1
0
    def test_pull_snap_file_must_extract(self):
        snap_source = sources.Snap(self.test_file_path, self.dest_dir)
        snap_source.pull()

        self.assertThat(os.path.join(self.dest_dir, "meta.basic"), DirExists())
        self.assertThat(os.path.join(self.dest_dir, "meta.basic", "snap.yaml"),
                        FileExists())
示例#2
0
    def test_pull_snap_must_not_clean_targets(self, mock_provision):
        snap_source = sources.Snap(self.test_file_path, self.dest_dir)
        snap_source.pull()

        mock_provision.assert_called_once_with(
            self.dest_dir,
            clean_target=False,
            src=os.path.join(self.dest_dir, "test-snap.snap"),
        )
示例#3
0
 def test_pull_failure_bad_unsquash(self, mock_run):
     snap_source = sources.Snap(self.test_file_path, self.dest_dir)
     raised = self.assertRaises(sources.errors.SnapcraftPullError,
                                snap_source.pull)
     self.assertThat(
         raised.command,
         MatchesRegex(
             r"unsquashfs -force -dest {0}/\w+ {0}/dst/test-snap.snap".
             format(self.path)),
     )
     self.assertThat(raised.exit_code, Equals(1))