def test_process_github_dependency_cannot_find_latest(self):
        global_config = BaseGlobalConfig()
        config = BaseProjectConfig(global_config)
        config.keychain = DummyKeychain()
        github = self._make_github()
        github.repositories["CumulusCI-Test-Dep"]._releases = []
        config.get_github_api = mock.Mock(return_value=github)

        with self.assertRaises(DependencyResolutionError):
            config.process_github_dependency(
                {"github": "https://github.com/SFDO-Tooling/CumulusCI-Test-Dep.git"}
            )
Beispiel #2
0
    def test_process_github_dependency_cannot_find_latest(self):
        global_config = BaseGlobalConfig()
        config = BaseProjectConfig(global_config)
        config.keychain = DummyKeychain()
        github = self._make_github()
        github.repositories["CumulusCI-Test-Dep"]._releases = []
        config.get_github_api = mock.Mock(return_value=github)

        with self.assertRaises(DependencyResolutionError):
            config.process_github_dependency(
                {"github": "https://github.com/SFDO-Tooling/CumulusCI-Test-Dep.git"}
            )
Beispiel #3
0
    def test_process_github_dependency_tag_not_found(self):
        global_config = BaseGlobalConfig()
        config = BaseProjectConfig(global_config)
        config.keychain = DummyKeychain()
        config.get_github_api = mock.Mock(return_value=self._make_github())

        with self.assertRaises(DependencyResolutionError):
            config.process_github_dependency({
                "github":
                "https://github.com/SFDO-Tooling/CumulusCI-Test-Dep.git",
                "tag": "bogus",
            })
Beispiel #4
0
    def test_process_github_dependency_cannot_find_latest(self):
        global_config = BaseGlobalConfig()
        config = BaseProjectConfig(global_config)
        config.get_github_api = DummyGithub
        config.keychain = DummyKeychain()
        CUMULUSCI_TEST_DEP_REPO._get = mock.Mock(side_effect=Exception)

        with self.assertRaises(DependencyResolutionError):
            config.process_github_dependency(
                {"github": "https://github.com/SFDO-Tooling/CumulusCI-Test-Dep.git"}
            )

        del CUMULUSCI_TEST_DEP_REPO._get
    def test_process_github_dependency_tag_not_found(self):
        global_config = BaseGlobalConfig()
        config = BaseProjectConfig(global_config)
        config.keychain = DummyKeychain()
        config.get_github_api = mock.Mock(return_value=self._make_github())

        with self.assertRaises(DependencyResolutionError):
            config.process_github_dependency(
                {
                    "github": "https://github.com/SFDO-Tooling/CumulusCI-Test-Dep.git",
                    "tag": "bogus",
                }
            )
Beispiel #6
0
    def test_process_github_dependency_with_tag(self):
        global_config = BaseGlobalConfig()
        config = BaseProjectConfig(global_config)
        github = self._make_github()
        github.repositories["CumulusCI-Test"]._releases = [
            DummyRelease("release/1.0", "1.0")
        ]
        config.get_github_api = mock.Mock(return_value=github)
        config.keychain = DummyKeychain()

        result = config.process_github_dependency({
            "github": "https://github.com/SFDO-Tooling/CumulusCI-Test.git",
            "tag": "release/1.0",
        })
        self.assertIn(
            {
                "name":
                "Install CumulusCI-Test 1.0",
                "namespace":
                "ccitest",
                "version":
                "1.0",
                "dependencies": [{
                    "name": "Install CumulusCI-Test-Dep 2.0",
                    "namespace": "ccitestdep",
                    "version": "2.0",
                }],
            },
            result,
        )
    def test_process_github_dependency_with_tag(self):
        global_config = BaseGlobalConfig()
        config = BaseProjectConfig(global_config)
        github = self._make_github()
        github.repositories["CumulusCI-Test"]._releases = [
            DummyRelease("release/1.0", "1.0")
        ]
        config.get_github_api = mock.Mock(return_value=github)
        config.keychain = DummyKeychain()

        result = config.process_github_dependency(
            {
                "github": "https://github.com/SFDO-Tooling/CumulusCI-Test.git",
                "tag": "release/1.0",
            }
        )
        self.assertIn(
            {
                "name": "Install CumulusCI-Test 1.0",
                "namespace": "ccitest",
                "version": "1.0",
                "dependencies": [
                    {
                        "name": "Install CumulusCI-Test-Dep 2.0",
                        "namespace": "ccitestdep",
                        "version": "2.0",
                    }
                ],
            },
            result,
        )
 def test_process_github_dependency_no_unpackaged(self):
     global_config = BaseGlobalConfig()
     config = BaseProjectConfig(global_config)
     github = self._make_github()
     del github.repositories["CumulusCI-Test"]._contents["unpackaged/pre"]
     del github.repositories["CumulusCI-Test"]._contents["unpackaged/post"]
     config.get_github_api = mock.Mock(return_value=github)
     config.keychain = DummyKeychain()
     result = config.process_github_dependency(
         {
             "github": "https://github.com/SFDO-Tooling/CumulusCI-Test.git",
             "unmanaged": True,
         }
     )
     self.assertEqual(
         result,
         [
             {
                 u"name": "Install CumulusCI-Test-Dep 2.0",
                 u"version": "2.0",
                 u"namespace": "ccitestdep",
             },
             {
                 u"name": "Deploy CumulusCI-Test",
                 u"repo_owner": "SFDO-Tooling",
                 u"repo_name": "CumulusCI-Test",
                 u"ref": "commit_sha",
                 u"subfolder": u"src",
                 u"unmanaged": True,
                 u"namespace_inject": None,
                 u"namespace_strip": None,
                 u"namespace_tokenize": None,
             },
         ],
     )
Beispiel #9
0
 def test_process_github_dependency_no_unpackaged(self):
     global_config = BaseGlobalConfig()
     config = BaseProjectConfig(global_config)
     github = self._make_github()
     del github.repositories["CumulusCI-Test"]._contents["unpackaged/pre"]
     del github.repositories["CumulusCI-Test"]._contents["unpackaged/post"]
     config.get_github_api = mock.Mock(return_value=github)
     config.keychain = DummyKeychain()
     result = config.process_github_dependency({
         "github": "https://github.com/SFDO-Tooling/CumulusCI-Test.git",
         "unmanaged": True,
     })
     self.assertEqual(
         result,
         [
             {
                 "name": "Install CumulusCI-Test-Dep 2.0",
                 "version": "2.0",
                 "namespace": "ccitestdep",
             },
             {
                 "name": "Deploy CumulusCI-Test",
                 "repo_owner": "SFDO-Tooling",
                 "repo_name": "CumulusCI-Test",
                 "ref": "commit_sha",
                 "subfolder": "src",
                 "unmanaged": True,
                 "namespace_inject": None,
                 "namespace_strip": None,
                 "namespace_tokenize": None,
             },
         ],
     )
    def test_process_github_dependency_latest(self):
        global_config = BaseGlobalConfig()
        config = BaseProjectConfig(global_config)
        config.get_github_api = DummyGithub
        config.keychain = DummyKeychain()
        CUMULUSCI_TEST_DEP_REPO._releases = [
            DummyRelease("beta/1.1-Beta_1", "1.1 (Beta 1)"),
            DummyRelease("release/1.0"),
        ]

        result = config.process_github_dependency(
            {
                "github": "https://github.com/SFDO-Tooling/CumulusCI-Test.git",
                "unmanaged": True,
                "skip": ["unpackaged/pre/skip", "unpackaged/post/skip"],
            },
            "",
            include_beta=True,
        )
        self.assertEqual(
            result,
            [
                {
                    u"repo_owner": "SFDO-Tooling",
                    u"repo_name": "CumulusCI-Test",
                    u"ref": None,
                    u"subfolder": u"unpackaged/pre/pre",
                    u"unmanaged": True,
                    u"namespace_inject": None,
                    u"namespace_strip": None,
                    u"namespace_tokenize": None,
                },
                {
                    u"version": "1.1 (Beta 1)",
                    u"namespace": "ccitestdep"
                },
                {
                    u"repo_owner": "SFDO-Tooling",
                    u"repo_name": "CumulusCI-Test",
                    u"ref": None,
                    u"subfolder": u"src",
                    u"unmanaged": True,
                    u"namespace_inject": None,
                    u"namespace_strip": None,
                    u"namespace_tokenize": None,
                },
                {
                    u"repo_owner": "SFDO-Tooling",
                    u"repo_name": "CumulusCI-Test",
                    u"ref": None,
                    u"subfolder": u"unpackaged/post/post",
                    u"unmanaged": True,
                    u"namespace_inject": "ccitest",
                    u"namespace_strip": None,
                    u"namespace_tokenize": None,
                },
            ],
        )
        CUMULUSCI_TEST_DEP_REPO._releases = None
Beispiel #11
0
    def test_process_github_dependency_ref(self):
        global_config = BaseGlobalConfig()
        config = BaseProjectConfig(global_config)
        config.keychain = DummyKeychain()
        config.get_github_api = mock.Mock(return_value=self._make_github())

        result = config.process_github_dependency(
            {
                "github": "https://github.com/SFDO-Tooling/CumulusCI-Test.git",
                "unmanaged": True,
                "ref": "other_commit_sha",
                "skip": ["unpackaged/pre/skip", "unpackaged/post/skip"],
            },
            "",
        )
        self.assertEqual(
            result,
            [
                {
                    u"name": "Deploy unpackaged/pre/pre",
                    u"repo_owner": "SFDO-Tooling",
                    u"repo_name": "CumulusCI-Test",
                    u"ref": "other_commit_sha",
                    u"subfolder": u"unpackaged/pre/pre",
                    u"unmanaged": True,
                    u"namespace_inject": None,
                    u"namespace_strip": None,
                    u"namespace_tokenize": None,
                },
                {
                    u"name": "Install CumulusCI-Test-Dep 2.0",
                    u"version": "2.0",
                    u"namespace": "ccitestdep",
                },
                {
                    u"name": "Deploy CumulusCI-Test",
                    u"repo_owner": "SFDO-Tooling",
                    u"repo_name": "CumulusCI-Test",
                    u"ref": "other_commit_sha",
                    u"subfolder": u"src",
                    u"unmanaged": True,
                    u"namespace_inject": None,
                    u"namespace_strip": None,
                    u"namespace_tokenize": None,
                },
                {
                    u"name": "Deploy unpackaged/post/post",
                    u"repo_owner": "SFDO-Tooling",
                    u"repo_name": "CumulusCI-Test",
                    u"ref": "other_commit_sha",
                    u"subfolder": u"unpackaged/post/post",
                    u"unmanaged": True,
                    u"namespace_inject": "ccitest",
                    u"namespace_strip": None,
                    u"namespace_tokenize": None,
                },
            ],
        )
    def test_process_github_dependency(self):
        global_config = BaseGlobalConfig()
        config = BaseProjectConfig(global_config)
        config.get_github_api = DummyGithub
        config.keychain = DummyKeychain()

        result = config.process_github_dependency({
            "github":
            "https://github.com/SFDO-Tooling/CumulusCI-Test.git",
            "unmanaged":
            True,
            "skip": ["unpackaged/pre/skip", "unpackaged/post/skip"],
        })
        self.assertEqual(
            result,
            [
                {
                    u"repo_owner": "SFDO-Tooling",
                    u"repo_name": "CumulusCI-Test",
                    u"ref": None,
                    u"subfolder": u"unpackaged/pre/pre",
                    u"unmanaged": True,
                    u"namespace_inject": None,
                    u"namespace_strip": None,
                    u"namespace_tokenize": None,
                },
                {
                    u"version": "2",
                    u"namespace": "ccitestdep"
                },
                {
                    u"repo_owner": "SFDO-Tooling",
                    u"repo_name": "CumulusCI-Test",
                    u"ref": None,
                    u"subfolder": u"src",
                    u"unmanaged": True,
                    u"namespace_inject": None,
                    u"namespace_strip": None,
                    u"namespace_tokenize": None,
                },
                {
                    u"repo_owner": "SFDO-Tooling",
                    u"repo_name": "CumulusCI-Test",
                    u"ref": None,
                    u"subfolder": u"unpackaged/post/post",
                    u"unmanaged": True,
                    u"namespace_inject": "ccitest",
                    u"namespace_strip": None,
                    u"namespace_tokenize": None,
                },
            ],
        )
Beispiel #13
0
    def test_process_github_dependency_with_tag(self):
        global_config = BaseGlobalConfig()
        config = BaseProjectConfig(global_config)
        config.get_github_api = DummyGithub
        config.keychain = DummyKeychain()

        result = config.process_github_dependency(
            {
                "github": "https://github.com/SFDO-Tooling/CumulusCI-Test.git",
                "tag": "release/1.0",
            }
        )
        self.assertIn(
            {
                "namespace": "ccitest",
                "version": "1.0",
                "dependencies": [{"namespace": "ccitestdep", "version": "2"}],
            },
            result,
        )
Beispiel #14
0
    def test_process_github_dependency(self):
        global_config = BaseGlobalConfig()
        config = BaseProjectConfig(global_config)
        config.get_github_api = DummyGithub
        config.keychain = DummyKeychain()

        result = config.process_github_dependency({
            'github': 'https://github.com/SalesforceFoundation/CumulusCI-Test',
            'unmanaged': True,
        })
        self.assertEqual(result, [
            {
                u'headers': {u'Authorization': u'token password'},
                u'namespace_inject': None,
                u'namespace_strip': None,
                u'namespace_tokenize': None,
                u'subfolder': u'CumulusCI-Test-master/unpackaged/pre/pre',
                u'unmanaged': True,
                u'zip_url': u'https://github.com/SalesforceFoundation/CumulusCI-Test/archive/master.zip',
            },
            {u'version': '2', u'namespace': 'ccitestdep'},
            {
                u'headers': {u'Authorization': u'token password'},
                u'namespace_inject': None,
                u'namespace_strip': None,
                u'namespace_tokenize': None,
                u'subfolder': u'CumulusCI-Test-master/src',
                u'unmanaged': True,
                u'zip_url': u'https://github.com/SalesforceFoundation/CumulusCI-Test/archive/master.zip',
            },
            {
                u'headers': {u'Authorization': u'token password'},
                u'namespace_inject': 'ccitest',
                u'namespace_strip': None,
                u'namespace_tokenize': None,
                u'subfolder': u'CumulusCI-Test-master/unpackaged/post/post',
                u'unmanaged': True,
                u'zip_url': u'https://github.com/SalesforceFoundation/CumulusCI-Test/archive/master.zip',
            },
        ])
    def test_process_github_dependency_latest(self):
        global_config = BaseGlobalConfig()
        config = BaseProjectConfig(global_config)
        config.keychain = DummyKeychain()
        github = self._make_github()
        github.repositories["CumulusCI-Test-Dep"]._releases = [
            DummyRelease("beta/1.1-Beta_1", "1.1 (Beta 1)"),
            DummyRelease("release/1.0", "1.0"),
        ]
        config.get_github_api = mock.Mock(return_value=github)

        result = config.process_github_dependency(
            {
                "github": "https://github.com/SFDO-Tooling/CumulusCI-Test.git",
                "unmanaged": True,
                "skip": ["unpackaged/pre/skip", "unpackaged/post/skip"],
            },
            "",
            include_beta=True,
        )
        self.assertEqual(
            result,
            [
                {
                    u"name": "Deploy unpackaged/pre/pre",
                    u"repo_owner": "SFDO-Tooling",
                    u"repo_name": "CumulusCI-Test",
                    u"ref": "commit_sha",
                    u"subfolder": u"unpackaged/pre/pre",
                    u"unmanaged": True,
                    u"namespace_inject": None,
                    u"namespace_strip": None,
                    u"namespace_tokenize": None,
                },
                {
                    u"name": "Install CumulusCI-Test-Dep 1.1 (Beta 1)",
                    u"version": "1.1 (Beta 1)",
                    u"namespace": "ccitestdep",
                },
                {
                    u"name": "Deploy CumulusCI-Test",
                    u"repo_owner": "SFDO-Tooling",
                    u"repo_name": "CumulusCI-Test",
                    u"ref": "commit_sha",
                    u"subfolder": u"src",
                    u"unmanaged": True,
                    u"namespace_inject": None,
                    u"namespace_strip": None,
                    u"namespace_tokenize": None,
                },
                {
                    u"name": "Deploy unpackaged/post/post",
                    u"repo_owner": "SFDO-Tooling",
                    u"repo_name": "CumulusCI-Test",
                    u"ref": "commit_sha",
                    u"subfolder": u"unpackaged/post/post",
                    u"unmanaged": True,
                    u"namespace_inject": "ccitest",
                    u"namespace_strip": None,
                    u"namespace_tokenize": None,
                },
            ],
        )
Beispiel #16
0
    def test_process_github_dependency_latest(self):
        global_config = BaseGlobalConfig()
        config = BaseProjectConfig(global_config)
        config.keychain = DummyKeychain()
        github = self._make_github()
        github.repositories["CumulusCI-Test-Dep"]._releases = [
            DummyRelease("beta/1.1-Beta_1", "1.1 (Beta 1)"),
            DummyRelease("release/1.0", "1.0"),
        ]
        config.get_github_api = mock.Mock(return_value=github)

        result = config.process_github_dependency(
            {
                "github": "https://github.com/SFDO-Tooling/CumulusCI-Test.git",
                "unmanaged": True,
                "skip": ["unpackaged/pre/skip", "unpackaged/post/skip"],
            },
            "",
            include_beta=True,
        )
        self.assertEqual(
            result,
            [
                {
                    "name": "Deploy unpackaged/pre/pre",
                    "repo_owner": "SFDO-Tooling",
                    "repo_name": "CumulusCI-Test",
                    "ref": "commit_sha",
                    "subfolder": "unpackaged/pre/pre",
                    "unmanaged": True,
                    "namespace_inject": None,
                    "namespace_strip": None,
                    "namespace_tokenize": None,
                },
                {
                    "name": "Install CumulusCI-Test-Dep 1.1 (Beta 1)",
                    "version": "1.1 (Beta 1)",
                    "namespace": "ccitestdep",
                },
                {
                    "name": "Deploy CumulusCI-Test",
                    "repo_owner": "SFDO-Tooling",
                    "repo_name": "CumulusCI-Test",
                    "ref": "commit_sha",
                    "subfolder": "src",
                    "unmanaged": True,
                    "namespace_inject": None,
                    "namespace_strip": None,
                    "namespace_tokenize": None,
                },
                {
                    "name": "Deploy unpackaged/post/post",
                    "repo_owner": "SFDO-Tooling",
                    "repo_name": "CumulusCI-Test",
                    "ref": "commit_sha",
                    "subfolder": "unpackaged/post/post",
                    "unmanaged": True,
                    "namespace_inject": "ccitest",
                    "namespace_strip": None,
                    "namespace_tokenize": None,
                },
            ],
        )
Beispiel #17
0
    def test_process_github_dependency(self):
        global_config = BaseGlobalConfig()
        config = BaseProjectConfig(global_config)
        config.get_github_api = DummyGithub
        config.keychain = DummyKeychain()

        result = config.process_github_dependency({
            "github":
            "https://github.com/SFDO-Tooling/CumulusCI-Test.git",
            "unmanaged":
            True,
            "skip": ["unpackaged/pre/skip", "unpackaged/post/skip"],
        })
        self.assertEqual(
            result,
            [
                {
                    u"headers": {
                        u"Authorization": u"token password"
                    },
                    u"namespace_inject":
                    None,
                    u"namespace_strip":
                    None,
                    u"namespace_tokenize":
                    None,
                    u"subfolder":
                    u"CumulusCI-Test-master/unpackaged/pre/pre",
                    u"unmanaged":
                    True,
                    u"zip_url":
                    u"https://github.com/SFDO-Tooling/CumulusCI-Test/archive/master.zip",
                },
                {
                    u"version": "2",
                    u"namespace": "ccitestdep"
                },
                {
                    u"headers": {
                        u"Authorization": u"token password"
                    },
                    u"namespace_inject":
                    None,
                    u"namespace_strip":
                    None,
                    u"namespace_tokenize":
                    None,
                    u"subfolder":
                    u"CumulusCI-Test-master/src",
                    u"unmanaged":
                    True,
                    u"zip_url":
                    u"https://github.com/SFDO-Tooling/CumulusCI-Test/archive/master.zip",
                },
                {
                    u"headers": {
                        u"Authorization": u"token password"
                    },
                    u"namespace_inject":
                    "ccitest",
                    u"namespace_strip":
                    None,
                    u"namespace_tokenize":
                    None,
                    u"subfolder":
                    u"CumulusCI-Test-master/unpackaged/post/post",
                    u"unmanaged":
                    True,
                    u"zip_url":
                    u"https://github.com/SFDO-Tooling/CumulusCI-Test/archive/master.zip",
                },
            ],
        )