|
27 | 27 | QueueLoadScalingTrigger, |
28 | 28 | UtilizationScalingTrigger, |
29 | 29 | DockerHubCredentials, |
| 30 | + GithubCredentials, |
30 | 31 | GCRCredentials, |
31 | 32 | AWSECRCredentials, |
32 | 33 | CustomRegistryCredentials, |
@@ -614,16 +615,20 @@ def test_delete_deployment_environment_variables(self, containers_service, deplo |
614 | 615 | responses.add( |
615 | 616 | responses.DELETE, |
616 | 617 | url, |
617 | | - json=[], # remaining env variables should be empty after deletion |
| 618 | + json=ENV_VARS_DATA, |
618 | 619 | status=200 |
619 | 620 | ) |
620 | 621 |
|
621 | 622 | # act |
622 | 623 | result = containers_service.delete_deployment_environment_variables( |
623 | | - DEPLOYMENT_NAME, CONTAINER_NAME, [ENV_VAR_NAME]) |
| 624 | + DEPLOYMENT_NAME, CONTAINER_NAME, ["random-env-var-name"]) |
624 | 625 |
|
625 | 626 | # assert |
626 | | - assert len(result) == 0 |
| 627 | + assert result == {CONTAINER_NAME: [EnvVar( |
| 628 | + name=ENV_VAR_NAME, |
| 629 | + value_or_reference_to_secret=ENV_VAR_VALUE, |
| 630 | + type=EnvVarType.PLAIN |
| 631 | + )]} |
627 | 632 | assert responses.assert_call_count(url, 1) is True |
628 | 633 |
|
629 | 634 | @responses.activate |
@@ -773,6 +778,29 @@ def test_add_registry_credentials(self, containers_service, registry_credentials |
773 | 778 | assert responses.calls[0].request.body.decode( |
774 | 779 | 'utf-8') == '{"name": "test-credential", "type": "dockerhub", "username": "username", "access_token": "token"}' |
775 | 780 |
|
| 781 | + @responses.activate |
| 782 | + def test_add_registry_credentials_github(self, containers_service, registry_credentials_endpoint): |
| 783 | + # arrange |
| 784 | + responses.add( |
| 785 | + responses.POST, |
| 786 | + registry_credentials_endpoint, |
| 787 | + status=201 |
| 788 | + ) |
| 789 | + |
| 790 | + # act |
| 791 | + creds = GithubCredentials( |
| 792 | + name=REGISTRY_CREDENTIAL_NAME, |
| 793 | + username="test-username", |
| 794 | + access_token="test-token" |
| 795 | + ) |
| 796 | + containers_service.add_registry_credentials(creds) |
| 797 | + |
| 798 | + # assert |
| 799 | + assert responses.assert_call_count( |
| 800 | + registry_credentials_endpoint, 1) is True |
| 801 | + assert responses.calls[0].request.body.decode( |
| 802 | + 'utf-8') == '{"name": "test-credential", "type": "ghcr", "username": "test-username", "access_token": "test-token"}' |
| 803 | + |
776 | 804 | @responses.activate |
777 | 805 | def test_add_registry_credentials_gcr(self, containers_service, registry_credentials_endpoint): |
778 | 806 | # arrange |
|
0 commit comments