@@ -47,25 +47,19 @@ def environ() -> Environ:
47
47
48
48
49
49
def graphql_url (environ : str ) -> str :
50
- return "https://app.replicated-6bd9012.labelbox.dev/api/_gql"
51
- """
52
50
if environ == Environ .PROD :
53
51
return 'https://api.labelbox.com/graphql'
54
52
elif environ == Environ .STAGING :
55
53
return 'https://staging-api.labelbox.com/graphql'
56
54
return 'http://host.docker.internal:8080/graphql'
57
- """
58
55
59
56
60
57
def testing_api_key (environ : str ) -> str :
61
- return "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJja3RhbXFnN2MwMDAxMHljaTAxZDFhaGVqIiwib3JnYW5pemF0aW9uSWQiOiJja3RhbXFnNm4wMDAwMHljaTgwaDI1NXZ3IiwiYXBpS2V5SWQiOiJja3RhbXZmdm4wMDhrMHljaTh1MG40a2hzIiwic2VjcmV0IjoiNzcxOWViMjgyNjUyMWMxODQ5MmJhMjg1NzhmY2FmNDEiLCJpYXQiOjE2MzEwNTMwNDksImV4cCI6MjI2MjIwNTA0OX0.yBLurIRB3xYQkV8MEBm0_LxmdqP9U-8aMj25kASmGLw"
62
- """
63
58
if environ == Environ .PROD :
64
59
return os .environ ["LABELBOX_TEST_API_KEY_PROD" ]
65
60
elif environ == Environ .STAGING :
66
61
return os .environ ["LABELBOX_TEST_API_KEY_STAGING" ]
67
62
return os .environ ["LABELBOX_TEST_API_KEY_LOCAL" ]
68
- """
69
63
70
64
71
65
def cancel_invite (client , invite_id ):
@@ -140,11 +134,8 @@ def client(environ: str):
140
134
141
135
142
136
@pytest .fixture (scope = "session" )
143
- def image_url (client , environ : str ):
144
- return IMG_URL
145
- #if environ == Environ.LOCAL:
146
- # return IMG_URL
147
- #return client.upload_data(requests.get(IMG_URL).content, sign=True)
137
+ def image_url (client ):
138
+ return client .upload_data (requests .get (IMG_URL ).content , sign = True )
148
139
149
140
150
141
@pytest .fixture
@@ -221,9 +212,16 @@ def datarow(dataset, image_url):
221
212
@pytest .fixture
222
213
def label_pack (project , rand_gen , image_url ):
223
214
client = project .client
215
+ < << << << HEAD
216
+ dataset = client .create_dataset (name = rand_gen (str ))
217
+ project .datasets .connect (dataset )
218
+ data_row = dataset .create_data_row (row_data = IMG_URL )
219
+ == == == =
224
220
dataset = client .create_dataset (name = rand_gen (str ), projects = project )
225
221
data_row = dataset .create_data_row (row_data = image_url )
222
+ >> >> >> > 6970 d60beebc6c969a81c891b4c88db7c57f98df
226
223
label = project .create_label (data_row = data_row , label = rand_gen (str ))
224
+ time .sleep (10 )
227
225
yield LabelPack (project , dataset , data_row , label )
228
226
dataset .delete ()
229
227
@@ -318,7 +316,7 @@ def submit(project_id, data_row_id):
318
316
})
319
317
features = feature_result ['project' ]['featuresForDataRow' ]
320
318
feature_ids = [feature ['id' ] for feature in features ]
321
- res = client .execute (
319
+ client .execute (
322
320
"""mutation createLabelPyApi ($project_id : ID!,$datarow_id: ID!,$feature_ids: [ID!]!,$time_seconds : Float!) {
323
321
createLabelFromFeatures(data: {dataRow: { id: $datarow_id },project: { id: $project_id },
324
322
featureIds: $feature_ids,secondsSpent: $time_seconds}) {id}}""" ,
@@ -328,7 +326,6 @@ def submit(project_id, data_row_id):
328
326
"feature_ids" : feature_ids ,
329
327
"time_seconds" : 10
330
328
})
331
- return res ['createLabelFromFeatures' ]['id' ]
332
329
333
330
return submit
334
331
@@ -365,8 +362,9 @@ def configured_project_with_label(client, rand_gen, annotation_submit_fn,
365
362
upload_task = MALPredictionImport .create_from_objects (
366
363
client , project .uid , f'mal-import-{ uuid .uuid4 ()} ' , predictions )
367
364
upload_task .wait_until_done ()
368
- labels = annotation_submit_fn (project .uid , data_row .uid )
369
- time .sleep (3 )
370
- yield [project , labels ]
365
+ time .sleep (2 )
366
+ annotation_submit_fn (project .uid , data_row .uid )
367
+ time .sleep (2 )
368
+ yield project
371
369
dataset .delete ()
372
370
project .delete ()
0 commit comments