コード例 #1
0
ファイル: test_client.py プロジェクト: pombredanne/stac
    def test_get_latest_version_snapshot_only_release_results(self, version_dao, url_generator):
        from stac.client import GenericArtifactoryClient, GenericArtifactoryClientConfig
        from stac.exceptions import NoMatchingVersionsError

        version_dao.get_most_recent_versions.return_value = []

        config = GenericArtifactoryClientConfig()
        config.is_integration = True
        config.http_dao = version_dao
        config.url_generator = url_generator

        maven_client = GenericArtifactoryClient(config)

        with pytest.raises(NoMatchingVersionsError):
            maven_client.get_latest_version('com.example.users.service')
コード例 #2
0
ファイル: test_client.py プロジェクト: pombredanne/stac
    def test_get_latest_version_snapshot_no_results(self, version_dao, url_generator):
        from stac.client import GenericArtifactoryClient, GenericArtifactoryClientConfig
        from stac.exceptions import NoMatchingVersionsError

        request = mock.Mock(spec=requests.Request)
        response = mock.Mock(spec=requests.Response)
        response.status_code = 404
        error = requests.HTTPError("Something bad", request=request, response=response)
        version_dao.get_most_recent_versions.side_effect = error

        config = GenericArtifactoryClientConfig()
        config.is_integration = True
        config.http_dao = version_dao
        config.url_generator = url_generator

        maven_client = GenericArtifactoryClient(config)

        with pytest.raises(NoMatchingVersionsError):
            maven_client.get_latest_version('com.example.users.service')
コード例 #3
0
ファイル: test_client.py プロジェクト: pombredanne/stac
    def test_get_latest_version_release(self, version_dao, url_generator):
        from stac.client import GenericArtifactoryClient, GenericArtifactoryClientConfig

        version_dao.get_most_recent_release.return_value = '4.13.4'

        config = GenericArtifactoryClientConfig()
        config.is_integration = False
        config.http_dao = version_dao
        config.url_generator = url_generator

        maven_client = GenericArtifactoryClient(config)
        version = maven_client.get_latest_version('com.example.users.service')
        assert '4.13.4' == version
コード例 #4
0
ファイル: test_client.py プロジェクト: pombredanne/stac
    def test_get_latest_version_snapshot(self, version_dao, url_generator):
        from stac.client import GenericArtifactoryClient, GenericArtifactoryClientConfig

        version_dao.get_most_recent_versions.return_value = ['1.3.0-SNAPSHOT']

        config = GenericArtifactoryClientConfig()
        config.is_integration = True
        config.http_dao = version_dao
        config.url_generator = url_generator

        maven_client = GenericArtifactoryClient(config)
        version = maven_client.get_latest_version('com.example.users.service')
        assert '1.3.0-SNAPSHOT' == version