diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 00cf7fe..70866b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: poetry install -E data_science - name: Run doctests # Forks can't run doctests, requires super user token - if: github.actor == 'pwildenhain' + if: github.triggering_actor == 'pwildenhain' run: | poetry run pytest --doctest-only --doctest-plus - name: Run tests diff --git a/redcap/methods/instruments.py b/redcap/methods/instruments.py index a2aeef4..038aa2d 100644 --- a/redcap/methods/instruments.py +++ b/redcap/methods/instruments.py @@ -27,7 +27,7 @@ def export_instruments( Examples: >>> proj.export_instruments() - [{'instrument_name': 'demo', 'instrument_label': 'Demographics'}] + [{'instrument_name': 'form_1', 'instrument_label': 'Form 1'}] """ payload = self._initialize_payload( content="instrument", format_type=format_type @@ -69,11 +69,11 @@ def export_pdf( If True, then the PDF will be exported in compact display mode. Returns: - Content of the file + Content of the file and dictionary of useful metadata Examples: >>> proj.export_pdf() - b'%PDF-1.3\n3 0 obj\n...' + (b'%PDF-1.3\\n3 0 obj\\n..., {...}) """ # load up payload payload = self._initialize_payload(content="pdf", return_format_type="json") diff --git a/tests/integration/test_long_project.py b/tests/integration/test_long_project.py index cb98e24..adb041e 100644 --- a/tests/integration/test_long_project.py +++ b/tests/integration/test_long_project.py @@ -184,8 +184,12 @@ def test_arms_delete(long_project): @pytest.mark.integration def test_arms_import_override(long_project): - # Cache current events, so they can be restored for subsequent tests - current_events = long_project.export_events() + # Cache current events, so they can be restored for subsequent tests, because arms, events, + # and mappings are deleted when the 'override' parameter is used. + state_dict = { + "events": long_project.export_events(), + "form_event_map": long_project.export_instrument_event_mappings(), + } new_arms = [{"arm_num": 3, "name": "Drug C"}] response = long_project.import_arms(new_arms) @@ -206,9 +210,14 @@ def test_arms_import_override(long_project): with pytest.raises(RedcapError): response = long_project.export_arms() - response = long_project.import_events(current_events) + response = long_project.import_events(state_dict["events"]) assert response == 16 + response = long_project.import_instrument_event_mappings( + state_dict["form_event_map"] + ) + assert response == 44 + response = long_project.export_arms() assert len(response) == 2 @@ -252,7 +261,7 @@ def test_events_delete(long_project): @pytest.mark.integration def test_export_instruments(long_project): - response = long_project.export_events() + response = long_project.export_instruments() assert len(response) == 9 diff --git a/tests/integration/test_simple_project.py b/tests/integration/test_simple_project.py index cfe0475..176f3f2 100644 --- a/tests/integration/test_simple_project.py +++ b/tests/integration/test_simple_project.py @@ -217,8 +217,8 @@ def test_export_field_names_df(simple_project): @pytest.mark.integration def test_export_instruments(simple_project): - events = simple_project.export_events() - assert len(events) == 1 + instruments = simple_project.export_instruments() + assert len(instruments) == 1 @pytest.mark.integration