|
25 | 25 | PACKAGE_1 = package.Package("package1") |
26 | 26 | PACKAGE_2 = package.Package("package2") |
27 | 27 | PACKAGE_3 = package.Package("package3") |
28 | | -PACKAGE_4 = package.Package("package4") |
| 28 | +PACKAGE_4 = package.Package("package4[gcp]") |
29 | 29 |
|
30 | 30 |
|
31 | 31 | class TestCompatibilityResult(unittest.TestCase): |
@@ -414,6 +414,65 @@ def MockClient(project=None): |
414 | 414 | mock_client.insert_rows.assert_called_with( |
415 | 415 | store._release_time_table, [row_release_time]) |
416 | 416 |
|
| 417 | + def test_save_compatibility_statuses_release_time_for_latest(self): |
| 418 | + mock_client = mock.Mock() |
| 419 | + packages = [PACKAGE_4] |
| 420 | + timestamp = '2018-07-17 03:01:06.11693 UTC' |
| 421 | + status = compatibility_store.Status.SUCCESS |
| 422 | + comp_status_py2 = mock.Mock( |
| 423 | + packages=packages, |
| 424 | + python_major_version='2', |
| 425 | + status=status, |
| 426 | + details=None, |
| 427 | + dependency_info={'package4': { |
| 428 | + 'installed_version': '2.7.0', |
| 429 | + 'installed_version_time': '2018-05-12T16:26:31', |
| 430 | + 'latest_version': '2.7.0', |
| 431 | + 'current_time': '2018-07-13T17:11:29.140608', |
| 432 | + 'latest_version_time': '2018-05-12T16:26:31', |
| 433 | + 'is_latest': True, |
| 434 | + }}, |
| 435 | + timestamp=timestamp) |
| 436 | + comp_status_py3 = mock.Mock( |
| 437 | + packages=packages, |
| 438 | + python_major_version='3', |
| 439 | + status=status, |
| 440 | + details=None, |
| 441 | + dependency_info={'package4': { |
| 442 | + 'installed_version': '2.2.0', |
| 443 | + 'installed_version_time': '2018-05-12T16:26:31', |
| 444 | + 'latest_version': '2.7.0', |
| 445 | + 'current_time': '2018-07-13T17:11:29.140608', |
| 446 | + 'latest_version_time': '2018-05-12T16:26:31', |
| 447 | + 'is_latest': False, |
| 448 | + }}, |
| 449 | + timestamp=timestamp) |
| 450 | + row_release_time = { |
| 451 | + 'install_name': 'package4[gcp]', |
| 452 | + 'dep_name': 'package4', |
| 453 | + 'installed_version': '2.7.0', |
| 454 | + 'installed_version_time': '2018-05-12T16:26:31', |
| 455 | + 'latest_version': '2.7.0', |
| 456 | + 'timestamp': '2018-07-13T17:11:29.140608', |
| 457 | + 'latest_version_time': '2018-05-12T16:26:31', |
| 458 | + 'is_latest': True, |
| 459 | + } |
| 460 | + |
| 461 | + def MockClient(project=None): |
| 462 | + return mock_client |
| 463 | + |
| 464 | + patch_client = mock.patch( |
| 465 | + 'compatibility_lib.compatibility_store.bigquery.Client', |
| 466 | + MockClient) |
| 467 | + |
| 468 | + with patch_client: |
| 469 | + store = compatibility_store.CompatibilityStore() |
| 470 | + store.save_compatibility_statuses( |
| 471 | + [comp_status_py2, comp_status_py3]) |
| 472 | + |
| 473 | + mock_client.insert_rows.assert_called_with( |
| 474 | + store._release_time_table, [row_release_time]) |
| 475 | + |
417 | 476 |
|
418 | 477 | class MockClient(object): |
419 | 478 |
|
|
0 commit comments