From fdf52f5402d4b395fa0821c970a17be50fd268fb Mon Sep 17 00:00:00 2001
From: Daniel Nemergut <dnemergu@nrao.edu>
Date: Fri, 19 Apr 2024 15:20:34 -0400
Subject: [PATCH] Added a test for copying a flagtargetstemplate.txt into
 rawdata

---
 .../pexable/casa_envoy/test/test_foundation.py      | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/apps/cli/executables/pexable/casa_envoy/test/test_foundation.py b/apps/cli/executables/pexable/casa_envoy/test/test_foundation.py
index 5cd788ee4..38ff68fba 100644
--- a/apps/cli/executables/pexable/casa_envoy/test/test_foundation.py
+++ b/apps/cli/executables/pexable/casa_envoy/test/test_foundation.py
@@ -78,6 +78,19 @@ class TestGeneralFoundation:
         general.data_foundation()
         assert mock_copy.call_count == 2
 
+    @patch("pathlib.Path.glob", return_value=["TSKY0001_split.flagtargetstemplate.txt"])
+    @patch("pathlib.Path.exists", return_value=True)
+    @patch("shutil.copy")
+    def test_general_copy_into_rawdata(self, mock_copy, mock_exists, mock_glob):
+        general.copy_into_rawdata()
+        assert mock_exists.call_count == 1
+        assert mock_copy.call_count == 1
+        assert mock_glob.call_count == 1
+
+        # Ensure copy was called on the expected files
+        rawdata_dir_path = Path('/lustre/aoc/cluster/pipeline/docker/workspaces/spool/tmpo1ca1pp_/rawdata')
+        mock_copy.assert_any_call("TSKY0001_split.flagtargetstemplate.txt", rawdata_dir_path)
+
 
 class TestRestoreFoundation:
     """
-- 
GitLab