Ejemplo n.º 1
0
 def test_error_in_artifact_copy_raises_action_error(self):
     self.os_utils.exists.return_value = True
     self.os_utils.copytree.side_effect = Exception("copy failed!")
     action = JavaMavenCopyArtifactsAction(self.scratch_dir,
                                           self.artifacts_dir,
                                           self.os_utils)
     with self.assertRaises(ActionFailedError) as raised:
         action.execute()
     self.assertEquals(raised.exception.args[0], "copy failed!")
Ejemplo n.º 2
0
 def test_missing_required_target_class_directory_raises_action_error(self):
     self.os_utils.exists.return_value = False
     action = JavaMavenCopyArtifactsAction(self.scratch_dir,
                                           self.artifacts_dir,
                                           self.os_utils)
     with self.assertRaises(ActionFailedError) as raised:
         action.execute()
     self.assertEquals(
         raised.exception.args[0],
         "Required target/classes directory was not "
         "produced from 'mvn package'")
Ejemplo n.º 3
0
    def test_copies_artifacts_no_deps(self):
        self.os_utils.exists.return_value = True
        self.os_utils.copytree.side_effect = lambda src, dst: None
        self.os_utils.copy.side_effect = lambda src, dst: None

        action = JavaMavenCopyArtifactsAction(self.scratch_dir,
                                              self.artifacts_dir,
                                              self.os_utils)
        action.execute()

        self.os_utils.copytree.assert_has_calls([
            call(os.path.join(self.scratch_dir, 'target', 'classes'),
                 self.artifacts_dir)
        ])
Ejemplo n.º 4
0
    def test_copies_artifacts_with_deps(self):
        self.os_utils.exists.return_value = True
        self.os_utils.copytree.side_effect = lambda src, dst: None
        self.os_utils.copy.side_effect = lambda src, dst: None
        os.path.join(self.scratch_dir, "target", "dependency")

        action = JavaMavenCopyArtifactsAction(self.scratch_dir,
                                              self.artifacts_dir,
                                              self.os_utils)
        action.execute()
        self.os_utils.copytree.assert_has_calls([
            call(os.path.join(self.scratch_dir, "target", "classes"),
                 self.artifacts_dir),
            call(os.path.join(self.scratch_dir, "target", "dependency"),
                 os.path.join(self.artifacts_dir, "lib")),
        ])