|
| 1 | +import os |
| 2 | + |
1 | 3 | import requests |
2 | 4 | import pytest |
3 | 5 |
|
| 6 | +from labelbox import Client |
| 7 | + |
4 | 8 |
|
5 | | -@pytest.mark.skip("Can only be tested in specific organizations.") |
6 | | -def test_default_integration(client): |
7 | | - # This tests assumes the following: |
8 | | - # 1. gcp delegated access is configured to work with utkarsh-da-test-bucket |
9 | | - # 2. the integration name is gcp test |
10 | | - # 3. This integration is the default |
| 9 | +@pytest.mark.skipif(os.environ.get("DA_GCP_LABELBOX_API_KEY") is None, |
| 10 | + reason="DA_GCP_LABELBOX_API_KEY not found") |
| 11 | +def test_default_integration(): |
| 12 | + """ |
| 13 | + This tests assumes the following: |
| 14 | + 1. gcp delegated access is configured to work with jtso-gcs-sdk-da-tests |
| 15 | + 2. the integration name is gcs sdk test bucket |
| 16 | + 3. This integration is the default |
| 17 | + |
| 18 | + Currently tests against: |
| 19 | + Org ID: cl269lvvj78b50zau34s4550z |
| 20 | + Email: jtso+gcp_sdk_tests@labelbox.com""" |
| 21 | + client = Client(api_key=os.environ.get("DA_GCP_LABELBOX_API_KEY")) |
11 | 22 | ds = client.create_dataset(name="new_ds") |
12 | 23 | dr = ds.create_data_row( |
13 | 24 | row_data= |
14 | | - "gs://utkarsh-da-test-bucket/mathew-schwartz-8rj4sz9YLCI-unsplash.jpg") |
| 25 | + "gs://jtso-gcs-sdk-da-tests/nikita-samokhin-D6QS6iv_CTY-unsplash.jpg") |
15 | 26 | assert requests.get(dr.row_data).status_code == 200 |
16 | | - assert ds.iam_integration().name == "GCP Test" |
| 27 | + assert ds.iam_integration().name == "gcs sdk test bucket" |
17 | 28 | ds.delete() |
18 | 29 |
|
19 | 30 |
|
20 | | -@pytest.mark.skip("Can only be tested in specific organizations.") |
21 | | -def test_non_default_integration(client): |
22 | | - # This tests assumes the following: |
23 | | - # 1. aws delegated access is configured to work with lbox-test-bucket |
24 | | - # 2. an integration called aws is available to the org |
| 31 | +@pytest.mark.skipif(os.environ.get("DA_GCP_LABELBOX_API_KEY") is None, |
| 32 | + reason="DA_GCP_LABELBOX_API_KEY not found") |
| 33 | +def test_non_default_integration(): |
| 34 | + """ |
| 35 | + This tests assumes the following: |
| 36 | + 1. aws delegated access is configured to work with lbox-test-bucket |
| 37 | + 2. an integration called aws is available to the org |
| 38 | +
|
| 39 | + Currently tests against: |
| 40 | + Org ID: cl26d06tk0gch10901m7jeg9v |
| 41 | + Email: jtso+aws_sdk_tests@labelbox.com |
| 42 | + """ |
| 43 | + client = Client(api_key=os.environ.get("DA_GCP_LABELBOX_API_KEY")) |
25 | 44 | integrations = client.get_organization().get_iam_integrations() |
26 | | - integration = [inte for inte in integrations if 'aws' in inte.name][0] |
| 45 | + integration = [ |
| 46 | + inte for inte in integrations if 'aws-da-test-bucket' in inte.name |
| 47 | + ][0] |
27 | 48 | assert integration.valid |
28 | 49 | ds = client.create_dataset(iam_integration=integration, name="new_ds") |
29 | | - assert ds.iam_integration().name == "aws" |
| 50 | + assert ds.iam_integration().name == "aws-da-test-bucket" |
30 | 51 | dr = ds.create_data_row( |
31 | 52 | row_data= |
32 | | - "https://lbox-test-bucket.s3.us-east-1.amazonaws.com/2021_09_08_0hz_Kleki.png" |
| 53 | + "https://jtso-aws-da-sdk-tests.s3.us-east-2.amazonaws.com/adrian-yu-qkN4D3Rf1gw-unsplash.jpg" |
33 | 54 | ) |
34 | 55 | assert requests.get(dr.row_data).status_code == 200 |
35 | 56 | ds.delete() |
|
0 commit comments