Ejemplo n.º 1
0
    def test_get_creds_file(self):
        # Load the creds file:
        creds = get_github_creds(["Org-one", "Org-two", "Org-three"])

        for x in ["one", "two", "three"]:
            assert creds["Org-{}".format(x)] == "token-{}".format(x)

        # And without one specified:
        db.session.add(Account(name="Org-BAD", account_type_id=self.account_type.id,
                               identifier="Org-BAD", active=True))
        db.session.commit()

        with self.assertRaises(GitHubCredsError) as _:
            get_github_creds(["Org-BAD"])
Ejemplo n.º 2
0
    def test_get_creds_env(self):
        app.config["GITHUB_CREDENTIALS"] = {
            "AnotherOrg": "AnotherCred"
        }

        db.session.add(Account(name="AnotherOrg", account_type_id=self.account_type.id,
                               identifier="AnotherOrg", active=True))
        db.session.commit()

        creds = get_github_creds(["AnotherOrg"])
        assert isinstance(creds, dict)
        assert creds["AnotherOrg"] == "AnotherCred"

        # Altogether now:
        creds = get_github_creds(["Org-one", "Org-two", "Org-three", "AnotherOrg"])
        assert isinstance(creds, dict)
        assert len(creds.keys()) == 4
    def test_get_creds_file(self):
        # Load the creds file:
        creds = get_github_creds(["Org-one", "Org-two", "Org-three"])

        for x in ["one", "two", "three"]:
            assert creds["Org-{}".format(x)] == "token-{}".format(x)

        # And without one specified:
        db.session.add(
            Account(name="Org-BAD",
                    account_type_id=self.account_type.id,
                    identifier="Org-BAD",
                    active=True))
        db.session.commit()

        with self.assertRaises(GitHubCredsError) as _:
            get_github_creds(["Org-BAD"])
Ejemplo n.º 4
0
 def __init__(self, accounts=None, debug=False):
     super(GitHubOrg, self).__init__(accounts=accounts, debug=debug)
     self.honor_ephemerals = True
     self.ephemeral_paths = [
         "disk_usage", "owned_private_repos", "public_repos",
         "total_private_repos", "private_gists", "public_gists",
         "followers", "following", "plan$*$filled_seats"
     ]
     self.github_creds = get_github_creds(self.accounts)
Ejemplo n.º 5
0
 def __init__(self, accounts=None, debug=False):
     super(GitHubOrg, self).__init__(accounts=accounts, debug=debug)
     self.honor_ephemerals = True
     self.ephemeral_paths = [
         "disk_usage",
         "owned_private_repos",
         "public_repos",
         "disk_usage"
     ]
     self.github_creds = get_github_creds(self.accounts)
    def test_get_creds_env(self):
        app.config["GITHUB_CREDENTIALS"] = {"AnotherOrg": "AnotherCred"}

        db.session.add(
            Account(name="AnotherOrg",
                    account_type_id=self.account_type.id,
                    identifier="AnotherOrg",
                    active=True))
        db.session.commit()

        creds = get_github_creds(["AnotherOrg"])
        assert isinstance(creds, dict)
        assert creds["AnotherOrg"] == "AnotherCred"

        # Altogether now:
        creds = get_github_creds(
            ["Org-one", "Org-two", "Org-three", "AnotherOrg"])
        assert isinstance(creds, dict)
        assert len(list(creds.keys())) == 4
Ejemplo n.º 7
0
 def __init__(self, accounts=None, debug=False):
     super(GitHubRepo, self).__init__(accounts=accounts, debug=debug)
     self.honor_ephemerals = True
     self.ephemeral_paths = [
         "updated_at", "stargazers_count", "pushed_at", "size", "watchers",
         "watchers_count", "forks", "forks_count", "open_issues",
         "open_issues_count", "webhooks$*$last_response"
     ]
     self.batched_size = 20
     self.done_slurping = False
     self.github_creds = get_github_creds(self.accounts)
Ejemplo n.º 8
0
 def __init__(self, accounts=None, debug=False):
     super(GitHubOrg, self).__init__(accounts=accounts, debug=debug)
     self.honor_ephemerals = True
     self.ephemeral_paths = [
         "disk_usage",
         "owned_private_repos",
         "public_repos",
         "total_private_repos",
         "private_gists",
         "public_gists",
         "followers",
         "following",
         "plan$*$filled_seats"
     ]
     self.github_creds = get_github_creds(self.accounts)
Ejemplo n.º 9
0
 def __init__(self, accounts=None, debug=False):
     super(GitHubTeam, self).__init__(accounts=accounts, debug=debug)
     self.honor_ephemerals = True
     self.ephemeral_paths = []
     self.github_creds = get_github_creds(self.accounts)
Ejemplo n.º 10
0
 def __init__(self, accounts=None, debug=False):
     super(GitHubTeam, self).__init__(accounts=accounts, debug=debug)
     self.honor_ephemerals = True
     self.ephemeral_paths = []
     self.github_creds = get_github_creds(self.accounts)