コード例 #1
0
 def test_determine_repo_none(self):  # type: () -> None
     """Test determine_repo None."""
     with pytest.raises(ValueError):
         ImageRemoveArgs.determine_repo(context=None,
                                        ecr_repo={},
                                        image=None,
                                        repo=None)
コード例 #2
0
 def test_determine_repo(self):
     """Test determine_repo."""
     assert (ImageRemoveArgs.determine_repo(
         context=None,
         ecr_repo={"key": "val"},
         image=None,
         repo="something") == "something")
コード例 #3
0
 def test_determine_repo_image(self):  # type: () -> None
     """Test determine_repo Image."""
     repo = "dkr.test.com/image"
     mock_image = MagicMock(spec=DockerImage, repo=repo)
     assert (ImageRemoveArgs.determine_repo(context=None,
                                            ecr_repo=True,
                                            image=mock_image,
                                            repo=None) == repo)
コード例 #4
0
 def test_determine_repo_ecr(self, mocker):
     # type: ("MockerFixture") -> None
     """Test determine_repo ecr."""
     repo = ElasticContainerRegistryRepository(account_id="123456012",
                                               aws_region="us-east-1",
                                               repo_name="test")
     mocker.patch(
         MODULE + ".ElasticContainerRegistryRepository",
         parse_obj=MagicMock(return_value=repo),
     )
     assert (ImageRemoveArgs.determine_repo(
         context=None,
         ecr_repo={
             "repo_name": repo.name,
             "account_id": repo.registry.account_id,
             "aws_region": repo.registry.region,
         },
         image=None,
         repo=None,
     ) == repo.fqn)