Skip to content

Webhooks, Organisations Administration, Repo migrate, List user repos #7

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

Merged
merged 33 commits into from
Apr 12, 2017
Merged

Conversation

costibleotu
Copy link
Contributor

I've created a Hook entity, and methods for creating, updating and deletion of webhooks.

For the Hook update, I've followed the principle and method for User updates.

I've also modified the methods patch, post and put from http_utils.py (modified "data" param -> "json" - so the gogs-client accepts the requests)

I've added 2 new tests, for the above functions.

@coveralls
Copy link

coveralls commented Apr 3, 2017

Coverage Status

Coverage increased (+0.8%) to 93.532% when pulling 403d252 on costibleotu:master into 156ddae on unfoldingWord-dev:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.8%) to 93.532% when pulling 403d252 on costibleotu:master into 156ddae on unfoldingWord-dev:master.

@costibleotu
Copy link
Contributor Author

@ethantkoenig what do you say?

@ethantkoenig
Copy link
Contributor

ethantkoenig commented Apr 10, 2017

@costibleotu Sorry for the inaction, I was AFK last week. I'll try to take a look today or tomorrow.

@costibleotu
Copy link
Contributor Author

No problem :).

I've just finished another interface, for the Organisations Administration, but I will wait for you to review the Webhooks before doing another PR.

When I was doing these interfaces, I thought maybe it would be better to start splitting the interfaces file (is getting bigger and bigger), maybe even the entities one. What do you say?

One more thought was: Wouldn't it be nicer to have methods in the entities models, or use the entities as input parameters for the methods in interfaces.py?

@ethantkoenig
Copy link
Contributor

Agreed that splitting interface.py/entity.py is a good idea, but that should probably be a separate PR.

@ethantkoenig
Copy link
Contributor

LGTM, but can you explain the reason for changing from data=... to json=... in http_utils.py?

@costibleotu
Copy link
Contributor Author

costibleotu commented Apr 11, 2017

The difference between data and json parameter in requests, is that json is setting the content-type to application/json. Apparently that was mandatory for the create hook API in gogs-client.

@costibleotu
Copy link
Contributor Author

costibleotu commented Apr 11, 2017

How should we split the interface? And how should the methods be called afterwords?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 93.078% when pulling 12db57a on databus-systems:master into 156ddae on unfoldingWord-dev:master.

3 similar comments
@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 93.078% when pulling 12db57a on databus-systems:master into 156ddae on unfoldingWord-dev:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 93.078% when pulling 12db57a on databus-systems:master into 156ddae on unfoldingWord-dev:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 93.078% when pulling 12db57a on databus-systems:master into 156ddae on unfoldingWord-dev:master.

@costibleotu
Copy link
Contributor Author

I've updated this PR with all my work so far (Administration Organizations, repo migrate and listing all user's repos).

Next PR should be code refactoring based on this discussion.

@costibleotu costibleotu changed the title Repo webhook representation and functions Webhooks, Organisations Administration, Repo migrate, List user repos Apr 11, 2017
@ethantkoenig
Copy link
Contributor

Woah, this is too much change for a single PR. In the future, please issue multiple smaller PRs, it makes reviewing much easier.

Also, why are you adding .drone.yml? This repository uses Travis CI. If you want to use Drone on your fork, that's fine, but please don't push Drone files upstream.

test.txt Outdated
@@ -0,0 +1 @@
asdasdas
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove this file.

"""
Description to the team

:rtype: int
Copy link
Contributor

Choose a reason for hiding this comment

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

str?

"""
Team name

:rtype: int
Copy link
Contributor

Choose a reason for hiding this comment

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

str?

"""
Organization's full name

:rtype: int
Copy link
Contributor

Choose a reason for hiding this comment

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

str?

"""
Organization's username

:rtype: int
Copy link
Contributor

Choose a reason for hiding this comment

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

str?

"""
The events that fires the hook

:rtype: list of strs
Copy link
Contributor

Choose a reason for hiding this comment

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

@property
def events(self):
"""
The events that fires the hook
Copy link
Contributor

Choose a reason for hiding this comment

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

fires -> fire


:param auth.Authentication auth: authentication object, must be admin-level
:param str org_name: [Required] Organization user name
:param str team_name: Full name of the team
Copy link
Contributor

Choose a reason for hiding this comment

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

Argument name is name, but team_name in docstring.

:param str team_id: [Required] Id of the team
:param str username: Username of the user to be added to team
:return: status code of the request
:rtype: str
Copy link
Contributor

Choose a reason for hiding this comment

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

In its current form, this method returns a response, not a string.

Similarly for other methods below.

:param auth.Authentication auth: authentication object, must be admin-level
:param str team_id: [Required] Id of the team
:param str username: Username of the user to be added to team
:return: status code of the request
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't really like returning the status code, since the point of the gogs_client is to abstract away details. I would either return the newly created team (if possible), or nothing.

Similarly for other methods below.

@coveralls
Copy link

coveralls commented Apr 12, 2017

Coverage Status

Coverage increased (+0.2%) to 93.015% when pulling 05b4291 on databus-systems:master into 156ddae on unfoldingWord-dev:master.

@ethantkoenig ethantkoenig merged commit c3ee062 into unfoldingWord-dev:master Apr 12, 2017
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.

3 participants