Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Topic subscriber models #451

Merged
merged 22 commits into from
Mar 21, 2024
Merged

Topic subscriber models #451

merged 22 commits into from
Mar 21, 2024

Conversation

1maple1
Copy link
Contributor

@1maple1 1maple1 commented Feb 23, 2024

No description provided.

@1maple1 1maple1 requested a review from TheBurchLog February 23, 2024 18:13
Copy link

codecov bot commented Feb 23, 2024

Codecov Report

Attention: Patch coverage is 15.73034% with 75 lines in your changes are missing coverage. Please review.

Project coverage is 15.30%. Comparing base (f1c77ae) to head (cac2a00).

Files Patch % Lines
brewtils/rest/easy_client.py 0.00% 20 Missing ⚠️
brewtils/models.py 46.66% 16 Missing ⚠️
brewtils/rest/client.py 0.00% 16 Missing ⚠️
brewtils/schema_parser.py 0.00% 12 Missing ⚠️
brewtils/schemas.py 0.00% 11 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #451   +/-   ##
========================================
  Coverage    15.29%   15.30%           
========================================
  Files           28       28           
  Lines         3819     3908   +89     
========================================
+ Hits           584      598   +14     
- Misses        3235     3310   +75     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 910 to 926
@pytest.fixture
def subscriber_dict():
"""Subscribers as a dictionary."""
return {
"garden": "garden",
"namespace": "ns",
"system": "system",
"version": "1.0.0",
"instance": None,
"command": None,
}


@pytest.fixture
def topic_subscriber_dict(subscriber_dict):
"""Topic subscribers as dict"""
return {"topic": "foo", "subscribers": [subscriber_dict]}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need both the dict and bg_models for these objects. That way it can also be evaluated in the test/schema_parser_test.py

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Added tests in test/schema_parser_test.py.


def __init__(self, topic=None, subscribers=[]):
self.topic = topic
self.subscribers = subscribers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Purely a style comment, in our other models if there is a list, we set the default to None. Then on the assign we do:

self.subscribers = subscribers or []

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@1maple1 1maple1 marked this pull request as ready for review February 27, 2024 19:02
@1maple1 1maple1 changed the title DRAFT: Topic subscriber models Topic subscriber models Feb 27, 2024
return self.session.get(self.topic_url + quote(topic_name), params=kwargs)

@enable_auth
def get_topics(self, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the API going to support kwargs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not at this time. Removed kwargs from get_topics.

@TheBurchLog
Copy link
Contributor

Only minor comment is we need to stub out the change log for this. This will be released in 3.25.1, and will have a dependency of Beer Garden being 3.25 or newer

@@ -943,3 +944,71 @@ def get_tokens(self, username=None, password=None):
self.session.headers["Authorization"] = "Bearer " + self.access_token

return response

@enable_auth
def get_topic(self, topic_id, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure you need the **kwargs here. Only the topic_id is passed forward and the API doesn't access additional parameters.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed kwargs

Comment on lines +1183 to +1184
@wrap_response(parse_method="parse_topic", parse_many=False, default_exc=SaveError)
def create_topic(self, topic):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a patch_topic in the client.py and no here. Take a look at update_request in this file for an example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added update_topic to easy client and related tests.

@1maple1 1maple1 merged commit 15d2bec into develop Mar 21, 2024
7 checks passed
@1maple1 1maple1 deleted the dynamic_topics branch March 21, 2024 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants