Skip to content

Commit

Permalink
Validate stream name
Browse files Browse the repository at this point in the history
  • Loading branch information
JokeWaumans committed Aug 2, 2024
1 parent ad79ce8 commit 5e66000
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mlx/coverity_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ def login(self, username, password):
self.session = requests.Session()
self.session.auth = (username, password)

def validate_stream(self, stream):
"""Validate stream by retrieving the specified stream.
When the request fails, the stream does not exist or the user does not have acces to it.
Args:
stream (str): The stream name
"""
url = self.base_url.rstrip('/') + f"/streams/{stream}"
self._get_request(url)

def retrieve_issues(self, filters):
"""Retrieve issues from the server (Coverity Connect).
Expand Down Expand Up @@ -282,6 +292,8 @@ def get_defects(self, stream, filters, column_names):
"rows": list of [list of dictionaries {"key": <key>, "value": <value>}]
}
"""
logging.info("Validate stream [%s] ...", stream)
self.validate_stream(stream)
logging.info("Querying Coverity for defects in stream [%s] ...", stream)
request_filters = [
{
Expand Down

0 comments on commit 5e66000

Please sign in to comment.