-
Notifications
You must be signed in to change notification settings - Fork 106
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
WIP: Initial message schema for Anitya #570
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,10 +23,13 @@ | |
from __future__ import print_function | ||
|
||
from contextlib import contextmanager | ||
import collections | ||
import unittest | ||
import os | ||
import mock | ||
|
||
from flask import request_started | ||
from fedora_messaging import message | ||
from social_flask_sqlalchemy.models import PSABase | ||
from sqlalchemy import create_engine, event | ||
import flask_login | ||
|
@@ -177,68 +180,66 @@ def create_distro(session): | |
|
||
def create_project(session): | ||
""" Create some basic projects to work with. """ | ||
utilities.create_project( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm glad to see you are getting rid of the utilities functions. I want to remove most of them in the future. |
||
session, | ||
project = models.Project( | ||
name='geany', | ||
homepage='https://www.geany.org/', | ||
backend='custom', | ||
version_url='https://www.geany.org/Download/Releases', | ||
regex='DEFAULT', | ||
user_id='[email protected]', | ||
) | ||
session.add(project) | ||
|
||
utilities.create_project( | ||
session, | ||
project = models.Project( | ||
name='subsurface', | ||
homepage='https://subsurface-divelog.org/', | ||
backend='custom', | ||
version_url='https://subsurface-divelog.org/downloads/', | ||
regex='DEFAULT', | ||
user_id='[email protected]', | ||
) | ||
session.add(project) | ||
|
||
utilities.create_project( | ||
session, | ||
project = models.Project( | ||
name='R2spec', | ||
homepage='https://fedorahosted.org/r2spec/', | ||
user_id='[email protected]', | ||
backend='custom', | ||
) | ||
session.add(project) | ||
session.commit() | ||
|
||
|
||
def create_ecosystem_projects(session): | ||
""" Create some fake projects from particular upstream ecosystems | ||
|
||
Each project name is used in two different ecosystems | ||
""" | ||
utilities.create_project( | ||
session, | ||
project = models.Project( | ||
name='pypi_and_npm', | ||
homepage='https://example.com/not-a-real-pypi-project', | ||
backend='PyPI', | ||
user_id='[email protected]' | ||
) | ||
session.add(project) | ||
|
||
utilities.create_project( | ||
session, | ||
project = models.Project( | ||
name='pypi_and_npm', | ||
homepage='https://example.com/not-a-real-npmjs-project', | ||
backend='npmjs', | ||
user_id='[email protected]' | ||
) | ||
session.add(project) | ||
|
||
utilities.create_project( | ||
session, | ||
project = models.Project( | ||
name='rubygems_and_maven', | ||
homepage='https://example.com/not-a-real-rubygems-project', | ||
backend='Rubygems', | ||
user_id='[email protected]' | ||
) | ||
session.add(project) | ||
|
||
utilities.create_project( | ||
session, | ||
project = models.Project( | ||
name='rubygems_and_maven', | ||
homepage='https://example.com/not-a-real-maven-project', | ||
backend='Maven Central', | ||
user_id='[email protected]' | ||
) | ||
session.add(project) | ||
session.commit() | ||
|
||
|
||
def create_package(session): | ||
|
@@ -262,25 +263,19 @@ def create_package(session): | |
|
||
def create_flagged_project(session): | ||
""" Create and flag a project. Returns the ProjectFlag. """ | ||
project = utilities.create_project( | ||
session, | ||
project = models.Project( | ||
name='geany', | ||
homepage='https://www.geany.org/', | ||
version_url='https://www.geany.org/Download/Releases', | ||
regex='DEFAULT', | ||
user_id='[email protected]', | ||
) | ||
|
||
session.add(project) | ||
|
||
flag = utilities.flag_project( | ||
session, | ||
project, | ||
"This is a duplicate.", | ||
"[email protected]", | ||
"user_openid_id", | ||
flag = models.ProjectFlag( | ||
project=project, | ||
reason="this is a duplicate.", | ||
user="[email protected]", | ||
) | ||
|
||
session.add(flag) | ||
|
||
session.commit() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will be good to rename this function to
publish
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a interim solution. The most reasonable refactor is likely to get rid of this function entirely. The reason is that different messages almost certainly have different failure scenarios and once you get rid of the fedmsg portion of this function, all it's doing is squashing exceptions.