Skip to content

Commit 131d7c1

Browse files
committed
adjust tests
1 parent a7dc95d commit 131d7c1

File tree

1 file changed

+33
-17
lines changed

1 file changed

+33
-17
lines changed

tests/test_project.py

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -460,17 +460,25 @@ def test_get_batches_success(self):
460460
mock_response = {
461461
"batches": [
462462
{
463-
"id": "batch-1",
464-
"name": "Batch 1",
465-
"created": 1616161616,
466-
"images": 10,
463+
"name": "Uploaded on 11/22/22 at 1:39 pm",
464+
"numJobs": 2,
465+
"images": 115,
466+
"uploaded": {
467+
"_seconds": 1669146024,
468+
"_nanoseconds": 818000000
469+
},
470+
"id": "batch-1"
467471
},
468472
{
469-
"id": "batch-2",
470-
"name": "Batch 2",
471-
"created": 1616161617,
472-
"images": 5,
473-
},
473+
"numJobs": 0,
474+
"images": 11,
475+
"uploaded": {
476+
"_seconds": 1669236873,
477+
"_nanoseconds": 47000000
478+
},
479+
"name": "Upload via API",
480+
"id": "batch-2"
481+
}
474482
]
475483
}
476484

@@ -482,7 +490,11 @@ def test_get_batches_success(self):
482490
self.assertIn("batches", batches)
483491
self.assertEqual(len(batches["batches"]), 2)
484492
self.assertEqual(batches["batches"][0]["id"], "batch-1")
493+
self.assertEqual(batches["batches"][0]["name"], "Uploaded on 11/22/22 at 1:39 pm")
494+
self.assertEqual(batches["batches"][0]["images"], 115)
495+
self.assertEqual(batches["batches"][0]["numJobs"], 2)
485496
self.assertEqual(batches["batches"][1]["id"], "batch-2")
497+
self.assertEqual(batches["batches"][1]["name"], "Upload via API")
486498

487499
def test_get_batches_error(self):
488500
expected_url = f"{API_URL}/{WORKSPACE_NAME}/{PROJECT_NAME}/batches?api_key={ROBOFLOW_API_KEY}"
@@ -500,11 +512,14 @@ def test_get_batch_success(self):
500512
expected_url = f"{API_URL}/{WORKSPACE_NAME}/{PROJECT_NAME}/batches/{batch_id}?api_key={ROBOFLOW_API_KEY}"
501513
mock_response = {
502514
"batch": {
503-
"id": batch_id,
504-
"name": "My Test Batch",
505-
"created": 1616161616,
506-
"images": 25,
507-
"metadata": {"source": "API Upload", "type": "test"},
515+
"name": "Uploaded on 11/22/22 at 1:39 pm",
516+
"numJobs": 2,
517+
"images": 115,
518+
"uploaded": {
519+
"_seconds": 1669146024,
520+
"_nanoseconds": 818000000
521+
},
522+
"id": batch_id
508523
}
509524
}
510525

@@ -515,9 +530,10 @@ def test_get_batch_success(self):
515530
self.assertIsInstance(batch, dict)
516531
self.assertIn("batch", batch)
517532
self.assertEqual(batch["batch"]["id"], batch_id)
518-
self.assertEqual(batch["batch"]["name"], "My Test Batch")
519-
self.assertEqual(batch["batch"]["images"], 25)
520-
self.assertIn("metadata", batch["batch"])
533+
self.assertEqual(batch["batch"]["name"], "Uploaded on 11/22/22 at 1:39 pm")
534+
self.assertEqual(batch["batch"]["images"], 115)
535+
self.assertEqual(batch["batch"]["numJobs"], 2)
536+
self.assertIn("uploaded", batch["batch"])
521537

522538
def test_get_batch_error(self):
523539
batch_id = "nonexistent-batch"

0 commit comments

Comments
 (0)