Skip to content

Commit 6ae6ac8

Browse files
committed
add test cases for creation of data rows. pending api side updates to affirm these are working
1 parent 33c4696 commit 6ae6ac8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/integration/test_data_rows.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,3 +582,25 @@ def test_create_data_rows_local_file(dataset, sample_image):
582582
data_row = list(dataset.data_rows())[0]
583583
assert data_row.external_id == "tests/integration/media/sample_image.jpg"
584584
assert len(data_row.metadata_fields) == 4
585+
586+
587+
def test_create_data_row_with_global_key(dataset, sample_image):
588+
global_key = str(uuid.uuid4())
589+
row = dataset.create_data_row(row_data=sample_image, global_key=global_key)
590+
assert row.global_key == global_key
591+
592+
593+
def test_create_data_rows_with_global_key(dataset, sample_image):
594+
global_key_1 = str(uuid.uuid4())
595+
global_key_2 = str(uuid.uuid4())
596+
task = dataset.create_data_rows([{
597+
DataRow.row_data: sample_image,
598+
DataRow.global_key: global_key_1
599+
}, {
600+
DataRow.row_data: sample_image,
601+
DataRow.global_key: global_key_2
602+
}])
603+
task.wait_till_done()
604+
assert task.status == "COMPLETE"
605+
created_global_keys = set([row.global_key for row in dataset.data_rows()])
606+
assert set([global_key_1, global_key_2]) == created_global_keys

0 commit comments

Comments
 (0)