def test_run_pack_download_edge_cases(self):
        """
        Edge cases to test:

        default branch is master, ref is pack version
        default branch is master, ref is branch name
        default branch is master, ref is default branch name
        default branch is not master, ref is pack version
        default branch is not master, ref is branch name
        default branch is not master, ref is default branch name
        """

        def side_effect(ref):
            if ref[0] != "v":
                raise BadName()
            return mock.MagicMock(hexsha="abcdeF")

        self.repo_instance.commit.side_effect = side_effect

        edge_cases = [
            ("master", "1.2.3"),
            ("master", "some-branch"),
            ("master", "default-branch"),
            ("master", None),
            ("default-branch", "1.2.3"),
            ("default-branch", "some-branch"),
            ("default-branch", "default-branch"),
            ("default-branch", None),
        ]

        for default_branch, ref in edge_cases:
            self.repo_instance.git = mock.MagicMock(
                branch=(lambda *args: default_branch), checkout=(lambda *args: True)
            )

            # Set default branch
            self.repo_instance.active_branch.name = default_branch
            self.repo_instance.active_branch.object = "aBcdef"
            self.repo_instance.head.commit = "aBcdef"

            # Fake gitref object
            gitref = mock.MagicMock(hexsha="abcDef")

            # Fool _get_gitref into working when its ref == our ref
            def fake_commit(arg_ref):
                if not ref or arg_ref == ref:
                    return gitref
                else:
                    raise BadName()

            self.repo_instance.commit = fake_commit
            self.repo_instance.active_branch.object = gitref

            action = self.get_action_instance()

            if ref:
                packs = ["test=%s" % (ref)]
            else:
                packs = ["test"]

            result = action.run(packs=packs, abs_repo_base=self.repo_base)
            self.assertEqual(result, {"test": "Success."})

        Edge cases to test:

        default branch is master, ref is pack version
        default branch is master, ref is branch name
        default branch is master, ref is default branch name
        default branch is not master, ref is pack version
        default branch is not master, ref is branch name
        default branch is not master, ref is default branch name
        
contrib/packs/tests/test_action_download.py