def test_writes_source_without_urls(self, conn): source = { 'id': 'id', 'name': 'name', 'type': 'other', } assert writers.write_source(conn, source) is not None
def test_writes_source_with_valid_source_url_and_terms_and_conditions_url(self, conn): source = { 'id': 'id', 'name': 'name', 'type': 'other', 'source_url': 'https://clinicaltrials.gov', 'terms_and_conditions_url': 'https://clinicaltrials.gov/ct2/about-site/terms-conditions', } assert writers.write_source(conn, source) is not None
def test_skips_source_with_invalid_terms_and_conditions_url(self, conn): source = { 'id': 'id', 'name': 'name', 'type': 'other', 'source_url': 'http://example.org', 'terms_and_conditions_url': 'invalid_url', } assert writers.write_source(conn, source) is None
def test_writes_source_without_urls(self): source = { 'id': 'id', 'name': 'name', 'type': 'type', } conn = _get_mock_conn() conn['database']['sources'].find_one.return_value = None assert writers.write_source(conn, source) is not None
def test_writes_source_with_valid_source_url_and_terms_and_conditions_url(self): source = { 'id': 'id', 'name': 'name', 'type': 'type', 'source_url': 'https://clinicaltrials.gov', 'terms_and_conditions_url': 'https://clinicaltrials.gov/ct2/about-site/terms-conditions', } conn = _get_mock_conn() conn['database']['sources'].find_one.return_value = None assert writers.write_source(conn, source) is not None
def test_skips_source_with_invalid_terms_and_conditions_url(self): source = { 'id': 'id', 'name': 'name', 'type': 'type', 'source_url': 'http://example.org', 'terms_and_conditions_url': 'invalid_url', } conn = _get_mock_conn() conn['database']['sources'].find_one.return_value = None assert writers.write_source(conn, source) is None