ACED-IDP / gen3_util

Collection of command line tools to interact with a Gen3 instance
MIT License
3 stars 1 forks source link

addresses issues/49 #63

Closed matthewpeterkort closed 8 months ago

matthewpeterkort commented 9 months ago

see https://github.com/ACED-IDP/gen3_util/issues/49

matthewpeterkort commented 9 months ago

Can you modify the unit test tests.integration.test_init.test_init to verify these files were created? Thank You.

see https://github.com/ACED-IDP/gen3_util/pull/63/commits/4ce7639c66878522324603955f7792822cd83417

matthewpeterkort commented 9 months ago

Can you modify the unit test tests.integration.test_init.test_init to verify these files were created? Thank You.

addressed in https://github.com/ACED-IDP/gen3_util/pull/63/commits/18215c9919a7bb7ebef436e7b1ab8b1cdd0625fd

bwalsh commented 8 months ago

@matthewpeterkort can you run:

I had to make the following changes to run these tests locally. I did not commit the changes.

index 756ad45..f370585 100644
--- a/gen3_util/common/__init__.py
+++ b/gen3_util/common/__init__.py
@@ -30,7 +30,9 @@ Welcome to the data directory! This repository contains important data files for

 ## Important Note: Do Not Check in Protected Files

-Some files in this directory are considered protected and contain sensitive information. **DO NOT** check in or commit these protected files to the version control system (e.g., Git). This is crucial to prevent unauthorized access and to comply with security and privacy policies.
+Some files in this directory are considered protected and contain sensitive information.
+**DO NOT** check in or commit these protected files to the version control system (e.g., Git).
+This is crucial to prevent unauthorized access and to comply with security and privacy policies.

 ## Usage Guidelines:
diff --git a/tests/integration/test_commit.py b/tests/integration/test_commit.py
index a040121..5f5a5c2 100644
--- a/tests/integration/test_commit.py
+++ b/tests/integration/test_commit.py
@@ -57,7 +57,7 @@ def test_init_project(config, program, tmp_path, profile):

     metadata_path = pathlib.Path(tmp_path) / 'META'
     metadata_ls = sorted(str(_.relative_to(tmp_path)) for _ in metadata_path.glob('**/*.*'))
-    expected_metadata_ls = ['META/DocumentReference.ndjson', 'META/Patient.ndjson', 'META/ResearchStudy.ndjson', 'META/ResearchSubject.ndjson']
+    expected_metadata_ls = sorted(['META/.gitignore', 'META/README.md', 'META/DocumentReference.ndjson', 'META/Patient.ndjson', 'META/ResearchStudy.ndjson', 'META/ResearchSubject.ndjson'])
     assert metadata_ls == expected_metadata_ls, f"expected metadata files not found {metadata_ls}"

     result = runner.invoke(cli, f'--format json  --profile {profile} commit -m "test-commit"'.split())
@@ -123,7 +123,7 @@ def add_commit_push(runner: CliRunner, tmp_path, profile, project_id):

     metadata_path = pathlib.Path(tmp_path) / 'META'
     metadata_ls = sorted(str(_.relative_to(tmp_path)) for _ in metadata_path.glob('**/*.*'))
-    expected_metadata_ls = ['META/DocumentReference.ndjson', 'META/Patient.ndjson', 'META/ResearchStudy.ndjson', 'META/ResearchSubject.ndjson']
+    expected_metadata_ls = sorted(['META/.gitignore', 'META/README.md',  'META/DocumentReference.ndjson', 'META/Patient.ndjson', 'META/ResearchStudy.ndjson', 'META/ResearchSubject.ndjson'])
     assert metadata_ls == expected_metadata_ls, f"expected metadata files not found {metadata_ls}"

     result = runner.invoke(cli, f'--format json  --profile {profile} commit -m "test-commit"'.split())
@@ -249,7 +249,7 @@ def test_bundle(config, program, tmp_path):
     study_metadata(config=config, project_id=project_id, output_path=metadata_path,
                    overwrite=False, source='manifest')
     metadata_ls = sorted(str(_.relative_to(tmp_path)) for _ in metadata_path.glob('**/*.*'))
-    expected_metadata_ls = ['META/DocumentReference.ndjson', 'META/Patient.ndjson', 'META/ResearchStudy.ndjson', 'META/ResearchSubject.ndjson']
+    expected_metadata_ls = sorted(['META/.gitignore', 'META/README.md', 'META/DocumentReference.ndjson', 'META/Patient.ndjson', 'META/ResearchStudy.ndjson', 'META/ResearchSubject.ndjson'])
     assert metadata_ls == expected_metadata_ls, f"expected metadata files not found {metadata_ls}"

     # create a bundle
bwalsh commented 8 months ago

Otherwise LGTM:

g3t init test-gitignore
git init
echo test >  .g3t/state/foo
echo test > META/Patient.ndjson
git add .
>>>
Changes to be committed:
  (use "git rm --cached <file>..." to unstage)
        new file:   .g3t/README.md
        new file:   .g3t/config.yaml
        new file:   META/README.md
matthewpeterkort commented 8 months ago

@matthewpeterkort can you run:

see https://github.com/ACED-IDP/gen3_util/pull/63/commits/78a855b0c21148d9f4459f50570cdb6c5b74c84e