Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
#9 Get ALL products EULA
Browse files Browse the repository at this point in the history
Signed-off-by: Uilian Ries <uilianries@gmail.com>
  • Loading branch information
uilianries committed Jul 20, 2019
1 parent 41c7170 commit 58b6140
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
31 changes: 28 additions & 3 deletions bintray/bintray.py
Original file line number Diff line number Diff line change
Expand Up @@ -2181,7 +2181,7 @@ def get_product_signed_eulas(self, subject, product, from_date=None, to_date=Non
:param to_date: date to filter by, ISO8601 format (yyyy-MM-dd’T’HH:mm:ss.SSSZ)
:param username: filter by username
:param eula_name: filter by Eula name
:return:
:return: A list of EULAs
"""
url = "{}/products/{}/{}/signed_eulas".format(Bintray.BINTRAY_URL, subject, product)
params = {}
Expand All @@ -2197,5 +2197,30 @@ def get_product_signed_eulas(self, subject, product, from_date=None, to_date=Non
self._logger.info("Get successfully")
return response

def get_all_products_signed_eulas():
pass
def get_all_products_signed_eulas(self, subject, from_date=None, to_date=None, username=None,
eula_name=None):
""" Get a list of users who signed eula with sign date, version signed and eula name for
each product owned by the given subject.
:param subject: repository owner
:param from_date: date to filter by, ISO8601 format (yyyy-MM-dd’T’HH:mm:ss.SSSZ)
:param to_date: date to filter by, ISO8601 format (yyyy-MM-dd’T’HH:mm:ss.SSSZ)
:param username: filter by username
:param eula_name: filter by Eula name
:return: a list of EULAs
"""
url = "{}/products/{}/_all/signed_eulas".format(Bintray.BINTRAY_URL, subject)
params = {}
if from_date:
params["from"] = from_date
if to_date:
params["to"] = to_date
if username:
params["username"] = username
if eula_name:
params["eula_name"] = eula_name
response = self._requester.get(url, params=params)
self._logger.info("Get successfully")
return response


11 changes: 11 additions & 0 deletions tests/test_eula_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,14 @@ def test_get_product_signed_eulas():
error_message = str(error)
assert "Could not GET (401): 401 Client Error: Unauthorized for url: " \
"https://api.bintray.com/products/jfrog/bintray/signed_eulas" == error_message


def test_get_all_products_signed_eulas():
bintray = Bintray()
error_message = ""
try:
bintray.get_all_products_signed_eulas("jfrog")
except Exception as error:
error_message = str(error)
assert "Could not GET (401): 401 Client Error: Unauthorized for url: " \
"https://api.bintray.com/products/jfrog/_all/signed_eulas" == error_message

0 comments on commit 58b6140

Please sign in to comment.