Beispiel #1
0
def test_latest_release():
    r1 = GithubRelease(tag_name='',
                       url='',
                       created_at='',
                       tarball_url='',
                       git_tag=GitTag(name='0.0.1', commit_sha='123'),
                       project=flexmock(GitProject),
                       raw_release=flexmock(title='0.0.1'))

    r2 = GithubRelease(tag_name='',
                       url='',
                       created_at='',
                       tarball_url='',
                       git_tag=GitTag(name='0.0.2', commit_sha='123'),
                       project=flexmock(GitProject),
                       raw_release=flexmock(title='0.0.2'))

    mocked_releases = [r1, r2]

    git = flexmock(Git)
    c = flexmock(configuration)
    c.project = flexmock(get_releases=lambda: mocked_releases)
    github = Github(c, git)

    obtained_release = github.latest_release()
    assert obtained_release == "0.0.2"

    mocked_releases = []
    c.project = flexmock(get_releases=lambda: mocked_releases)
    github = Github(c, git)
    obtained_release = github.latest_release()
    assert obtained_release == "0.0.0"
Beispiel #2
0
def test_latest_release():
    mocked_releases = [
        Release(title='0.0.1',
                body='',
                tag_name='',
                url='',
                created_at='',
                tarball_url='',
                git_tag=GitTag(name='0.0.1', commit_sha='123')),
        Release(title='0.0.2',
                body='',
                tag_name='',
                url='',
                created_at='',
                tarball_url='',
                git_tag=GitTag(name='0.0.2', commit_sha='123'))
    ]

    git = flexmock(Git)
    c = flexmock(configuration)
    c.project = flexmock(get_releases=lambda: mocked_releases)
    github = Github(c, git)

    obtained_release = github.latest_release()
    assert obtained_release == '0.0.2'

    mocked_releases = []
    c.project = flexmock(get_releases=lambda: mocked_releases)
    github = Github(c, git)
    obtained_release = github.latest_release()
    assert obtained_release == '0.0.0'
Beispiel #3
0
 def __init__(self, configuration):
     self.conf = configuration
     self.github = Github(configuration)
     self.pypi = PyPi(configuration)
     self.fedora = Fedora(configuration)
     self.logger = configuration.logger
     self.new_release = {}
Beispiel #4
0
 def __init__(self, configuration):
     self.conf = configuration
     self.git = Git(self.conf.clone_url, self.conf)
     self.github = Github(configuration, self.git)
     self.pypi = PyPi(configuration, self.git)
     self.logger = configuration.logger
     self.new_release = NewRelease()
     self.new_pr = NewPR()
Beispiel #5
0
 def __init__(self, configuration):
     self.conf = configuration
     self.git = Git(self.conf.clone_url, self.conf)
     self.github = Github(configuration, self.git)
     self.pypi = PyPi(configuration, self.git)
     self.logger = configuration.logger
     self.new_release = NewRelease()
     self.new_pr = NewPR()
     self.project = configuration.project
     self.git_service = which_service(self.project)  # Github/Pagure
Beispiel #6
0
 def __init__(self, configuration):
     self.conf = configuration
     url = f'https://github.com/{self.conf.repository_owner}/{self.conf.repository_name}.git'
     self.git = Git(url, self.conf)
     self.github = Github(configuration, self.git)
     self.pypi = PyPi(configuration, self.git)
     self.logger = configuration.logger
     # FIXME: it's cumbersome to work with these dicts - it's unclear how the content changes;
     #        get rid of them and replace them with individual variables
     self.new_release = {}
     self.new_pr = {}
Beispiel #7
0
    def setup_method(self):
        """ setup any state tied to the execution of the given method in a
        class.  setup_method is invoked for every test method of a class.
        """
        configuration = prepare_conf()

        self.g_utils = GithubUtils()

        self.g_utils.create_repo()
        self.g_utils.setup_repo()

        # set conf
        configuration.repository_name = self.g_utils.repo
        configuration.github_username = self.g_utils.github_user
        configuration.refresh_interval = 1

        repo_url = f"https://github.com/{self.g_utils.github_user}/{self.g_utils.repo}"
        git = Git(repo_url, configuration)
        self.github = Github(configuration, git)
Beispiel #8
0
    def setup_method(self):
        """ setup any state tied to the execution of the given method in a
        class.  setup_method is invoked for every test method of a class.
        """
        configuration.set_logging(level=10)
        configuration.debug = True

        self.g_utils = GithubUtils(self.github_token, self.github_user)

        self.g_utils.create_repo()
        self.g_utils.setup_repo()

        # set conf
        configuration.repository_name = self.g_utils.repo
        configuration.repository_owner = self.github_user
        configuration.github_token = self.github_token
        configuration.github_username = self.github_user
        configuration.refresh_interval = 1

        self.github = Github(configuration)
Beispiel #9
0
def test_latest_release(expected_f):
    expected = expected_f()
    co = prepare_conf()
    g = Github(co, None)
    assert g.latest_release() == expected