diff --git a/clinicaltrials/frontend/tests/fixtures/data.zip b/clinicaltrials/frontend/tests/fixtures/data.zip deleted file mode 100644 index 10d1df4..0000000 Binary files a/clinicaltrials/frontend/tests/fixtures/data.zip and /dev/null differ diff --git a/clinicaltrials/frontend/tests/fixtures/expected_trials_data.csv b/clinicaltrials/frontend/tests/fixtures/expected_trials_data.csv deleted file mode 100644 index 358799d..0000000 --- a/clinicaltrials/frontend/tests/fixtures/expected_trials_data.csv +++ /dev/null @@ -1,6 +0,0 @@ -nct_id,act_flag,included_pact_flag,has_results,pending_results,pending_data,has_certificate,results_due,start_date,available_completion_date,used_primary_completion_date,defaulted_pcd_flag,defaulted_cd_flag,results_submitted_date,last_updated_date,certificate_date,phase,enrollment,location,study_status,study_type,primary_purpose,sponsor,sponsor_type,collaborators,exported,fda_reg_drug,fda_reg_device,is_fda_regulated,url,title,official_title,brief_title,discrep_date_status,late_cert,defaulted_date,condition,condition_mesh,intervention,intervention_mesh,keywords -NCT01275365,0,1,1,0,,0,1,2011-05-31,2017-01-19,1,0,0,2018-01-19,2018-01-19,,Phase 3,92,"{""country"":""United States""}",Completed,Interventional,Treatment,Brigham and Women's Hospital,Other,,,,,1,https://clinicaltrials.gov/show/NCT01275365,Optimizing Protein Intake in Older Americans With Mobility Limitations,Optimizing Protein Intake in Older Americans With Mobility Limitations,Optimizing Protein Intake in Older Americans With Mobility Limitations,0,0,0,"""Mobility Limitation""","{""mesh_term"":""Mobility Limitation""}","[{""intervention_type"":""Drug"",""intervention_name"":""Testosterone enanthate"",""description"":""Testosterone enanthate 100 mg intramuscularly weekly"",""arm_group_label"":""Testosterone/Low Protein""},{""intervention_type"":""Drug"",""intervention_name"":""Testosterone enanthate"",""description"":""Testosterone enanthate 100 mg intramuscularly weekly"",""arm_group_label"":""Testosterone/High Protein""}]","{""mesh_term"":[""Testosterone"",""Testosterone enanthate"",""Testosterone undecanoate"",""Testosterone 17 beta-cypionate"",""Methyltestosterone""]}","[""Mobility Limitation"",""Low Protein Intake"",""Older Men"",""Testosterone""]" -NCT02251236,0,1,0,0,,0,1,2016-01-31,2017-01-18,1,0,0,,2017-05-22,,N/A,14,"{""country"":""United States""}",Completed,Interventional,Treatment,"University of California, San Diego",Other,"[{""agency"":""Gilead Sciences"",""agency_class"":""Industry""},{""agency"":""University at Buffalo"",""agency_class"":""Other""}]",,,,1,https://clinicaltrials.gov/show/NCT02251236,Elvitegravir (EVG) Cerebrospinal Fluid (CSF) Pharmacokinetics in HIV-Infected Individuals,Elvitegravir (EVG) Cerebrospinal Fluid (CSF) Pharmacokinetics in HIV-Infected Individuals,Elvitegravir (EVG) Cerebrospinal Fluid (CSF) Pharmacokinetics in HIV-Infected Individuals,0,0,0,"""HIV""",,"[{""intervention_type"":""Drug"",""intervention_name"":""Stribild"",""description"":""To be administered orally, once daily with food."",""arm_group_label"":[""Track A"",""Track B""],""other_name"":""Co-formulated elvitegravir/ cobicistat/ emtricitabine/ tenofovir disoproxil fumarate""},{""intervention_type"":""Drug"",""intervention_name"":""Genvoya"",""description"":""To be administered orally, once daily with food."",""arm_group_label"":[""Track A"",""Track B""],""other_name"":""Co-formulated elvitegravir/ cobicistat/ emtricitabine/ tenofovir alafenamide""}]","{""mesh_term"":[""Tenofovir"",""Emtricitabine"",""Emtricitabine, Tenofovir Disoproxil Fumarate Drug Combination"",""Cobicistat"",""Elvitegravir, Cobicistat, Emtricitabine, Tenofovir Disoproxil Fumarate Drug Combination""]}","[""Stribild"",""Genvoya"",""elvitegravir"",""Cerebrospinal Fluid"",""HIV""]" -NCT01891968,0,1,0,0,,0,1,2013-08-07,2017-01-18,1,0,0,,2017-01-24,,Phase 2,15,"{""country"":""United States""}",Completed,Interventional,Treatment,M.D. Anderson Cancer Center,Other,"{""agency"":""Millennium Pharmaceuticals, Inc."",""agency_class"":""Industry""}",,,,1,https://clinicaltrials.gov/show/NCT01891968,Phase II Study of Subcutaneous Bortezomib for Patients With Low or Intermediate-1 Risk Myelodysplastic Syndrome,Phase II Study of Subcutaneous Bortezomib for Patients With Low or Intermediate-1 Risk Myelodysplastic Syndrome,Bortezomib for Low or Intermediate-1 Myelodysplastic Syndrome (MDS) With p65 Activation,0,0,0,"""Leukemia""","{""mesh_term"":[""Myelodysplastic Syndromes"",""Preleukemia""]}","{""intervention_type"":""Drug"",""intervention_name"":""Bortezomib"",""description"":""1.3 mg/m2 subcutaneously on days 1, 4, 8 and 11 of a 28 day cycle."",""arm_group_label"":""Bortezomib"",""other_name"":[""Velcade"",""LDP-341"",""MLN341"",""PS-341""]}","{""mesh_term"":""Bortezomib""}","[""Leukemia"",""Myelodysplastic syndrome"",""MDS"",""Low or intermediate-1"",""Bortezomib"",""Velcade"",""LDP-341"",""MLN341"",""PS-341""]" -NCT03400163,0,1,0,0,,1,0,2015-05-08,2017-01-18,1,0,0,,2018-01-17,2018-01-17,Phase 2,3,"{""country"":""United States""}",Completed,Interventional,Treatment,Bristol-Myers Squibb,Industry,,,Yes,No,,https://clinicaltrials.gov/show/NCT03400163,"A Randomized, Double-Blind, Placebo-Controlled, Parallel Group, Multiple Dose Sub-study to Evaluate the Safety, Pharmacokinetics and Pharmacodynamic Effects of BMS-986036 in Adults With Non-alcoholic Steatohepatitis","A Randomized, Double-Blind, Placebo-Controlled, Parallel Group, Multiple Dose Sub-study to Evaluate the Safety, Pharmacokinetics and Pharmacodynamic Effects of BMS-986036 in Adults With Non-alcoholic Steatohepatitis",A Sub-study of BMS-986036 in Subjects With Non-Alcoholic Steatohepatitis (NASH),0,0,0,"""Non-Alcoholic Steatohepatitis""","{""mesh_term"":[""Fatty Liver"",""Non-alcoholic Fatty Liver Disease""]}","[{""intervention_type"":""Drug"",""intervention_name"":""BMS-986036"",""description"":""BMS-986036 20 mg QD"",""arm_group_label"":""Treatment Group D:""},{""intervention_type"":""Drug"",""intervention_name"":""Placebo"",""description"":""Placebo QD"",""arm_group_label"":""Treatment Group E:""}]",,"[""First Line Therapy"",""NASH""]" -NCT02413372,0,1,0,0,,1,0,2015-05-08,2017-01-18,1,0,0,,2018-01-17,2018-01-17,Phase 2,202,"{""country"":""United States""}",Completed,Interventional,Treatment,Bristol-Myers Squibb,Industry,,,Yes,No,1,https://clinicaltrials.gov/show/NCT02413372,"A Randomized, Double-Blind, Placebo-Controlled, Parallel Group, Multiple Dose Study to Evaluate the Safety, Pharmacokinetics and Pharmacodynamic Effects of BMS-986036 in Adults With Non-alcoholic Steatohepatitis","A Randomized, Double-Blind, Placebo-Controlled, Parallel Group, Multiple Dose Study to Evaluate the Safety, Pharmacokinetics and Pharmacodynamic Effects of BMS-986036 in Adults With Non-alcoholic Steatohepatitis",A Study of BMS-986036 in Subjects With Non-Alcoholic Steatohepatitis (NASH),0,0,0,"""Non-Alcoholic Steatohepatitis""","{""mesh_term"":[""Fatty Liver"",""Non-alcoholic Fatty Liver Disease""]}","[{""intervention_type"":""Drug"",""intervention_name"":""BMS-986036"",""arm_group_label"":""Treatment Group A: BMS-986036""},{""intervention_type"":""Drug"",""intervention_name"":""BMS-986036"",""arm_group_label"":""Treatment Group B: BMS-986036""},{""intervention_type"":""Drug"",""intervention_name"":""Placebo"",""arm_group_label"":""Treatment Group C: Placebo""}]",,"[""First Line Therapy"",""NASH""]" diff --git a/clinicaltrials/frontend/tests/test_load_data.py b/clinicaltrials/frontend/tests/test_load_data.py deleted file mode 100644 index 1e87a2b..0000000 --- a/clinicaltrials/frontend/tests/test_load_data.py +++ /dev/null @@ -1,53 +0,0 @@ -"""Integration test for load_data.py script -""" -import csv -import os -import shutil -import tempfile -from datetime import date -from unittest import mock -from django.conf import settings -from django.core.management import call_command -from django.test import TestCase -from django.test.utils import override_settings -from unittest.mock import patch -import pathlib - - -CMD_ROOT = 'frontend.management.commands.load_data' - - -def wget_copy_fixture(data_file, url): - test_zip = os.path.join( - settings.BASE_DIR, 'frontend/tests/fixtures/data.zip') - shutil.copy(test_zip, data_file) - - -class LoadTestCase(TestCase): - @patch(CMD_ROOT + '.wget_file', side_effect=wget_copy_fixture) - @patch(CMD_ROOT + '.notify_slack') - @patch(CMD_ROOT + '.process_data') - @override_settings( - STORAGE_PREFIX='clinicaltrials_test/', - PROCESSING_ENV_PATH=os.path.join( - settings.BASE_DIR, '../environment-example'), - PROCESSING_VENV_BIN='', - PROCESSING_STORAGE_TABLE_NAME='current_raw_json_test', - WORKING_VOLUME=os.path.join(tempfile.gettempdir(), 'fdaaa_data'), - WORKING_DIR=os.path.join(tempfile.gettempdir(), 'fdaaa_data', 'work'), - INTERMEDIATE_CSV_PATH=os.path.join(tempfile.gettempdir(), 'clinical_trials.csv') - ) - def test_produces_csv(self, process_mock, slack_mock, wget_file_mock): - fdaaa_web_data = os.path.join(tempfile.gettempdir(), 'fdaaa_data') - pathlib.Path(fdaaa_web_data).mkdir(exist_ok=True) - - args = [] - opts = {} - call_command('load_data', *args, **opts) - expected_csv = os.path.join( - settings.BASE_DIR, 'frontend/tests/fixtures/expected_trials_data.csv') - with open(settings.INTERMEDIATE_CSV_PATH) as output_file: - with open(expected_csv) as expected_file: - results = sorted(list(csv.reader(output_file))) - expected = sorted(list(csv.reader(expected_file))) - self.assertEqual(results, expected)