Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@pytest.mark.vcr
def test_download_case_by_id(self):
case = download_case(cap_id=4066790, many=False)
assert case["name_abbreviation"] == "Oracle America, Inc. v. Google Inc."
@pytest.mark.vcr()
def test_instance_peers(api):
assert len(api.instance_peers()) == 0
@pytest.mark.vcr()
def test_repositories_create_success(admin, repository):
assert isinstance(repository, dict)
r = repository
check(r, 'createdTime', str)
check(r, 'dataFormat', str)
check(r, 'description', str)
check(r, 'downloadFormat', str)
check(r, 'id', str)
check(r, 'lastSyncTime', str)
check(r, 'lastVulnUpdate', str)
check(r, 'modifiedTime', str)
check(r, 'name', str)
check(r, 'organizations', list)
check(r, 'remoteID', str, allow_none=True)
check(r, 'remoteIP', str, allow_none=True)
check(r, 'running', str)
@pytest.mark.vcr()
def test_scan_instances_copy_success(sc, scaninstance):
newscan = sc.scan_instances.copy(int(scaninstance['id']), 1)
@pytest.mark.vcr()
def test_credentials_share_success(sc, cred, group):
c = sc.credentials.share(int(cred['id']), int(group['id']))
assert isinstance(c, dict)
check(c, 'id', str)
check(c, 'type', str)
check(c, 'name', str)
check(c, 'description', str)
check(c, 'tags', str)
check(c, 'createdTime', str)
check(c, 'modifiedTime', str)
check(c, 'typeFields', dict)
check(c['typeFields'], 'username', str)
check(c['typeFields'], 'password', str)
check(c, 'groups', list)
check(c, 'canUse', str)
check(c, 'canManage', str)
@pytest.mark.vcr(filter_headers=["authorization"])
def test_authorize_and_save_customer_id(
payment_dummy, sandbox_braintree_gateway_config
):
CUSTOMER_ID = "595109854" # retrieved from sandbox
payment = payment_dummy
payment_info = create_payment_information(payment, "fake-valid-nonce")
payment_info.amount = 100.00
payment_info.reuse_source = True
sandbox_braintree_gateway_config.store_customer = True
response = authorize(payment_info, sandbox_braintree_gateway_config)
assert not response.error
assert response.customer_id == CUSTOMER_ID
@pytest.mark.vcr()
def test_status_context(status, api):
context = api.status_context(status['id'])
assert context
@pytest.mark.vcr()
def test_exports_assets_sources_typeerror(api):
with pytest.raises(TypeError):
api.exports.assets(sources=1)
@pytest.mark.vcr()
def test_html_response(snapshot):
google = Google()
snapshot.assert_match(snap(google.go("/?q=formation")))
# force error
snapshot.assert_match(snap(google.go("/aint-no-body-here")))
@pytest.mark.vcr
@pytest.mark.scihub
def test_product_flag(run_cli, geojson_path):
result = run_cli(
"--geometry",
geojson_path,
"--url",
"https://scihub.copernicus.eu/apihub/",
"-s",
"20161201",
"-e",
"20161202",
"--producttype",
"SLC",
)
expected = "Product 2223103a-3754-473d-9a29-24ef8efa2880 - Date: 2016-12-01T09:30:22.149Z, Instrument: SAR-C SAR, Mode: VV VH, Satellite: Sentinel-1, Size: 7.98 GB"