From df450729e4df9200183913fb5c6d9a8a5de9717a Mon Sep 17 00:00:00 2001 From: Michal Konečný Date: Feb 07 2022 12:24:35 +0000 Subject: Run black on code This commit will fix the style tests for both Fedora and CentOS. Signed-off-by: Michal Konečný --- diff --git a/pagure/api/__init__.py b/pagure/api/__init__.py index d244d99..eef1a10 100644 --- a/pagure/api/__init__.py +++ b/pagure/api/__init__.py @@ -46,7 +46,7 @@ _log = logging.getLogger(__name__) def preload_docs(endpoint): - """ Utility to load an RST file and turn it into fancy HTML. """ + """Utility to load an RST file and turn it into fancy HTML.""" here = os.path.dirname(os.path.abspath(__file__)) fname = os.path.join(here, "..", "doc", endpoint + ".rst") @@ -64,7 +64,7 @@ APIDOC = preload_docs("api") def build_docs_section(name, endpoints): - """ Utility to build a documentation section to feed the template. """ + """Utility to build a documentation section to feed the template.""" result = {"name": name, "endpoints": []} @@ -151,7 +151,7 @@ class APIERROR(enum.Enum): def get_authorized_api_project(session, repo, user=None, namespace=None): - """ Helper function to get an authorized_project with optional lock. """ + """Helper function to get an authorized_project with optional lock.""" repo = pagure.lib.query.get_authorized_project( flask.g.session, repo, user=user, namespace=namespace ) @@ -178,11 +178,11 @@ def api_login_required(acls=None, optional=False): """ def decorator(function): - """ The decorator of the function """ + """The decorator of the function""" @functools.wraps(function) def decorated_function(*args, **kwargs): - """ Actually does the job with the arguments provided. """ + """Actually does the job with the arguments provided.""" response = check_api_acls(acls, optional) if response: @@ -231,11 +231,11 @@ def api_login_optional(acls=None): """ def decorator(function): - """ The decorator of the function """ + """The decorator of the function""" @functools.wraps(function) def decorated_function(*args, **kwargs): - """ Actually does the job with the arguments provided. """ + """Actually does the job with the arguments provided.""" response = check_api_acls(acls, optional=True) if response: @@ -248,11 +248,11 @@ def api_login_optional(acls=None): def api_method(function): - """ Runs an API endpoint and catch all the APIException thrown. """ + """Runs an API endpoint and catch all the APIException thrown.""" @functools.wraps(function) def wrapper(*args, **kwargs): - """ Actually does the job with the arguments provided. """ + """Actually does the job with the arguments provided.""" try: result = function(*args, **kwargs) except APIError as err: @@ -518,7 +518,7 @@ def api_error_codes(): @API.route("/") def api(): - """ Display the api information page. """ + """Display the api information page.""" sections = [] diff --git a/pagure/cli/admin.py b/pagure/cli/admin.py index 258feb9..63cf7a5 100644 --- a/pagure/cli/admin.py +++ b/pagure/cli/admin.py @@ -522,7 +522,7 @@ def _parser_update_acls(subparser): def parse_arguments(args=None): - """ Set-up the argument parsing. """ + """Set-up the argument parsing.""" parser = argparse.ArgumentParser( description="The admin CLI for this pagure instance" ) @@ -598,7 +598,7 @@ def _ask_confirmation(): def _get_input(text): - """ Ask the user for input. """ + """Ask the user for input.""" return input(text) @@ -620,7 +620,7 @@ def _get_project(arg_project, user=None): def _check_project(_project, **kwargs): - """ Check that the project extracted with args is a valid project """ + """Check that the project extracted with args is a valid project""" if _project is None: raise pagure.exceptions.PagureException( "No project found with: {}".format( @@ -1349,7 +1349,7 @@ def do_set_default_branch(args): def main(): - """ Start of the application. """ + """Start of the application.""" # Parse the arguments args = parse_arguments() diff --git a/pagure/config.py b/pagure/config.py index b6563c4..28cb247 100644 --- a/pagure/config.py +++ b/pagure/config.py @@ -15,7 +15,7 @@ import flask # noqa: E402 def reload_config(): - """ Reload the configuration. """ + """Reload the configuration.""" config = flask.config.Config( os.path.dirname(os.path.abspath(__file__)), flask.Flask.default_config ) diff --git a/pagure/doc_utils.py b/pagure/doc_utils.py index 3867222..d8a2771 100644 --- a/pagure/doc_utils.py +++ b/pagure/doc_utils.py @@ -26,7 +26,7 @@ import pagure.lib.encoding_utils def modify_rst(rst, view_file_url=None): - """ Downgrade some of our rst directives if docutils is too old. """ + """Downgrade some of our rst directives if docutils is too old.""" if view_file_url: rst = rst.replace(".. image:: ", ".. image:: %s" % view_file_url) @@ -75,7 +75,7 @@ def modify_html(html): def convert_doc(rst_string, view_file_url=None): - """ Utility to load an RST file and turn it into fancy HTML. """ + """Utility to load an RST file and turn it into fancy HTML.""" rst = modify_rst(rst_string, view_file_url) overrides = {"report_level": "quiet"} @@ -115,7 +115,7 @@ def convert_readme(content, ext, view_file_url=None): def load_doc(endpoint): - """ Utility to load an RST file and turn it into fancy HTML. """ + """Utility to load an RST file and turn it into fancy HTML.""" rst = modify_rst(textwrap.dedent(endpoint.__doc__)) @@ -128,7 +128,7 @@ def load_doc(endpoint): def load_doc_title(endpoint): - """ Utility to load docstring title from a method """ + """Utility to load docstring title from a method""" rst = modify_rst(textwrap.dedent(endpoint.__doc__)) parts = docutils.examples.html_parts(rst) @@ -138,7 +138,7 @@ def load_doc_title(endpoint): def load_doc_title_and_name(endpoint): - """ Utility to load the HTML doc version and the title from a method. """ + """Utility to load the HTML doc version and the title from a method.""" result = { "doc": load_doc(endpoint), diff --git a/pagure/docs_server.py b/pagure/docs_server.py index fdb213b..c2d3ce9 100644 --- a/pagure/docs_server.py +++ b/pagure/docs_server.py @@ -116,7 +116,7 @@ def __get_tree(repo_obj, tree, filepath, index=0, extended=False): def __get_tree_and_content(repo_obj, commit, path): - """ Return the tree and the content of the specified file. """ + """Return the tree and the content of the specified file.""" (blob_or_tree, tree_obj, extended) = __get_tree( repo_obj, commit.tree, path diff --git a/pagure/exceptions.py b/pagure/exceptions.py index 3d3e219..478ff09 100644 --- a/pagure/exceptions.py +++ b/pagure/exceptions.py @@ -53,7 +53,7 @@ class FileNotFoundException(PagureException): class APIError(PagureException): - """ Exception raised by the API when something goes wrong. """ + """Exception raised by the API when something goes wrong.""" def __init__(self, status_code, error_code, error=None, errors=None): self.status_code = status_code @@ -85,7 +85,7 @@ class GitConflictsException(PagureException): class HookInactiveException(PagureException): - """ Exception raised when the hook is inactive. """ + """Exception raised when the hook is inactive.""" pass @@ -98,7 +98,7 @@ class NoCorrespondingPR(PagureException): class InvalidObjectException(PagureException): - """ Exception raised when a given object is not what was expected. """ + """Exception raised when a given object is not what was expected.""" pass @@ -112,18 +112,18 @@ class PagureEncodingException(PagureException, ValueError): class PagurePushDenied(PagureException): - """ Exception raised if a remote hook rejected a push """ + """Exception raised if a remote hook rejected a push""" pass class InvalidTimestampException(PagureException): - """ Exception raised when the hook is inactive. """ + """Exception raised when the hook is inactive.""" pass class InvalidDateformatException(PagureException): - """ Exception raised when the hook is inactive. """ + """Exception raised when the hook is inactive.""" pass diff --git a/pagure/flask_app.py b/pagure/flask_app.py index fca49cb..969a3c7 100644 --- a/pagure/flask_app.py +++ b/pagure/flask_app.py @@ -61,7 +61,7 @@ if pagure_config.get("PAGURE_CI_SERVICES"): def create_app(config=None): - """ Create the flask application. """ + """Create the flask application.""" app = flask.Flask(__name__) app.config = pagure_config @@ -265,7 +265,7 @@ def logout(): def set_request(): - """ Prepare every request. """ + """Prepare every request.""" flask.session.permanent = True if not hasattr(flask.g, "session") or not flask.g.session: flask.g.session = pagure.lib.model_base.create_session( @@ -440,7 +440,7 @@ def set_request(): def auth_login(): # pragma: no cover - """ Method to log into the application using FAS OpenID. """ + """Method to log into the application using FAS OpenID.""" return_point = flask.url_for("ui_ns.index") if "next" in flask.request.args: if pagure.utils.is_safe_url(flask.request.args["next"]): @@ -504,7 +504,7 @@ def auth_login(): # pragma: no cover def auth_logout(): # pragma: no cover - """ Method to log out from the application. """ + """Method to log out from the application.""" return_point = flask.url_for("ui_ns.index") if "next" in flask.request.args: if pagure.utils.is_safe_url(flask.request.args["next"]): @@ -533,7 +533,7 @@ def end_request(exception=None): def after_request(response): - """ After request callback, adjust the headers returned """ + """After request callback, adjust the headers returned""" if not hasattr(flask.g, "nonce"): return response diff --git a/pagure/forms.py b/pagure/forms.py index 280ba4d..5336ecf 100644 --- a/pagure/forms.py +++ b/pagure/forms.py @@ -49,7 +49,7 @@ if hasattr(wtf, "__version__"): class PagureForm(FlaskForm): - """ Local form allowing us to form set the time limit. """ + """Local form allowing us to form set the time limit.""" def __init__(self, *args, **kwargs): delta = pagure_config.get("WTF_CSRF_TIME_LIMIT", 3600) @@ -65,7 +65,7 @@ class PagureForm(FlaskForm): def convert_value(val): - """ Convert the provided values to strings when possible. """ + """Convert the provided values to strings when possible.""" if val: if not isinstance(val, (list, tuple, six.text_type)): return val.decode("utf-8") @@ -126,13 +126,13 @@ def file_virus_validator(form, field): def ssh_key_validator(form, field): - """ Form for ssh key validation """ + """Form for ssh key validation""" if not pagure.lib.query.are_valid_ssh_keys(field.data): raise wtforms.ValidationError("Invalid SSH keys") class ProjectFormSimplified(PagureForm): - """ Form to edit the description of a project. """ + """Form to edit the description of a project.""" description = wtforms.StringField( "Description", @@ -166,7 +166,7 @@ class ProjectFormSimplified(PagureForm): class ProjectForm(ProjectFormSimplified): - """ Form to create or edit project. """ + """Form to create or edit project.""" name = wtforms.StringField("Project name") mirrored_from = wtforms.StringField( @@ -249,7 +249,7 @@ class ProjectForm(ProjectFormSimplified): class IssueFormSimplied(PagureForm): - """ Form to create or edit an issue. """ + """Form to create or edit an issue.""" title = wtforms.StringField( "Title", @@ -295,7 +295,7 @@ class IssueFormSimplied(PagureForm): class IssueForm(IssueFormSimplied): - """ Form to create or edit an issue. """ + """Form to create or edit an issue.""" status = wtforms.SelectField( "Status", [wtforms.validators.DataRequired()], choices=[] @@ -314,7 +314,7 @@ class IssueForm(IssueFormSimplied): class RequestPullForm(PagureForm): - """ Form to create a pull request. """ + """Form to create a pull request.""" title = wtforms.StringField( "Title", @@ -331,7 +331,7 @@ class RequestPullForm(PagureForm): class RequestPullEditForm(RequestPullForm): - """ Form to edit a pull request. """ + """Form to edit a pull request.""" branch_to = wtforms.SelectField( "Target branch", @@ -353,7 +353,7 @@ class RequestPullEditForm(RequestPullForm): class RemoteRequestPullForm(RequestPullForm): - """ Form to create a remote pull request. """ + """Form to create a remote pull request.""" git_repo = wtforms.StringField( "Git repo address", @@ -373,7 +373,7 @@ class RemoteRequestPullForm(RequestPullForm): class DeleteIssueTagForm(PagureForm): - """ Form to remove a tag to from a project. """ + """Form to remove a tag to from a project.""" tag = wtforms.StringField( "Tag", @@ -386,7 +386,7 @@ class DeleteIssueTagForm(PagureForm): class AddIssueTagForm(DeleteIssueTagForm): - """ Form to add a tag to a project. """ + """Form to add a tag to a project.""" tag_description = wtforms.StringField( "Tag Description", [wtforms.validators.Optional()] @@ -397,7 +397,7 @@ class AddIssueTagForm(DeleteIssueTagForm): class ApiAddIssueTagForm(PagureForm): - """ Form to add a tag to a project from the API endpoint """ + """Form to add a tag to a project from the API endpoint""" tag = wtforms.StringField( "Tag", @@ -417,7 +417,7 @@ class ApiAddIssueTagForm(PagureForm): class StatusForm(PagureForm): - """ Form to add/change the status of an issue. """ + """Form to add/change the status of an issue.""" status = wtforms.SelectField( "Status", [wtforms.validators.DataRequired()], choices=[] @@ -444,7 +444,7 @@ class StatusForm(PagureForm): class MilestoneForm(PagureForm): - """ Form to change the milestone of an issue. """ + """Form to change the milestone of an issue.""" milestone = wtforms.SelectField( "Milestone", @@ -467,7 +467,7 @@ class MilestoneForm(PagureForm): class NewTokenForm(PagureForm): - """ Form to add a new token. """ + """Form to add a new token.""" description = wtforms.StringField( "description", [wtforms.validators.Optional()] @@ -496,7 +496,7 @@ class NewTokenForm(PagureForm): class UpdateIssueForm(PagureForm): - """ Form to add a comment to an issue. """ + """Form to add a comment to an issue.""" tag = wtforms.StringField( "tag", @@ -568,7 +568,7 @@ class UpdateIssueForm(PagureForm): class AddPullRequestCommentForm(PagureForm): - """ Form to add a comment to a pull-request. """ + """Form to add a comment to a pull-request.""" commit = wtforms.HiddenField("commit identifier") filename = wtforms.HiddenField("file changed") @@ -582,7 +582,7 @@ class AddPullRequestCommentForm(PagureForm): class AddPullRequestFlagFormV1(PagureForm): - """ Form to add a flag to a pull-request or commit. """ + """Form to add a flag to a pull-request or commit.""" username = wtforms.StringField( "Username", [wtforms.validators.DataRequired()] @@ -604,7 +604,7 @@ class AddPullRequestFlagFormV1(PagureForm): class AddPullRequestFlagForm(AddPullRequestFlagFormV1): - """ Form to add a flag to a pull-request or commit. """ + """Form to add a flag to a pull-request or commit.""" def __init__(self, *args, **kwargs): # we need to instantiate dynamically because the configuration @@ -624,7 +624,7 @@ class AddPullRequestFlagForm(AddPullRequestFlagFormV1): class AddSSHKeyForm(PagureForm): - """ Form to add a SSH key to a user. """ + """Form to add a SSH key to a user.""" ssh_key = wtforms.StringField( "SSH Key", @@ -634,7 +634,7 @@ class AddSSHKeyForm(PagureForm): class AddDeployKeyForm(AddSSHKeyForm): - """ Form to add a deploy key to a project. """ + """Form to add a deploy key to a project.""" pushaccess = wtforms.BooleanField( "Push access", @@ -644,7 +644,7 @@ class AddDeployKeyForm(AddSSHKeyForm): class AddUserForm(PagureForm): - """ Form to add a user to a project. """ + """Form to add a user to a project.""" user = wtforms.StringField( "Username", @@ -661,7 +661,7 @@ class AddUserForm(PagureForm): class AddUserToGroupForm(PagureForm): - """ Form to add a user to a pagure group. """ + """Form to add a user to a pagure group.""" user = wtforms.StringField( "Username", @@ -670,7 +670,7 @@ class AddUserToGroupForm(PagureForm): class AssignIssueForm(PagureForm): - """ Form to assign an user to an issue. """ + """Form to assign an user to an issue.""" assignee = wtforms.StringField( "Assignee", @@ -679,7 +679,7 @@ class AssignIssueForm(PagureForm): class AddGroupForm(PagureForm): - """ Form to add a group to a project. """ + """Form to add a group to a project.""" group = wtforms.StringField( "Group", @@ -699,13 +699,13 @@ class AddGroupForm(PagureForm): class ConfirmationForm(PagureForm): - """ Simple form used just for CSRF protection. """ + """Simple form used just for CSRF protection.""" pass class ModifyACLForm(PagureForm): - """ Form to change ACL of a user or a group to a project. """ + """Form to change ACL of a user or a group to a project.""" user_type = wtforms.SelectField( "User type", @@ -730,7 +730,7 @@ class ModifyACLForm(PagureForm): class UploadFileForm(PagureForm): - """ Form to upload a file. """ + """Form to upload a file.""" filestream = wtforms.FileField( "File", [wtforms.validators.DataRequired(), file_virus_validator] @@ -738,7 +738,7 @@ class UploadFileForm(PagureForm): class UserEmailForm(PagureForm): - """ Form to edit the description of a project. """ + """Form to edit the description of a project.""" email = wtforms.StringField("email", [wtforms.validators.DataRequired()]) @@ -754,7 +754,7 @@ class UserEmailForm(PagureForm): class ProjectCommentForm(PagureForm): - """ Form to represent project. """ + """Form to represent project.""" objid = wtforms.StringField( "Ticket/Request id", [wtforms.validators.DataRequired()] @@ -765,7 +765,7 @@ class ProjectCommentForm(PagureForm): class CommentForm(PagureForm): - """ Form to upload a file. """ + """Form to upload a file.""" comment = wtforms.FileField( "Comment", [wtforms.validators.DataRequired(), file_virus_validator] @@ -773,7 +773,7 @@ class CommentForm(PagureForm): class EditGroupForm(PagureForm): - """ Form to ask for a password change. """ + """Form to ask for a password change.""" display_name = wtforms.StringField( "Group name to display", @@ -792,7 +792,7 @@ class EditGroupForm(PagureForm): class NewGroupForm(EditGroupForm): - """ Form to ask for a password change. """ + """Form to ask for a password change.""" group_name = wtforms.StringField( "Group name", @@ -819,7 +819,7 @@ class NewGroupForm(EditGroupForm): class EditFileForm(PagureForm): - """ Form used to edit a file. """ + """Form used to edit a file.""" content = wtforms.TextAreaField("content", [wtforms.validators.Optional()]) commit_title = wtforms.StringField( @@ -893,7 +893,7 @@ class EditCommentForm(PagureForm): class ForkRepoForm(PagureForm): - """ Form to fork a project in the API. """ + """Form to fork a project in the API.""" repo = wtforms.StringField( "The project name", [wtforms.validators.DataRequired()] @@ -930,7 +930,7 @@ class PublicNotificationForm(PagureForm): class SubscribtionForm(PagureForm): - """ Form to subscribe to or unsubscribe from an issue or a PR. """ + """Form to subscribe to or unsubscribe from an issue or a PR.""" status = wtforms.BooleanField( "Subscription status", @@ -969,7 +969,7 @@ class TriggerCIPRForm(PagureForm): class AddGitTagForm(PagureForm): - """ Form to create a new git tag. """ + """Form to create a new git tag.""" tagname = wtforms.StringField( "Name of the tag", diff --git a/pagure/hooks/__init__.py b/pagure/hooks/__init__.py index c0ef67a..131fe6f 100644 --- a/pagure/hooks/__init__.py +++ b/pagure/hooks/__init__.py @@ -140,7 +140,7 @@ class BaseRunner(object): class BaseHook(object): - """ Base class for pagure's hooks. """ + """Base class for pagure's hooks.""" name = None form = None diff --git a/pagure/hooks/default.py b/pagure/hooks/default.py index deb4c9d..4555aba 100644 --- a/pagure/hooks/default.py +++ b/pagure/hooks/default.py @@ -304,7 +304,7 @@ def inform_pull_request_urls(session, project, commits, refname, username): class DefaultRunner(BaseRunner): - """ Runner for the default hook.""" + """Runner for the default hook.""" @staticmethod def post_receive(session, username, project, repotype, repodir, changes): @@ -476,7 +476,7 @@ class DefaultRunner(BaseRunner): class Default(BaseHook): - """ Default hooks. """ + """Default hooks.""" name = "default" description = ( diff --git a/pagure/hooks/fedmsg_hook.py b/pagure/hooks/fedmsg_hook.py index d512062..b33ec1c 100644 --- a/pagure/hooks/fedmsg_hook.py +++ b/pagure/hooks/fedmsg_hook.py @@ -64,7 +64,7 @@ class FedmsgRunner(BaseRunner): class FedmsgForm(FlaskForm): - """ Form to configure the fedmsg hook. """ + """Form to configure the fedmsg hook.""" active = wtforms.BooleanField("Active", [wtforms.validators.Optional()]) @@ -82,7 +82,7 @@ This hook on the other hand only acts on commits. class Fedmsg(BaseHook): - """ Fedmsg hooks. """ + """Fedmsg hooks.""" name = "Fedmsg" description = DESCRIPTION diff --git a/pagure/hooks/irc.py b/pagure/hooks/irc.py index 9c324ac..fc7330d 100644 --- a/pagure/hooks/irc.py +++ b/pagure/hooks/irc.py @@ -65,7 +65,7 @@ class IrcTable(BASE): class IrcForm(FlaskForm): - """ Form to configure the irc hook. """ + """Form to configure the irc hook.""" server = wtforms.StringField( 'Server *', [RequiredIf("active")] @@ -89,7 +89,7 @@ class IrcForm(FlaskForm): class Hook(BaseHook): - """ IRC hooks. """ + """IRC hooks.""" name = "IRC" description = ( diff --git a/pagure/hooks/mail.py b/pagure/hooks/mail.py index f32c94d..57e3124 100644 --- a/pagure/hooks/mail.py +++ b/pagure/hooks/mail.py @@ -61,7 +61,7 @@ class MailTable(BASE): class MailForm(FlaskForm): - """ Form to configure the mail hook. """ + """Form to configure the mail hook.""" mail_to = wtforms.StringField("Mail to", [RequiredIf("active")]) active = wtforms.BooleanField("Active", [wtforms.validators.Optional()]) @@ -136,7 +136,7 @@ class MailRunner(BaseRunner): class Mail(BaseHook): - """ Mail hooks. """ + """Mail hooks.""" name = "Mail" description = ( diff --git a/pagure/hooks/mirror_hook.py b/pagure/hooks/mirror_hook.py index 0130ce6..24e2ba6 100644 --- a/pagure/hooks/mirror_hook.py +++ b/pagure/hooks/mirror_hook.py @@ -65,7 +65,7 @@ class MirrorTable(BASE): class MirrorRunner(BaseRunner): - """ Runner for the mirror hook. """ + """Runner for the mirror hook.""" @staticmethod def post_receive(session, username, project, repotype, repodir, changes): @@ -102,7 +102,7 @@ class CustomRegexp(wtforms.validators.Regexp): class MirrorForm(FlaskForm): - """ Form to configure the mirror hook. """ + """Form to configure the mirror hook.""" active = wtforms.BooleanField("Active", [wtforms.validators.Optional()]) @@ -137,7 +137,7 @@ Finally the log of the last sync at the bottom is meant. class MirrorHook(BaseHook): - """ Mirror hook. """ + """Mirror hook.""" name = "Mirroring" description = DESCRIPTION diff --git a/pagure/hooks/pagure_ci.py b/pagure/hooks/pagure_ci.py index aa7a383..11baf37 100644 --- a/pagure/hooks/pagure_ci.py +++ b/pagure/hooks/pagure_ci.py @@ -100,7 +100,7 @@ activation. class PagureCiForm(FlaskForm): - """ Form to configure the CI hook. """ + """Form to configure the CI hook.""" ci_type = wtforms.SelectField( "Type of CI service", @@ -162,7 +162,7 @@ class PagureCiForm(FlaskForm): class PagureCi(BaseHook): - """ Continuous Integration (CI) hooks. """ + """Continuous Integration (CI) hooks.""" name = "Pagure CI" description = ( diff --git a/pagure/hooks/pagure_force_commit.py b/pagure/hooks/pagure_force_commit.py index c0dd4a6..150f263 100644 --- a/pagure/hooks/pagure_force_commit.py +++ b/pagure/hooks/pagure_force_commit.py @@ -60,7 +60,7 @@ class PagureForceCommitTable(BASE): class PagureForceCommitRunner(BaseRunner): - """ Runner for the hook blocking force push. """ + """Runner for the hook blocking force push.""" @staticmethod def pre_receive(session, username, project, repotype, repodir, changes): @@ -93,7 +93,7 @@ class PagureForceCommitRunner(BaseRunner): class PagureForceCommitForm(FlaskForm): - """ Form to configure the pagure hook. """ + """Form to configure the pagure hook.""" branches = wtforms.StringField("Branches", [RequiredIf("active")]) @@ -101,7 +101,7 @@ class PagureForceCommitForm(FlaskForm): class PagureForceCommitHook(BaseHook): - """ PagurPagureForceCommit hook. """ + """PagurPagureForceCommit hook.""" name = "Block non fast-forward pushes" description = ( diff --git a/pagure/hooks/pagure_hook.py b/pagure/hooks/pagure_hook.py index 24f3bab..284ec26 100644 --- a/pagure/hooks/pagure_hook.py +++ b/pagure/hooks/pagure_hook.py @@ -119,7 +119,7 @@ def generate_revision_change_log( def relates_commit(session, username, commitid, issue, app_url=None): - """ Add a comment to an issue that this commit relates to it. """ + """Add a comment to an issue that this commit relates to it.""" url = "../%s" % commitid[:8] if app_url: @@ -212,7 +212,7 @@ def fixes_relation(session, username, commitid, relation, app_url=None): class PagureRunner(BaseRunner): - """ Runner for the pagure's specific git hook. """ + """Runner for the pagure's specific git hook.""" @staticmethod def post_receive(session, username, project, repotype, repodir, changes): @@ -259,7 +259,7 @@ class PagureRunner(BaseRunner): class PagureForm(FlaskForm): - """ Form to configure the pagure hook. """ + """Form to configure the pagure hook.""" active = wtforms.BooleanField("Active", [wtforms.validators.Optional()]) @@ -300,7 +300,7 @@ number. class PagureHook(BaseHook): - """ Pagure hook. """ + """Pagure hook.""" name = "Pagure" description = DESCRIPTION diff --git a/pagure/hooks/pagure_no_new_branches.py b/pagure/hooks/pagure_no_new_branches.py index 82df5fa..cddec81 100644 --- a/pagure/hooks/pagure_no_new_branches.py +++ b/pagure/hooks/pagure_no_new_branches.py @@ -56,7 +56,7 @@ class PagureNoNewBranchesTable(BASE): class PagureNoNewBranchRunner(BaseRunner): - """ Runner for the hook blocking new branches from being created. """ + """Runner for the hook blocking new branches from being created.""" @staticmethod def pre_receive(session, username, project, repotype, repodir, changes): @@ -84,13 +84,13 @@ class PagureNoNewBranchRunner(BaseRunner): class PagureNoNewBranchesForm(FlaskForm): - """ Form to configure the pagure hook. """ + """Form to configure the pagure hook.""" active = wtforms.BooleanField("Active", [wtforms.validators.Optional()]) class PagureNoNewBranchesHook(BaseHook): - """ PagureNoNewBranches hook. """ + """PagureNoNewBranches hook.""" name = "Prevent creating new branches by git push" description = "This hook prevents creating new branches by git push." diff --git a/pagure/hooks/pagure_request_hook.py b/pagure/hooks/pagure_request_hook.py index 152bcfd..254475f 100644 --- a/pagure/hooks/pagure_request_hook.py +++ b/pagure/hooks/pagure_request_hook.py @@ -108,13 +108,13 @@ class PagureRequestRunner(BaseRunner): class PagureRequestsForm(FlaskForm): - """ Form to configure the pagure hook. """ + """Form to configure the pagure hook.""" active = wtforms.BooleanField("Active", [wtforms.validators.Optional()]) class PagureRequestHook(BaseHook): - """ Pagure request hook. """ + """Pagure request hook.""" name = "Pagure requests" description = ( diff --git a/pagure/hooks/pagure_ticket_hook.py b/pagure/hooks/pagure_ticket_hook.py index bbecc5e..5f9f247 100644 --- a/pagure/hooks/pagure_ticket_hook.py +++ b/pagure/hooks/pagure_ticket_hook.py @@ -62,7 +62,7 @@ class PagureTicketsTable(BASE): class PagureTicketRunner(BaseRunner): - """ Runner for the git hook updating the DB of tickets on push. """ + """Runner for the git hook updating the DB of tickets on push.""" @staticmethod def post_receive(session, username, project, repotype, repodir, changes): @@ -106,13 +106,13 @@ class PagureTicketRunner(BaseRunner): class PagureTicketsForm(FlaskForm): - """ Form to configure the pagure hook. """ + """Form to configure the pagure hook.""" active = wtforms.BooleanField("Active", [wtforms.validators.Optional()]) class PagureTicketHook(BaseHook): - """ Pagure ticket hook. """ + """Pagure ticket hook.""" name = "Pagure tickets" description = ( diff --git a/pagure/hooks/pagure_unsigned_commits.py b/pagure/hooks/pagure_unsigned_commits.py index 072ff57..d8a38c6 100644 --- a/pagure/hooks/pagure_unsigned_commits.py +++ b/pagure/hooks/pagure_unsigned_commits.py @@ -62,7 +62,7 @@ class PagureUnsignedCommitTable(BASE): class PagureUnsignerRunner(BaseRunner): - """ Runner for the hook blocking unsigned commits. """ + """Runner for the hook blocking unsigned commits.""" @staticmethod def pre_receive(session, username, project, repotype, repodir, changes): @@ -106,13 +106,13 @@ class PagureUnsignerRunner(BaseRunner): class PagureUnsignedCommitForm(FlaskForm): - """ Form to configure the pagure hook. """ + """Form to configure the pagure hook.""" active = wtforms.BooleanField("Active", [wtforms.validators.Optional()]) class PagureUnsignedCommitHook(BaseHook): - """ PagurPagureUnsignedCommit hook. """ + """PagurPagureUnsignedCommit hook.""" name = "Block Un-Signed commits" description = ( diff --git a/pagure/hooks/rtd.py b/pagure/hooks/rtd.py index 5fd8235..a1ecb45 100644 --- a/pagure/hooks/rtd.py +++ b/pagure/hooks/rtd.py @@ -65,7 +65,7 @@ class RtdTable(BASE): class RtdForm(FlaskForm): - """ Form to configure the pagure hook. """ + """Form to configure the pagure hook.""" api_url = wtforms.StringField( "URL endpoint used to trigger the builds", @@ -156,7 +156,7 @@ class RtdRunner(BaseRunner): class RtdHook(BaseHook): - """ Read The Doc hook. """ + """Read The Doc hook.""" name = "Read the Doc" description = DESCRIPTION diff --git a/pagure/internal/__init__.py b/pagure/internal/__init__.py index 306605a..1f5df6d 100644 --- a/pagure/internal/__init__.py +++ b/pagure/internal/__init__.py @@ -94,7 +94,7 @@ def internal_access_only(function): @PV.route("/ssh/lookupkey/", methods=["POST"]) @internal_access_only def lookup_ssh_key(): - """ Looks up an SSH key by search_key for keyhelper.py """ + """Looks up an SSH key by search_key for keyhelper.py""" search_key = flask.request.form["search_key"] username = flask.request.form.get("username") _auth_log.info( @@ -125,7 +125,7 @@ def lookup_ssh_key(): @PV.route("/ssh/checkaccess/", methods=["POST"]) @internal_access_only def check_ssh_access(): - """ Determines whether a user has read access to the requested repo. """ + """Determines whether a user has read access to the requested repo.""" gitdir = flask.request.form["gitdir"] remoteuser = flask.request.form["username"] _auth_log.info( diff --git a/pagure/lib/git.py b/pagure/lib/git.py index e6a82a1..5c41441 100644 --- a/pagure/lib/git.py +++ b/pagure/lib/git.py @@ -175,7 +175,7 @@ def generate_gitolite_acls(project=None, group=None): def update_git(obj, repo): - """ Schedules an update_repo task after determining arguments. """ + """Schedules an update_repo task after determining arguments.""" ticketuid = None requestuid = None if obj.isa == "issue": @@ -1005,7 +1005,7 @@ class TemporaryClone(object): self._parent = parent def __enter__(self): - """ Enter the context manager, creating the clone. """ + """Enter the context manager, creating the clone.""" self.repopath = tempfile.mkdtemp(prefix="pagure-%s-" % self._action) self._origrepopath = self.repopath if self._parent: @@ -1089,7 +1089,7 @@ class TemporaryClone(object): return self def __exit__(self, exc_type, exc_value, traceback): - """ Exit the context manager, removing the temorary clone. """ + """Exit the context manager, removing the temorary clone.""" shutil.rmtree(self.repopath) def change_project_association(self, new_project): @@ -1409,7 +1409,7 @@ def read_git_lines(args, abspath, keepends=False, error=False, **kw): def get_revs_between(oldrev, newrev, abspath, refname, forced=False): - """ Yield revisions between HEAD and BASE. """ + """Yield revisions between HEAD and BASE.""" cmd = ["rev-list", "%s...%s" % (oldrev, newrev)] if forced: @@ -1448,7 +1448,7 @@ def get_base_revision(torev, fromrev, abspath): def get_default_branch(abspath): - """ Return the default branch of a repo. """ + """Return the default branch of a repo.""" cmd = ["rev-parse", "--abbrev-ref", "HEAD"] out = pagure.lib.git.read_git_lines(cmd, abspath) if out: @@ -1458,7 +1458,7 @@ def get_default_branch(abspath): def get_author(commit, abspath): - """ Return the name of the person that authored the commit. """ + """Return the name of the person that authored the commit.""" user = pagure.lib.git.read_git_lines( ["log", "-1", '--pretty=format:"%an"', commit], abspath )[0].replace('"', "") @@ -1466,7 +1466,7 @@ def get_author(commit, abspath): def get_author_email(commit, abspath): - """ Return the email of the person that authored the commit. """ + """Return the email of the person that authored the commit.""" user = pagure.lib.git.read_git_lines( ["log", "-1", '--pretty=format:"%ae"', commit], abspath )[0].replace('"', "") @@ -1474,7 +1474,7 @@ def get_author_email(commit, abspath): def get_commit_subject(commit, abspath): - """ Return the subject of the commit. """ + """Return the subject of the commit.""" subject = pagure.lib.git.read_git_lines( ["log", "-1", '--pretty=format:"%s"', commit], abspath )[0].replace('"', "") @@ -2527,7 +2527,7 @@ def get_git_tags_objects(project): def log_commits_to_db(session, project, commits, gitdir): - """ Log the given commits to the DB. """ + """Log the given commits to the DB.""" repo_obj = PagureRepo(gitdir) for commitid in commits: @@ -3076,7 +3076,7 @@ def generate_archive(project, commit, tag, name, archive_fmt): def mirror_pull_project(session, project, debug=False): - """ Mirror locally a project from a remote URL. """ + """Mirror locally a project from a remote URL.""" remote = project.mirrored_from if not remote: _log.info("No remote found, ignoring") diff --git a/pagure/lib/git_auth.py b/pagure/lib/git_auth.py index 201be10..cdf3589 100644 --- a/pagure/lib/git_auth.py +++ b/pagure/lib/git_auth.py @@ -193,7 +193,7 @@ def _read_file(filename): class Gitolite2Auth(GitAuthHelper): - """ A gitolite 2 authentication module. """ + """A gitolite 2 authentication module.""" @classmethod def _process_project(cls, project, config, global_pr_only): @@ -805,7 +805,7 @@ class Gitolite2Auth(GitAuthHelper): class Gitolite3Auth(Gitolite2Auth): - """ A gitolite 3 authentication module. """ + """A gitolite 3 authentication module.""" @staticmethod def _individual_repos_command(config_file): @@ -852,18 +852,18 @@ class Gitolite3Auth(Gitolite2Auth): class PagureGitAuth(GitAuthHelper): - """ Standard Pagure git auth implementation. """ + """Standard Pagure git auth implementation.""" is_dynamic = True @classmethod def generate_acls(self, project, group=None): - """ This function is required but not used. """ + """This function is required but not used.""" pass @classmethod def remove_acls(self, session, project): - """ This function is required but not used. """ + """This function is required but not used.""" pass def info(self, msg): @@ -914,7 +914,7 @@ class PagureGitAuth(GitAuthHelper): class GitAuthTestHelper(GitAuthHelper): - """ Simple test auth module to check the auth customization system. """ + """Simple test auth module to check the auth customization system.""" is_dynamic = True diff --git a/pagure/lib/lib_ci.py b/pagure/lib/lib_ci.py index e4e22d1..71c64b8 100644 --- a/pagure/lib/lib_ci.py +++ b/pagure/lib/lib_ci.py @@ -145,7 +145,7 @@ def trigger_jenkins_build( ci_username=None, ci_password=None, ): - """ Trigger a build on a jenkins instance.""" + """Trigger a build on a jenkins instance.""" try: import jenkins except ImportError: diff --git a/pagure/lib/model.py b/pagure/lib/model.py index 7eabb34..53457dc 100644 --- a/pagure/lib/model.py +++ b/pagure/lib/model.py @@ -75,7 +75,7 @@ def create_tables(db_url, alembic_ini=None, acls=None, debug=False): # Ignore the warning about con_record # pylint: disable=unused-argument def _fk_pragma_on_connect(dbapi_con, _): # pragma: no cover - """ Tries to enforce referential constraints on sqlite. """ + """Tries to enforce referential constraints on sqlite.""" dbapi_con.execute("pragma foreign_keys=ON") sa.event.listen(engine, "connect", _fk_pragma_on_connect) @@ -156,7 +156,7 @@ def arrow_ts(value): class AccessLevels(BASE): - """ Different access levels a user/group can have for a project """ + """Different access levels a user/group can have for a project""" __tablename__ = "access_levels" @@ -226,7 +226,7 @@ class User(BASE): @property def username(self): - """ Return the username. """ + """Return the username.""" return self.user @property @@ -247,7 +247,7 @@ class User(BASE): @property def groups(self): - """ Return the list of Group.group_name in which the user is. """ + """Return the list of Group.group_name in which the user is.""" return [group.group_name for group in self.group_objs] @property @@ -271,22 +271,22 @@ class User(BASE): @settings.setter def settings(self, settings): - """ Ensures the settings are properly saved. """ + """Ensures the settings are properly saved.""" self._settings = json.dumps(settings) @property def full_url(self): - """ Returns the default status of the board. """ + """Returns the default status of the board.""" base_url = pagure_config["APP_URL"].rstrip("/") return "/".join([base_url, "user", self.user]) def __repr__(self): - """ Return a string representation of this object. """ + """Return a string representation of this object.""" return "User: %s - name %s" % (self.id, self.user) def to_json(self, public=False): - """ Return a representation of the User in a dictionary. """ + """Return a representation of the User in a dictionary.""" output = { "name": self.user, "fullname": self.fullname, @@ -524,7 +524,7 @@ class Project(BASE): @property def isa(self): - """ A string to allow finding out that this is a project. """ + """A string to allow finding out that this is a project.""" return "project" @property @@ -536,12 +536,12 @@ class Project(BASE): @property def is_on_repospanner(self): - """ Returns whether this repo is on repoSpanner. """ + """Returns whether this repo is on repoSpanner.""" return self.repospanner_region is not None @property def path(self): - """ Return the name of the git repo on the filesystem. """ + """Return the name of the git repo on the filesystem.""" return "%s.git" % self.fullname def repospanner_repo_info(self, repotype, region=None): @@ -659,13 +659,13 @@ class Project(BASE): @property def full_url(self): - """ Returns the default status of the board. """ + """Returns the default status of the board.""" base_url = pagure_config["APP_URL"].rstrip("/") return "/".join([base_url, self.url_path]) @property def tags_text(self): - """ Return the list of tags in a simple text form. """ + """Return the list of tags in a simple text form.""" return [tag.tag for tag in self.tags] @property @@ -714,7 +714,7 @@ class Project(BASE): @settings.setter def settings(self, settings): - """ Ensures the settings are properly saved. """ + """Ensures the settings are properly saved.""" self._settings = json.dumps(settings) @property @@ -743,7 +743,7 @@ class Project(BASE): @milestones.setter def milestones(self, milestones): - """ Ensures the milestones are properly saved. """ + """Ensures the milestones are properly saved.""" self._milestones = json.dumps(milestones) @property @@ -758,7 +758,7 @@ class Project(BASE): @milestones_keys.setter def milestones_keys(self, milestones_keys): - """ Ensures the milestones keys are properly saved. """ + """Ensures the milestones keys are properly saved.""" self._milestones_keys = json.dumps(milestones_keys) @property @@ -775,7 +775,7 @@ class Project(BASE): @priorities.setter def priorities(self, priorities): - """ Ensures the priorities are properly saved. """ + """Ensures the priorities are properly saved.""" self._priorities = json.dumps(priorities) @property @@ -792,7 +792,7 @@ class Project(BASE): @block_users.setter def block_users(self, block_users): - """ Ensures the block_users are properly saved. """ + """Ensures the block_users are properly saved.""" self._block_users = json.dumps(block_users) @property @@ -809,7 +809,7 @@ class Project(BASE): @quick_replies.setter def quick_replies(self, quick_replies): - """ Ensures the quick replies are properly saved. """ + """Ensures the quick replies are properly saved.""" self._quick_replies = json.dumps(quick_replies) @property @@ -826,7 +826,7 @@ class Project(BASE): @notifications.setter def notifications(self, notifications): - """ Ensures the notifications are properly saved. """ + """Ensures the notifications are properly saved.""" self._notifications = json.dumps(notifications) @property @@ -843,7 +843,7 @@ class Project(BASE): @reports.setter def reports(self, reports): - """ Ensures the reports are properly saved. """ + """Ensures the reports are properly saved.""" self._reports = json.dumps(reports) @property @@ -860,12 +860,12 @@ class Project(BASE): @close_status.setter def close_status(self, close_status): - """ Ensures the different close status are properly saved. """ + """Ensures the different close status are properly saved.""" self._close_status = json.dumps(close_status) @property def open_requests(self): - """ Returns the number of open pull-requests for this project. """ + """Returns the number of open pull-requests for this project.""" return ( BASE.metadata.bind.query(PullRequest) .filter(self.id == PullRequest.project_id) @@ -875,7 +875,7 @@ class Project(BASE): @property def open_tickets(self): - """ Returns the number of open tickets for this project. """ + """Returns the number of open tickets for this project.""" return ( BASE.metadata.bind.query(Issue) .filter(self.id == Issue.project_id) @@ -885,7 +885,7 @@ class Project(BASE): @property def open_tickets_public(self): - """ Returns the number of open tickets for this project. """ + """Returns the number of open tickets for this project.""" return ( BASE.metadata.bind.query(Issue) .filter(self.id == Issue.project_id) @@ -1095,7 +1095,7 @@ class Project(BASE): @property def active_boards(self): - """ Returns the list of active boards. """ + """Returns the list of active boards.""" return [board for board in self.boards if board.active] def lock(self, ltype): @@ -1289,14 +1289,14 @@ class SSHKey(BASE): # assigned to a Project or a User, but not both. @validates("project_id") def validate_project_id(self, key, value): - """ Validates that user_id is not set. """ + """Validates that user_id is not set.""" if self.user_id is not None: raise ValueError("SSHKey can't have both project and user") return value @validates("user_id") def validate_user_id(self, key, value): - """ Validates that project_id is not set. """ + """Validates that project_id is not set.""" if self.project_id is not None: raise ValueError("SSHKey can't have both user and project") return value @@ -1497,12 +1497,12 @@ class Issue(BASE): @property def isa(self): - """ A string to allow finding out that this is an issue. """ + """A string to allow finding out that this is an issue.""" return "issue" @property def repotype(self): - """ A string returning the repotype for repopath() calls. """ + """A string returning the repotype for repopath() calls.""" return "tickets" @property @@ -1514,17 +1514,17 @@ class Issue(BASE): @property def tags_text(self): - """ Return the list of tags in a simple text form. """ + """Return the list of tags in a simple text form.""" return sorted([tag.tag for tag in self.tags]) @property def depending_text(self): - """ Return the list of issue this issue depends on in simple text. """ + """Return the list of issue this issue depends on in simple text.""" return [issue.id for issue in self.parents] @property def blocking_text(self): - """ Return the list of issue this issue blocks on in simple text. """ + """Return the list of issue this issue blocks on in simple text.""" return [issue.id for issue in self.children] @property @@ -1550,7 +1550,7 @@ class Issue(BASE): @property def full_url(self): - """ Returns the default status of the board. """ + """Returns the default status of the board.""" base_url = pagure_config["APP_URL"].rstrip("/") return "/".join( [base_url, self.project.url_path, "issue", str(self.id)] @@ -1732,7 +1732,7 @@ class IssueComment(BASE): @property def parent(self): - """ Return the parent, in this case the issue object. """ + """Return the parent, in this case the issue object.""" return self.issue @property @@ -1746,7 +1746,7 @@ class IssueComment(BASE): @reactions.setter def reactions(self, reactions): - """ Ensures that reactions are properly saved. """ + """Ensures that reactions are properly saved.""" self._reactions = json.dumps(reactions) def to_json(self, public=False): @@ -1803,7 +1803,7 @@ class IssueKeys(BASE): @property def data(self): - """ Return the list of items """ + """Return the list of items""" if self.key_data: return json.loads(self.key_data) else: @@ -1811,7 +1811,7 @@ class IssueKeys(BASE): @data.setter def data(self, data_obj): - """ Store the list data in JSON. """ + """Store the list data in JSON.""" if data_obj is None: self.key_data = None else: @@ -2175,12 +2175,12 @@ class PullRequest(BASE): @property def isa(self): - """ A string to allow finding out that this is an pull-request. """ + """A string to allow finding out that this is an pull-request.""" return "pull-request" @property def repotype(self): - """ A string returning the repotype for repopath() calls. """ + """A string returning the repotype for repopath() calls.""" return "requests" @property @@ -2192,7 +2192,7 @@ class PullRequest(BASE): @property def tags_text(self): - """ Return the list of tags in a simple text form. """ + """Return the list of tags in a simple text form.""" return sorted([tag.tag for tag in self.tags]) @property @@ -2272,7 +2272,7 @@ class PullRequest(BASE): @property def full_url(self): - """ Returns the default status of the board. """ + """Returns the default status of the board.""" base_url = pagure_config["APP_URL"].rstrip("/") return "/".join( [base_url, self.project.url_path, "pull-request", str(self.id)] @@ -2402,7 +2402,7 @@ class PullRequestComment(BASE): @property def parent(self): - """ Return the parent, in this case the pull_request object. """ + """Return the parent, in this case the pull_request object.""" return self.pull_request @property @@ -2416,11 +2416,11 @@ class PullRequestComment(BASE): @reactions.setter def reactions(self, reactions): - """ Ensures that reactions are properly saved. """ + """Ensures that reactions are properly saved.""" self._reactions = json.dumps(reactions) def to_json(self, public=False): - """ Return a dict representation of the pull-request comment. """ + """Return a dict representation of the pull-request comment.""" return { "id": self.id, @@ -2600,7 +2600,7 @@ class CommitFlag(BASE): @property def isa(self): - """ A string to allow finding out that this is a commit flag. """ + """A string to allow finding out that this is a commit flag.""" return "commit-flag" @property @@ -2689,7 +2689,7 @@ class PagureGroupType(BASE): ) def __repr__(self): - """ Return a string representation of this object. """ + """Return a string representation of this object.""" return "GroupType: %s" % (self.group_type) @@ -2731,13 +2731,13 @@ class PagureGroup(BASE): ) def __repr__(self): - """ Return a string representation of this object. """ + """Return a string representation of this object.""" return "Group: %s - name %s" % (self.id, self.group_name) @property def full_url(self): - """ Returns the default status of the board. """ + """Returns the default status of the board.""" base_url = pagure_config["APP_URL"].rstrip("/") return "/".join([base_url, "group", self.group_name]) @@ -2965,7 +2965,7 @@ class PagureLog(BASE): return output def __str__(self): - """ A string representation of this log entry. """ + """A string representation of this log entry.""" verb = "" desc = "%(user)s %(verb)s %(project)s#%(obj_id)s" arg = { @@ -3117,7 +3117,7 @@ class ACL(BASE): ) def __repr__(self): - """ Return a string representation of this object. """ + """Return a string representation of this object.""" return "ACL: %s - name %s" % (self.id, self.name) @@ -3176,7 +3176,7 @@ class Token(BASE): ) def __repr__(self): - """ Return a string representation of this object. """ + """Return a string representation of this object.""" return "Token: %s - name %s - expiration: %s" % ( self.id, @@ -3186,7 +3186,7 @@ class Token(BASE): @property def expired(self): - """ Returns whether a token has expired or not. """ + """Returns whether a token has expired or not.""" if datetime.datetime.utcnow().date() >= self.expiration.date(): return True else: @@ -3287,7 +3287,7 @@ class Board(BASE): @property def default_status(self): - """ Returns the default status of the board. """ + """Returns the default status of the board.""" out = None for status in self.statuses: if status.default: @@ -3297,12 +3297,12 @@ class Board(BASE): @property def full_url(self): - """ Returns the default status of the board. """ + """Returns the default status of the board.""" base_url = pagure_config["APP_URL"].rstrip("/") return "/".join([base_url, self.project.url_path, "boards", self.name]) def __repr__(self): - """ Return a string representation of this object. """ + """Return a string representation of this object.""" return "Board: %s - name %s" % ( self.id, @@ -3310,7 +3310,7 @@ class Board(BASE): ) def to_json(self): - """ The JSON representation of a board. """ + """The JSON representation of a board.""" return { "name": self.name, "active": self.active, @@ -3362,7 +3362,7 @@ class BoardStatus(BASE): ) def __repr__(self): - """ Return a string representation of this object. """ + """Return a string representation of this object.""" return "BoardStatus: %s - board: %s - name %s" % ( self.id, @@ -3393,7 +3393,7 @@ class BoardStatus(BASE): ] def to_json(self): - """ The JSON representation of these objects. """ + """The JSON representation of these objects.""" return { "name": self.name, "bg_color": self.bg_color, @@ -3460,7 +3460,7 @@ class BoardIssues(BASE): ) def to_json(self): - """ The JSON representation of these objects. """ + """The JSON representation of these objects.""" return { "board": self.board.to_json() if self.board else None, "status": self.status.to_json(), diff --git a/pagure/lib/model_base.py b/pagure/lib/model_base.py index 38417b2..8b5737c 100644 --- a/pagure/lib/model_base.py +++ b/pagure/lib/model_base.py @@ -68,7 +68,7 @@ def create_session(db_url=None, debug=False, pool_recycle=3600): # Ignore the warning about con_record # pylint: disable=unused-argument def _fk_pragma_on_connect(dbapi_con, _): # pragma: no cover - """ Tries to enforce referential constraints on sqlite. """ + """Tries to enforce referential constraints on sqlite.""" dbapi_con.execute("pragma foreign_keys=ON") sqlalchemy.event.listen(engine, "connect", _fk_pragma_on_connect) diff --git a/pagure/lib/notify.py b/pagure/lib/notify.py index 27ee63c..63dc517 100644 --- a/pagure/lib/notify.py +++ b/pagure/lib/notify.py @@ -47,7 +47,7 @@ if pagure_config["EVENTSOURCE_SOURCE"]: def fedmsg_publish(*args, **kwargs): # pragma: no cover - """ Try to publish a message on the fedmsg bus. """ + """Try to publish a message on the fedmsg bus.""" if not pagure_config.get("FEDMSG_NOTIFICATIONS", True): return @@ -73,7 +73,7 @@ def fedmsg_publish(*args, **kwargs): # pragma: no cover def fedora_messaging_publish(topic, message): # pragma: no cover - """ Try to publish a message on AMQP using fedora-messaging. """ + """Try to publish a message on AMQP using fedora-messaging.""" if not pagure_config.get("FEDORA_MESSAGING_NOTIFICATIONS", False): return @@ -116,7 +116,7 @@ stomp_conn = None def stomp_publish(topic, message): - """ Try to publish a message on a Stomp-compliant message bus. """ + """Try to publish a message on a Stomp-compliant message bus.""" if not pagure_config.get("STOMP_NOTIFICATIONS", False): return # We catch Exception if we want :-p @@ -156,7 +156,7 @@ def blinker_publish(topic, message): def mqtt_publish(topic, message): - """ Try to publish a message on a MQTT message bus. """ + """Try to publish a message on a MQTT message bus.""" if not pagure_config.get("MQTT_NOTIFICATIONS", False): return @@ -377,7 +377,7 @@ def _get_emails_for_commit_notification(project): def _build_url(*args): - """ Build a URL from a given list of arguments. """ + """Build a URL from a given list of arguments.""" items = [] for idx, arg in enumerate(args): arg = "%s" % arg diff --git a/pagure/lib/plugins.py b/pagure/lib/plugins.py index a89cdf8..98529b2 100644 --- a/pagure/lib/plugins.py +++ b/pagure/lib/plugins.py @@ -45,13 +45,13 @@ def get_plugin_names(blacklist=None, without_backref=False): def get_plugin_tables(): - """ Return the list of all plugins. """ + """Return the list of all plugins.""" plugins = load("pagure.hooks", subclasses=BASE) return plugins def get_plugin(plugin_name): - """ Return the list of plugins names. """ + """Return the list of plugins names.""" from pagure.hooks import BaseHook plugins = load("pagure.hooks", subclasses=BaseHook) diff --git a/pagure/lib/query.py b/pagure/lib/query.py index 6047b78..f498091 100644 --- a/pagure/lib/query.py +++ b/pagure/lib/query.py @@ -109,14 +109,14 @@ class Unspecified(object): def set_redis(host, port, dbname): - """ Set the redis connection with the specified information. """ + """Set the redis connection with the specified information.""" global REDIS pool = redis.ConnectionPool(host=host, port=port, db=dbname) REDIS = redis.StrictRedis(connection_pool=pool) def set_pagure_ci(services): - """ Set the list of CI services supported by this pagure instance. """ + """Set the list of CI services supported by this pagure instance.""" global PAGURE_CI PAGURE_CI = services @@ -220,7 +220,7 @@ def search_user(session, username=None, email=None, token=None, pattern=None): def is_valid_ssh_key(key, fp_hash="SHA256"): - """ Validates the ssh key using ssh-keygen. """ + """Validates the ssh key using ssh-keygen.""" key = key.strip() if not key: return None @@ -244,7 +244,7 @@ def is_valid_ssh_key(key, fp_hash="SHA256"): def are_valid_ssh_keys(keys): - """ Checks if all the ssh keys are valid or not. """ + """Checks if all the ssh keys are valid or not.""" return all( [is_valid_ssh_key(key) is not False for key in keys.split("\n")] ) @@ -373,7 +373,7 @@ def add_issue_comment( date_created=None, notification=False, ): - """ Add a comment to an issue. """ + """Add a comment to an issue.""" user_obj = get_user(session, user) issue_comment = model.IssueComment( @@ -445,7 +445,7 @@ def add_issue_comment( def add_tag_obj(session, obj, tags, user): - """ Add a tag to an object (either an issue or a project). """ + """Add a tag to an object (either an issue or a project).""" user_obj = get_user(session, user) if isinstance(tags, six.string_types): @@ -563,7 +563,7 @@ def add_tag_obj(session, obj, tags, user): def add_issue_assignee(session, issue, assignee, user, notify=True): - """ Add an assignee to an issue, in other words, assigned an issue. """ + """Add an assignee to an issue, in other words, assigned an issue.""" user_obj = get_user(session, user) old_assignee = issue.assignee @@ -640,7 +640,7 @@ def add_issue_assignee(session, issue, assignee, user, notify=True): def add_pull_request_assignee(session, request, assignee, user): - """ Add an assignee to a request, in other words, assigned an issue. """ + """Add an assignee to a request, in other words, assigned an issue.""" get_user(session, assignee) user_obj = get_user(session, user) @@ -719,7 +719,7 @@ def add_pull_request_assignee(session, request, assignee, user): def add_issue_dependency(session, issue, issue_blocked, user): - """ Add a dependency between two issues. """ + """Add a dependency between two issues.""" user_obj = get_user(session, user) if issue.uid == issue_blocked.uid: @@ -777,7 +777,7 @@ def add_issue_dependency(session, issue, issue_blocked, user): def remove_issue_dependency(session, issue, issue_blocked, user): - """ Remove a dependency between two issues. """ + """Remove a dependency between two issues.""" user_obj = get_user(session, user) if issue.uid == issue_blocked.uid: @@ -839,7 +839,7 @@ def remove_issue_dependency(session, issue, issue_blocked, user): def remove_tags(session, project, tags, user): - """ Removes the specified tag of a project. """ + """Removes the specified tag of a project.""" user_obj = get_user(session, user) if not isinstance(tags, list): @@ -885,7 +885,7 @@ def remove_tags(session, project, tags, user): def remove_tags_obj(session, obj, tags, user): - """ Removes the specified tag(s) of a given object. """ + """Removes the specified tag(s) of a given object.""" user_obj = get_user(session, user) if isinstance(tags, six.string_types): @@ -971,7 +971,7 @@ def edit_issue_tags( new_tag_color, user, ): - """ Edits the specified tag of a project. """ + """Edits the specified tag of a project.""" user_obj = get_user(session, user) old_tag_name = old_tag @@ -1068,7 +1068,7 @@ def edit_issue_tags( def add_sshkey_to_project_or_user( session, ssh_key, pushaccess, creator, project=None, user=None ): - """ Add a deploy key to a specified project. """ + """Add a deploy key to a specified project.""" if project is None and user is None: raise ValueError( "SSH Keys need to be added to either a project or a user" @@ -1234,7 +1234,7 @@ def add_group_to_project( create=False, is_admin=False, ): - """ Add a specified group to a specified project with some access """ + """Add a specified group to a specified project with some access""" user_obj = search_user(session, username=user) if not user_obj: @@ -1351,7 +1351,7 @@ def add_pull_request_comment( notification=False, trigger_ci=None, ): - """ Add a comment to a pull-request. """ + """Add a comment to a pull-request.""" user_obj = get_user(session, user) pr_comment = model.PullRequestComment( @@ -1455,7 +1455,7 @@ def add_pull_request_comment( def edit_comment(session, parent, comment, user, updated_comment): - """ Edit a comment. """ + """Edit a comment.""" user_obj = get_user(session, user) comment.comment = updated_comment comment.edited_on = datetime.datetime.utcnow() @@ -1529,7 +1529,7 @@ def edit_comment(session, parent, comment, user, updated_comment): def add_pull_request_flag( session, request, username, percent, comment, url, status, uid, user, token ): - """ Add a flag to a pull-request. """ + """Add a flag to a pull-request.""" user_obj = get_user(session, user) action, flag_uid = add_commit_flag( @@ -1583,7 +1583,7 @@ def add_commit_flag( user, token, ): - """ Add a flag to a add_commit_flag. """ + """Add a flag to a add_commit_flag.""" user_obj = get_user(session, user) action = "added" @@ -1791,7 +1791,7 @@ def new_issue( assignee=None, tags=None, ): - """ Create a new issue for the specified repo. """ + """Create a new issue for the specified repo.""" user_obj = get_user(session, user) # Only store the priority if there is one in the project @@ -1876,7 +1876,7 @@ def new_issue( def drop_issue(session, issue, user): - """ Delete a specified issue. """ + """Delete a specified issue.""" user_obj = get_user(session, user) repotype = issue.repotype @@ -1924,7 +1924,7 @@ def new_pull_request( commit_start=None, commit_stop=None, ): - """ Create a new pull request on the specified repo. """ + """Create a new pull request on the specified repo.""" if not repo_from and not remote_git: raise pagure.exceptions.PagureException( "Invalid input, you must specify either a local repo or a " @@ -2058,7 +2058,7 @@ def link_pr_to_issue_on_description(session, request): def new_tag(session, tag_name, tag_description, tag_color, project_id): - """ Return a new tag object """ + """Return a new tag object""" tagobj = model.TagColored( tag=tag_name, tag_description=tag_description, @@ -2305,7 +2305,7 @@ def update_project_settings(session, repo, settings, user, from_api=False): def update_user_settings(session, settings, user): - """ Update the settings of a project. """ + """Update the settings of a project.""" user_obj = get_user(session, user) update = [] @@ -2331,7 +2331,7 @@ def update_user_settings(session, settings, user): def fork_project(session, user, repo, editbranch=None, editfile=None): - """ Fork a given project into the user's forks. """ + """Fork a given project into the user's forks.""" if _get_project(session, repo.name, user, repo.namespace) is not None: raise pagure.exceptions.RepoExistsException( 'Repo "forks/%s/%s" already exists' % (user, repo.name) @@ -3532,7 +3532,7 @@ def reset_status_pull_request(session, project, but_uids=None): def add_attachment(repo, issue, attachmentfolder, user, filename, filestream): - """ Add a file to the attachments folder of repo and update git. """ + """Add a file to the attachments folder of repo and update git.""" _log.info( "Adding file: %s to the git repo: %s", repo.path, @@ -3704,7 +3704,7 @@ def set_up_user( ssh_key=None, keydir=None, ): - """ Set up a new user into the database or update its information. """ + """Set up a new user into the database or update its information.""" user = search_user(session, username=username) if not user: user = model.User( @@ -3753,7 +3753,7 @@ def allowed_emailaddress(email): def add_email_to_user(session, user, user_email): - """ Add the provided email to the specified user. """ + """Add the provided email to the specified user.""" try: allowed_emailaddress(user_email) except pagure.exceptions.PagureException: @@ -3768,7 +3768,7 @@ def add_email_to_user(session, user, user_email): def update_user_ssh(session, user, ssh_key, keydir, update_only=False): - """ Set up a new user into the database or update its information. """ + """Set up a new user into the database or update its information.""" if isinstance(user, six.string_types): user = get_user(session, user) @@ -4312,7 +4312,7 @@ def get_user_group(session, userid, groupid): def is_group_member(session, user, groupname): - """ Return whether the user is a member of the specified group. """ + """Return whether the user is a member of the specified group.""" if not user: return False @@ -4447,7 +4447,7 @@ def text2markdown(text, extended=True, readme=False): def filter_img_src(name, value): - """ Filter in img html tags images coming from a different domain. """ + """Filter in img html tags images coming from a different domain.""" if name in ("alt", "height", "width", "class", "data-src"): return True if name == "src": @@ -4830,7 +4830,7 @@ def get_watch_level_on_repo( def user_watch_list(session, user, exclude_groups=None): - """ Returns list of all the projects which the user is watching """ + """Returns list of all the projects which the user is watching""" user_obj = search_user(session, username=user) if not user_obj: @@ -5198,7 +5198,7 @@ def get_watchlist_messages(session, user, limit=None): def log_action(session, action, obj, user_obj): - """ Log an user action on a project/issue/PR. """ + """Log an user action on a project/issue/PR.""" project_id = None if obj.isa in ["issue", "pull-request"]: project_id = obj.project_id @@ -5232,7 +5232,7 @@ def log_action(session, action, obj, user_obj): def email_logs_count(session, email): - """ Returns the number of logs associated with a given email.""" + """Returns the number of logs associated with a given email.""" query = session.query(model.PagureLog).filter( model.PagureLog.user_email == email ) @@ -5250,7 +5250,7 @@ def update_log_email_user(session, email, user): def get_custom_key(session, project, keyname): - """ Returns custom key object given it's name and the project """ + """Returns custom key object given it's name and the project""" query = ( session.query(model.IssueKeys) @@ -5376,7 +5376,7 @@ def tokenize_search_string(pattern): def get_access_levels(session): - """ Returns all the access levels a user/group can have for a project """ + """Returns all the access levels a user/group can have for a project""" access_level_objs = session.query(model.AccessLevels).all() return [access_level.access for access_level in access_level_objs] diff --git a/pagure/lib/repo.py b/pagure/lib/repo.py index 4592fe6..3638a9c 100644 --- a/pagure/lib/repo.py +++ b/pagure/lib/repo.py @@ -79,7 +79,7 @@ class PagureRepo(pygit2.Repository): @staticmethod def push(remote, refname): - """ Push the given reference to the specified remote. """ + """Push the given reference to the specified remote.""" pygit2_version = get_pygit2_version() if pygit2_version >= (0, 22): remote.push([refname]) diff --git a/pagure/lib/tasks_services.py b/pagure/lib/tasks_services.py index 72ccc86..1fc4ebd 100644 --- a/pagure/lib/tasks_services.py +++ b/pagure/lib/tasks_services.py @@ -57,7 +57,7 @@ def augment_celery_log(**kwargs): def call_web_hooks(project, topic, msg, urls): - """ Sends the web-hook notification. """ + """Sends the web-hook notification.""" _log.info("Processing project: %s - topic: %s", project.fullname, topic) _log.debug("msg: %s", msg) diff --git a/pagure/lib/tasks_utils.py b/pagure/lib/tasks_utils.py index 6cc453d..0a3de9c 100644 --- a/pagure/lib/tasks_utils.py +++ b/pagure/lib/tasks_utils.py @@ -25,7 +25,7 @@ def pagure_task(function): @wraps(function) def decorated_function(self, *args, **kwargs): - """ Decorated function, actually does the work. """ + """Decorated function, actually does the work.""" if self is not None: try: self.update_state(state="RUNNING") @@ -47,6 +47,6 @@ def pagure_task(function): def gc_clean(): - """ Force a run of the garbage collector. """ + """Force a run of the garbage collector.""" # https://pagure.io/pagure/issue/2302 gc.collect() diff --git a/pagure/login_forms.py b/pagure/login_forms.py index 7e6418a..56cf91c 100644 --- a/pagure/login_forms.py +++ b/pagure/login_forms.py @@ -39,7 +39,7 @@ def same_password(form, field): class LostPasswordForm(FlaskForm): - """ Form to ask for a password change. """ + """Form to ask for a password change.""" username = wtforms.StringField( "username", @@ -48,7 +48,7 @@ class LostPasswordForm(FlaskForm): class ResetPasswordForm(FlaskForm): - """ Form to reset one's password in the local database. """ + """Form to reset one's password in the local database.""" password = wtforms.PasswordField( "Password", @@ -61,7 +61,7 @@ class ResetPasswordForm(FlaskForm): class LoginForm(FlaskForm): - """ Form to login via the local database. """ + """Form to login via the local database.""" username = wtforms.StringField( "username", @@ -74,7 +74,7 @@ class LoginForm(FlaskForm): class NewUserForm(FlaskForm): - """ Form to add a new user to the local database. """ + """Form to add a new user to the local database.""" user = wtforms.StringField( "username", @@ -98,7 +98,7 @@ class NewUserForm(FlaskForm): class ChangePasswordForm(FlaskForm): - """ Form to reset one's password in the local database. """ + """Form to reset one's password in the local database.""" old_password = wtforms.PasswordField( "Old Password", diff --git a/pagure/mail_logging.py b/pagure/mail_logging.py index 6c7b185..a8dad19 100644 --- a/pagure/mail_logging.py +++ b/pagure/mail_logging.py @@ -45,7 +45,7 @@ except (OSError, ImportError): # pragma: no cover def format_callstack(): - """ Format the callstack to find out the stack trace. """ + """Format the callstack to find out the stack trace.""" ind = 0 for ind, frame in enumerate(f[0] for f in inspect.stack()): if "__name__" not in frame.f_globals: @@ -55,7 +55,7 @@ def format_callstack(): break def _format_frame(frame): - """ Format the frame. """ + """Format the frame.""" return ' File "%s", line %i in %s\n %s' % (frame) stack = traceback.extract_stack() @@ -88,7 +88,7 @@ class ContextInjector(logging.Filter): # pragma: no cover """ def filter(self, record): - """ Set up additional information on the record object. """ + """Set up additional information on the record object.""" current_process = ContextInjector.get_current_process() current_hostname = socket.gethostname() @@ -136,7 +136,7 @@ class ContextInjector(logging.Filter): # pragma: no cover @staticmethod def get_current_process(): - """ Return the current process (PID). """ + """Return the current process (PID).""" if not psutil: return "Could not import psutil" return psutil.Process() diff --git a/pagure/pfmarkdown.py b/pagure/pfmarkdown.py index b265b3f..706c74c 100644 --- a/pagure/pfmarkdown.py +++ b/pagure/pfmarkdown.py @@ -90,10 +90,10 @@ STRIKE_THROUGH_RE = r"~~(.*?)~~" class MentionPattern(markdown.inlinepatterns.Pattern): - """ @user pattern class. """ + """@user pattern class.""" def handleMatch(self, m): - """ When the pattern matches, update the text. """ + """When the pattern matches, update the text.""" _log.debug("MentionPattern: %s", m.groups()) name = markdown.util.AtomicString(m.group(2)) @@ -113,10 +113,10 @@ class MentionPattern(markdown.inlinepatterns.Pattern): class ExplicitLinkPattern(markdown.inlinepatterns.Pattern): - """ Explicit link pattern. """ + """Explicit link pattern.""" def handleMatch(self, m): - """ When the pattern matches, update the text. """ + """When the pattern matches, update the text.""" _log.debug("ExplicitLinkPattern: %s", m.groups()) is_fork = m.group(2) @@ -154,10 +154,10 @@ class ExplicitLinkPattern(markdown.inlinepatterns.Pattern): class CommitLinkPattern(markdown.inlinepatterns.Pattern): - """ Commit link pattern. """ + """Commit link pattern.""" def handleMatch(self, m): - """ When the pattern matches, update the text. """ + """When the pattern matches, update the text.""" _log.debug("CommitLinkPattern: %s", m.groups()) is_fork = m.group(2) @@ -238,10 +238,10 @@ class ImplicitIssuePreprocessor(markdown.preprocessors.Preprocessor): class ImplicitIssuePattern(markdown.inlinepatterns.Pattern): - """ Implicit issue pattern. """ + """Implicit issue pattern.""" def handleMatch(self, m): - """ When the pattern matches, update the text. """ + """When the pattern matches, update the text.""" _log.debug("ImplicitIssuePattern: %s", m.groups()) idx = markdown.util.AtomicString(m.group(2)) text = "#%s" % idx @@ -280,10 +280,10 @@ class ImplicitIssuePattern(markdown.inlinepatterns.Pattern): class ImplicitPRPattern(markdown.inlinepatterns.Pattern): - """ Implicit pull-request pattern. """ + """Implicit pull-request pattern.""" def handleMatch(self, m): - """ When the pattern matches, update the text. """ + """When the pattern matches, update the text.""" _log.debug("ImplicitPRPattern: %s", m.groups()) idx = markdown.util.AtomicString(m.group(2)) text = "PR#%s" % idx @@ -309,10 +309,10 @@ class ImplicitPRPattern(markdown.inlinepatterns.Pattern): class ImplicitCommitPattern(markdown.inlinepatterns.Pattern): - """ Implicit commit pattern. """ + """Implicit commit pattern.""" def handleMatch(self, m): - """ When the pattern matches, update the text. """ + """When the pattern matches, update the text.""" _log.debug("ImplicitCommitPattern: %s", m.groups()) githash = markdown.util.AtomicString(m.group(2)) @@ -332,10 +332,10 @@ class ImplicitCommitPattern(markdown.inlinepatterns.Pattern): class StrikeThroughPattern(markdown.inlinepatterns.Pattern): - """ ~~striked~~ pattern class. """ + """~~striked~~ pattern class.""" def handleMatch(self, m): - """ When the pattern matches, update the text. """ + """When the pattern matches, update the text.""" _log.debug("StrikeThroughPattern: %s", m.groups()) text = markdown.util.AtomicString(m.group(2)) @@ -346,7 +346,7 @@ class StrikeThroughPattern(markdown.inlinepatterns.Pattern): class AutolinkPattern2(markdown.inlinepatterns.Pattern): - """ Return a link Element given an autolink (``). """ + """Return a link Element given an autolink (``).""" def handleMatch(self, m): """When the pattern matches, update the text. @@ -368,7 +368,7 @@ class AutolinkPattern2(markdown.inlinepatterns.Pattern): class ImagePatternLazyLoad(ImagePattern): - """ Customize the image element matched for lazyloading. """ + """Customize the image element matched for lazyloading.""" def handleMatch(self, m, *args): out = super(ImagePatternLazyLoad, self).handleMatch(m, *args) @@ -516,7 +516,7 @@ def makeExtension(*arg, **kwargs): def _issue_exists(user, namespace, repo, idx): - """ Utility method checking if a given issue exists. """ + """Utility method checking if a given issue exists.""" repo_obj = pagure.lib.query.get_authorized_project( flask.g.session, project_name=repo, user=user, namespace=namespace @@ -535,7 +535,7 @@ def _issue_exists(user, namespace, repo, idx): def _pr_exists(user, namespace, repo, idx): - """ Utility method checking if a given PR exists. """ + """Utility method checking if a given PR exists.""" repo_obj = pagure.lib.query.get_authorized_project( flask.g.session, project_name=repo, user=user, namespace=namespace ) @@ -553,7 +553,7 @@ def _pr_exists(user, namespace, repo, idx): def _commit_exists(user, namespace, repo, githash): - """ Utility method checking if a given commit exists. """ + """Utility method checking if a given commit exists.""" repo_obj = pagure.lib.query.get_authorized_project( flask.g.session, project_name=repo, user=user, namespace=namespace ) diff --git a/pagure/ui/app.py b/pagure/ui/app.py index 63467f1..7d82909 100644 --- a/pagure/ui/app.py +++ b/pagure/ui/app.py @@ -1128,7 +1128,7 @@ def new_project(): @UI_NS.route("/wait/") def wait_task(taskid): - """ Shows a wait page until the task finishes. """ + """Shows a wait page until the task finishes.""" task = pagure.lib.tasks.get_result(taskid) is_js = is_true(flask.request.args.get("js")) diff --git a/pagure/ui/fas_login.py b/pagure/ui/fas_login.py index 8d6ef43..3e37e37 100644 --- a/pagure/ui/fas_login.py +++ b/pagure/ui/fas_login.py @@ -31,7 +31,7 @@ _log = logging.getLogger(__name__) @FAS.postlogin def set_user(return_url): - """ After login method. """ + """After login method.""" if flask.g.fas_user.username is None: flask.flash( "It looks like your OpenID provider did not provide an " @@ -153,8 +153,8 @@ def set_user(return_url): flask.flash(str(err), "error") if flask.g.fas_user.get("ssh_key"): - del(flask.g.fas_user.ssh_key) + del flask.g.fas_user.ssh_key if flask.session.get("FLASK_FAS_OPENID_USER").get("ssh_key"): - del(flask.session["FLASK_FAS_OPENID_USER"]["ssh_key"]) + del flask.session["FLASK_FAS_OPENID_USER"]["ssh_key"] return flask.redirect(return_url) diff --git a/pagure/ui/filters.py b/pagure/ui/filters.py index 9743e13..188c803 100644 --- a/pagure/ui/filters.py +++ b/pagure/ui/filters.py @@ -812,7 +812,7 @@ def user_can_clone_ssh(username): @UI_NS.app_template_filter("user_group_can_ssh_commit") def user_group_can_ssh_commit(username): - """ Returns whether the user is in a group that has ssh access. """ + """Returns whether the user is in a group that has ssh access.""" ssh_access_groups = pagure_config.get("SSH_ACCESS_GROUPS") or [] if not ssh_access_groups: # ssh access is not restricted to one or more groups @@ -846,7 +846,7 @@ def get_git_url_ssh(complement=""): @UI_NS.app_template_filter("patch_stats") def get_patch_stats(patch): - """ Return a dict of stats about the provided patch.""" + """Return a dict of stats about the provided patch.""" try: output = pagure.lib.git.get_stats_patch(patch) except pagure.exceptions.PagureException: @@ -857,7 +857,7 @@ def get_patch_stats(patch): @UI_NS.app_template_filter("get_default_branch") def get_default_branch(repo): - """ Given a pygit2.Repository object, extracts the default branch. """ + """Given a pygit2.Repository object, extracts the default branch.""" default_branch = None try: diff --git a/pagure/ui/fork.py b/pagure/ui/fork.py index 0ba221f..42eabef 100644 --- a/pagure/ui/fork.py +++ b/pagure/ui/fork.py @@ -1448,7 +1448,7 @@ def refresh_request_pull(repo, requestid, username=None, namespace=None): ) @login_required def update_pull_requests(repo, requestid, username=None, namespace=None): - """ Update the metadata of a pull-request. """ + """Update the metadata of a pull-request.""" repo = flask.g.repo if not repo.settings.get("pull_requests", True): diff --git a/pagure/ui/groups.py b/pagure/ui/groups.py index b258de9..a9ec736 100644 --- a/pagure/ui/groups.py +++ b/pagure/ui/groups.py @@ -29,7 +29,7 @@ _log = logging.getLogger(__name__) @UI_NS.route("/groups/") @UI_NS.route("/groups") def group_lists(): - """ List all the groups associated with all the projects. """ + """List all the groups associated with all the projects.""" group_type = "user" if pagure.utils.is_admin(): @@ -56,7 +56,7 @@ def group_lists(): @UI_NS.route("/group//", methods=["GET", "POST"]) @UI_NS.route("/group/", methods=["GET", "POST"]) def view_group(group): - """ Displays information about this group. """ + """Displays information about this group.""" if flask.request.method == "POST" and not pagure_config.get( "ENABLE_USER_MNGT", True ): @@ -128,7 +128,7 @@ def view_group(group): @UI_NS.route("/group//edit", methods=["GET", "POST"]) @login_required def edit_group(group): - """ Allows editing the information about this group. """ + """Allows editing the information about this group.""" if not pagure_config.get("ENABLE_USER_MNGT", True): flask.abort(404) @@ -183,7 +183,7 @@ def edit_group(group): @UI_NS.route("/group//give", methods=["POST"]) @login_required def give_group(group): - """ Allows giving away a group. """ + """Allows giving away a group.""" if not pagure_config.get("ENABLE_USER_MNGT", True): flask.abort(404) diff --git a/pagure/ui/issues.py b/pagure/ui/issues.py index 101252c..298847b 100644 --- a/pagure/ui/issues.py +++ b/pagure/ui/issues.py @@ -76,7 +76,7 @@ _log = logging.getLogger(__name__) @login_required @has_issue_tracker def update_issue(repo, issueid, username=None, namespace=None): - """ Add comment or update metadata of an issue. """ + """Add comment or update metadata of an issue.""" is_js = flask.request.args.get("js", False) repo = flask.g.repo diff --git a/pagure/ui/login.py b/pagure/ui/login.py index ef78bbd..91ecad4 100644 --- a/pagure/ui/login.py +++ b/pagure/ui/login.py @@ -463,7 +463,7 @@ def _check_session_cookie(): def _send_session_cookie(response): - """ Set the session cookie if the user is authenticated. """ + """Set the session cookie if the user is authenticated.""" cookie_name = pagure.config.config.get("SESSION_COOKIE_NAME", "pagure") secure = pagure.config.config.get("SESSION_COOKIE_SECURE", True) diff --git a/pagure/ui/repo.py b/pagure/ui/repo.py index 1997fce..c568848 100644 --- a/pagure/ui/repo.py +++ b/pagure/ui/repo.py @@ -968,7 +968,7 @@ def view_commit_diff(repo, commitid, username=None, namespace=None): def view_commit_patch_or_diff( repo, commitid, username=None, namespace=None, diff=False, is_js=False ): - """ Renders a commit either as a patch or as a diff. """ + """Renders a commit either as a patch or as a diff.""" repo_obj = flask.g.repo_obj @@ -2746,7 +2746,7 @@ def view_project_activity(repo, namespace=None): @UI_NS.route("///stargazers/") @UI_NS.route("/fork////stargazers/") def view_stargazers(repo, username=None, namespace=None): - """ View all the users who have starred the project """ + """View all the users who have starred the project""" stargazers = flask.g.repo.stargazers users = [star.user for star in stargazers] diff --git a/pagure/utils.py b/pagure/utils.py index a99eaf8..8b24e47 100644 --- a/pagure/utils.py +++ b/pagure/utils.py @@ -167,7 +167,7 @@ def is_safe_url(target): # pragma: no cover def is_admin(): - """ Return whether the user is admin for this application or not. """ + """Return whether the user is admin for this application or not.""" if not authenticated(): return False @@ -194,7 +194,7 @@ def is_admin(): def is_repo_admin(repo_obj, username=None): - """ Return whether the user is an admin of the provided repo. """ + """Return whether the user is an admin of the provided repo.""" if not authenticated(): return False @@ -216,7 +216,7 @@ def is_repo_admin(repo_obj, username=None): def is_repo_committer(repo_obj, username=None, session=None): - """ Return whether the user is a committer of the provided repo. """ + """Return whether the user is a committer of the provided repo.""" import pagure.lib.query usergroups = set() @@ -328,7 +328,7 @@ def is_repo_collaborator(repo_obj, refname, username=None, session=None): def is_repo_user(repo_obj, username=None): - """ Return whether the user has some access in the provided repo. """ + """Return whether the user has some access in the provided repo.""" if username: user = username else: @@ -375,7 +375,7 @@ def login_required(function): @wraps(function) def decorated_function(*args, **kwargs): - """ Decorated function, actually does the work. """ + """Decorated function, actually does the work.""" auth_method = pagure_config.get("PAGURE_AUTH", None) if flask.session.get("_justloggedout", False): return flask.redirect(flask.url_for("ui_ns.index")) diff --git a/tests/__init__.py b/tests/__init__.py index 28d33c1..598ebf5 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -150,7 +150,7 @@ WAIT_REGEX = re.compile(r"""var _url = '(\/wait\/[a-z0-9-]+\??.*)'""") def get_wait_target(html): - """ This parses the window.location out of the HTML for the wait page. """ + """This parses the window.location out of the HTML for the wait page.""" found = WAIT_REGEX.findall(html) if len(found) == 0: raise Exception("Not able to get wait target in %s" % html) @@ -158,7 +158,7 @@ def get_wait_target(html): def get_post_target(html): - """ This parses the wait page form to get the POST url. """ + """This parses the wait page form to get the POST url.""" soup = BeautifulSoup(html, "html.parser") form = soup.find(id="waitform") if not form: @@ -167,7 +167,7 @@ def get_post_target(html): def get_post_args(html): - """ This parses the wait page for the hidden arguments of the form. """ + """This parses the wait page for the hidden arguments of the form.""" soup = BeautifulSoup(html, "html.parser") output = {} inputs = soup.find_all("input") @@ -181,7 +181,7 @@ def get_post_args(html): def create_maybe_waiter(method, getter): def maybe_waiter(*args, **kwargs): - """ A wrapper for self.app.get()/.post() that will resolve wait's """ + """A wrapper for self.app.get()/.post() that will resolve wait's""" result = method(*args, **kwargs) # Handle the POST wait case @@ -223,7 +223,7 @@ def create_maybe_waiter(method, getter): @contextmanager def user_set(APP, user, keep_get_user=False): - """ Set the provided user as fas_user in the provided application.""" + """Set the provided user as fas_user in the provided application.""" # Hack used to remove the before_request function set by # flask.ext.fas_openid.FAS which otherwise kills our effort to set a @@ -296,7 +296,7 @@ class SimplePagureTest(unittest.TestCase): @mock.patch("pagure.lib.notify.fedmsg_publish", mock.MagicMock()) def __init__(self, method_name="runTest"): - """ Constructor. """ + """Constructor.""" unittest.TestCase.__init__(self, method_name) self.session = None self.path = None @@ -305,7 +305,7 @@ class SimplePagureTest(unittest.TestCase): self.results = {} def perfMaxWalks(self, max_walks, max_steps): - """ Check that we have not performed too many walks/steps. """ + """Check that we have not performed too many walks/steps.""" num_walks = 0 num_steps = 0 for reqstat in perfrepo.REQUESTS: @@ -326,7 +326,7 @@ class SimplePagureTest(unittest.TestCase): ) def perfReset(self): - """ Reset perfrepo stats. """ + """Reset perfrepo stats.""" perfrepo.reset_stats() perfrepo.REQUESTS = [] @@ -488,7 +488,7 @@ class SimplePagureTest(unittest.TestCase): self.session.commit() def set_auth_status(self, value): - """ Set the return value for the test auth """ + """Set the return value for the test auth""" with open( os.path.join(self.path, "testauth_status.json"), "w" ) as statusfile: @@ -520,7 +520,7 @@ class SimplePagureTest(unittest.TestCase): return tuple(wtforms_v) def get_arrow_version(self): - """ Returns the arrow version as a tuple.""" + """Returns the arrow version as a tuple.""" import arrow arrow_v = arrow.__version__.split(".") @@ -544,10 +544,10 @@ class SimplePagureTest(unittest.TestCase): class Modeltests(SimplePagureTest): - """ Model tests. """ + """Model tests.""" def setUp(self): # pylint: disable=invalid-name - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" # Clean up test performance info super(Modeltests, self).setUp() self.app.get = create_maybe_waiter(self.app.get, self.app.get) @@ -557,7 +557,7 @@ class Modeltests(SimplePagureTest): self.session = pagure.lib.query.create_session(self.dbpath) def tearDown(self): # pylint: disable=invalid-name - """ Remove the test.db database if there is one. """ + """Remove the test.db database if there is one.""" self.broker_client.flushall() super(Modeltests, self).tearDown() @@ -596,7 +596,7 @@ class FakeGroup(object): # pylint: disable=too-few-public-methods class FakeUser(object): # pylint: disable=too-few-public-methods - """ Fake user used to test the fedocallib library. """ + """Fake user used to test the fedocallib library.""" def __init__( self, groups=None, username="username", cla_done=True, id=None @@ -637,7 +637,7 @@ def create_locks(session, project): def create_projects(session, is_fork=False, user_id=1, hook_token_suffix=""): - """ Create some projects in the database. """ + """Create some projects in the database.""" item = pagure.lib.model.Project( user_id=user_id, # pingou name="test", @@ -681,7 +681,7 @@ def create_projects(session, is_fork=False, user_id=1, hook_token_suffix=""): def create_projects_git(folder, bare=False): - """ Create some projects in the database. """ + """Create some projects in the database.""" repos = [] for project in [ "test.git", @@ -697,7 +697,7 @@ def create_projects_git(folder, bare=False): def create_tokens(session, user_id=1, project_id=1, suffix=None): - """ Create some tokens for the project in the database. """ + """Create some tokens for the project in the database.""" token = "aaabbbcccddd" if suffix: token += suffix @@ -791,7 +791,7 @@ def _clone_and_top_commits(folder, branch, branch_ref=False): def add_content_git_repo(folder, branch="master", append=None): - """ Create some content for the specified git repo. """ + """Create some content for the specified git repo.""" repo, newfolder, parents = _clone_and_top_commits(folder, branch) # Create a file in that git repo @@ -864,7 +864,7 @@ def add_content_git_repo(folder, branch="master", append=None): def add_readme_git_repo(folder, readme_name="README.rst", branch="master"): - """ Create a README file for the specified git repo. """ + """Create a README file for the specified git repo.""" repo, newfolder, parents = _clone_and_top_commits(folder, branch) if readme_name == "README.rst": @@ -930,7 +930,7 @@ that should never get displayed on the website if there is a README.rst in the r def add_commit_git_repo( folder, ncommits=10, filename="sources", branch="master", symlink_to=None ): - """ Create some more commits for the specified git repo. """ + """Create some more commits for the specified git repo.""" repo, newfolder, branch_ref_obj = _clone_and_top_commits( folder, branch, branch_ref=True ) @@ -982,7 +982,7 @@ def add_commit_git_repo( def add_tag_git_repo(folder, tagname, obj_hash, message): - """ Add a tag to the given object of the given repo annotated by given message. """ + """Add a tag to the given object of the given repo annotated by given message.""" repo, newfolder, branch_ref_obj = _clone_and_top_commits( folder, "master", branch_ref=True ) @@ -1015,7 +1015,7 @@ def add_content_to_git( author=("Alice Author", "alice@authors.tld"), commiter=("Cecil Committer", "cecil@committers.tld"), ): - """ Create some more commits for the specified git repo. """ + """Create some more commits for the specified git repo.""" repo, newfolder, branch_ref_obj = _clone_and_top_commits( folder, branch, branch_ref=True ) @@ -1069,7 +1069,7 @@ def add_content_to_git( def add_binary_git_repo(folder, filename): - """ Create a fake image file for the specified git repo. """ + """Create a fake image file for the specified git repo.""" repo, newfolder, parents = _clone_and_top_commits(folder, "master") content = b"""\x00\x00\x01\x00\x01\x00\x18\x18\x00\x00\x01\x00 \x00\x88 @@ -1111,7 +1111,7 @@ def add_binary_git_repo(folder, filename): def remove_file_git_repo(folder, filename, branch="master"): - """ Delete the specified file on the give git repo and branch. """ + """Delete the specified file on the give git repo and branch.""" repo, newfolder, parents = _clone_and_top_commits(folder, branch) # Remove file @@ -1281,7 +1281,7 @@ def get_alerts(html): def definitely_wait(result): - """ Helper function for definitely waiting in _maybe_wait. """ + """Helper function for definitely waiting in _maybe_wait.""" result.wait() diff --git a/tests/test_fnmatch.py b/tests/test_fnmatch.py index 18e1eff..eceb3fc 100644 --- a/tests/test_fnmatch.py +++ b/tests/test_fnmatch.py @@ -25,7 +25,7 @@ class FnmatchTests(unittest.TestCase): """Tests for the streaming server.""" def test_fnmatch(self): - """ Test the matching done by fnmatch. """ + """Test the matching done by fnmatch.""" matrix = [ ["pagure", "*", True], ["ns/pagure", "*", True], diff --git a/tests/test_pagure_admin.py b/tests/test_pagure_admin.py index d0f5ae7..026ade0 100644 --- a/tests/test_pagure_admin.py +++ b/tests/test_pagure_admin.py @@ -40,7 +40,7 @@ class PagureAdminAdminTokenEmptytests(tests.Modeltests): populate_db = False def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureAdminAdminTokenEmptytests, self).setUp() pagure.cli.admin.session = self.session @@ -79,12 +79,12 @@ class PagureAdminAdminTokenEmptytests(tests.Modeltests): class PagureAdminAdminRefreshGitolitetests(tests.Modeltests): - """ Tests for pagure-admin refresh-gitolite """ + """Tests for pagure-admin refresh-gitolite""" populate_db = False def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureAdminAdminRefreshGitolitetests, self).setUp() pagure.cli.admin.session = self.session @@ -123,7 +123,7 @@ class PagureAdminAdminRefreshGitolitetests(tests.Modeltests): @patch("pagure.cli.admin._ask_confirmation") @patch("pagure.lib.git_auth.get_git_auth_helper") def test_do_refresh_gitolite_no_args(self, get_helper, conf): - """ Test the do_generate_acl function with no special args. """ + """Test the do_generate_acl function with no special args.""" conf.return_value = True helper = MagicMock() get_helper.return_value = helper @@ -141,7 +141,7 @@ class PagureAdminAdminRefreshGitolitetests(tests.Modeltests): @patch("pagure.cli.admin._ask_confirmation") @patch("pagure.lib.git_auth.get_git_auth_helper") def test_do_refresh_gitolite_all_project(self, get_helper, conf): - """ Test the do_generate_acl function for all projects. """ + """Test the do_generate_acl function for all projects.""" conf.return_value = True helper = MagicMock() get_helper.return_value = helper @@ -159,7 +159,7 @@ class PagureAdminAdminRefreshGitolitetests(tests.Modeltests): @patch("pagure.cli.admin._ask_confirmation") @patch("pagure.lib.git_auth.get_git_auth_helper") def test_do_refresh_gitolite_one_project(self, get_helper, conf): - """ Test the do_generate_acl function for a certain project. """ + """Test the do_generate_acl function for a certain project.""" conf.return_value = True helper = MagicMock() get_helper.return_value = helper @@ -195,7 +195,7 @@ class PagureAdminAdminRefreshGitolitetests(tests.Modeltests): @patch("pagure.cli.admin._ask_confirmation") @patch("pagure.lib.git_auth.get_git_auth_helper") def test_do_refresh_gitolite_one_group(self, get_helper, conf): - """ Test the do_generate_acl function for a certain group. """ + """Test the do_generate_acl function for a certain group.""" conf.return_value = True helper = MagicMock() get_helper.return_value = helper @@ -212,12 +212,12 @@ class PagureAdminAdminRefreshGitolitetests(tests.Modeltests): class PagureAdminAdminTokentests(tests.Modeltests): - """ Tests for pagure-admin admin-token """ + """Tests for pagure-admin admin-token""" populate_db = False def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureAdminAdminTokentests, self).setUp() pagure.cli.admin.session = self.session @@ -239,7 +239,7 @@ class PagureAdminAdminTokentests(tests.Modeltests): @patch("pagure.cli.admin._get_input") @patch("pagure.cli.admin._ask_confirmation") def test_do_create_admin_token(self, conf, rinp): - """ Test the do_create_admin_token function of pagure-admin. """ + """Test the do_create_admin_token function of pagure-admin.""" conf.return_value = True rinp.return_value = "1,2,3" @@ -272,7 +272,7 @@ class PagureAdminAdminTokentests(tests.Modeltests): @patch("pagure.cli.admin._get_input") @patch("pagure.cli.admin._ask_confirmation") def test_do_list_admin_token(self, conf, rinp): - """ Test the do_list_admin_token function of pagure-admin. """ + """Test the do_list_admin_token function of pagure-admin.""" # Create an admin token to use conf.return_value = True rinp.return_value = "1,2,3" @@ -365,7 +365,7 @@ class PagureAdminAdminTokentests(tests.Modeltests): @patch("pagure.cli.admin._get_input") @patch("pagure.cli.admin._ask_confirmation") def test_do_info_admin_token(self, conf, rinp): - """ Test the do_info_admin_token function of pagure-admin. """ + """Test the do_info_admin_token function of pagure-admin.""" # Create an admin token to use conf.return_value = True rinp.return_value = "2,4,5" @@ -459,7 +459,7 @@ class PagureAdminAdminTokentests(tests.Modeltests): @patch("pagure.cli.admin._get_input") @patch("pagure.cli.admin._ask_confirmation") def test_do_expire_admin_token(self, conf, rinp): - """ Test the do_expire_admin_token function of pagure-admin. """ + """Test the do_expire_admin_token function of pagure-admin.""" # Create an admin token to use conf.return_value = True rinp.return_value = "1,2,3" @@ -737,7 +737,7 @@ class PagureAdminAdminTokentests(tests.Modeltests): @patch("pagure.cli.admin._get_input") @patch("pagure.cli.admin._ask_confirmation") def test_do_update_admin_token(self, conf, rinp): - """ Test the do_update_admin_token function of pagure-admin. """ + """Test the do_update_admin_token function of pagure-admin.""" # Create an admin token to use conf.return_value = True @@ -893,12 +893,12 @@ class PagureAdminAdminTokentests(tests.Modeltests): class PagureAdminGetWatchTests(tests.Modeltests): - """ Tests for pagure-admin get-watch """ + """Tests for pagure-admin get-watch""" populate_db = False def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureAdminGetWatchTests, self).setUp() pagure.cli.admin.session = self.session @@ -1029,12 +1029,12 @@ class PagureAdminGetWatchTests(tests.Modeltests): class PagureAdminUpdateWatchTests(tests.Modeltests): - """ Tests for pagure-admin update-watch """ + """Tests for pagure-admin update-watch""" populate_db = False def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureAdminUpdateWatchTests, self).setUp() pagure.cli.admin.session = self.session @@ -1169,12 +1169,12 @@ class PagureAdminUpdateWatchTests(tests.Modeltests): class PagureAdminReadOnlyTests(tests.Modeltests): - """ Tests for pagure-admin read-only """ + """Tests for pagure-admin read-only""" populate_db = False def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureAdminReadOnlyTests, self).setUp() pagure.cli.admin.session = self.session @@ -1350,12 +1350,12 @@ class PagureAdminReadOnlyTests(tests.Modeltests): class PagureNewGroupTests(tests.Modeltests): - """ Tests for pagure-admin new-group """ + """Tests for pagure-admin new-group""" populate_db = False def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureNewGroupTests, self).setUp() pagure.cli.admin.session = self.session @@ -1519,12 +1519,12 @@ class PagureNewGroupTests(tests.Modeltests): class PagureListGroupEmptyTests(tests.Modeltests): - """ Tests for pagure-admin list-groups """ + """Tests for pagure-admin list-groups""" populate_db = False def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureListGroupEmptyTests, self).setUp() pagure.cli.admin.session = self.session @@ -1566,12 +1566,12 @@ class PagureListGroupEmptyTests(tests.Modeltests): class PagureListGroupTests(tests.Modeltests): - """ Tests for pagure-admin list-groups """ + """Tests for pagure-admin list-groups""" populate_db = False def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureListGroupTests, self).setUp() pagure.cli.admin.session = self.session @@ -1625,12 +1625,12 @@ class PagureListGroupTests(tests.Modeltests): class PagureBlockUserTests(tests.Modeltests): - """ Tests for pagure-admin block-user """ + """Tests for pagure-admin block-user""" populate_db = False def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureBlockUserTests, self).setUp() pagure.cli.admin.session = self.session @@ -1853,12 +1853,12 @@ class PagureBlockUserTests(tests.Modeltests): class PagureAdminDeleteProjectTests(tests.Modeltests): - """ Tests for pagure-admin delete-project """ + """Tests for pagure-admin delete-project""" populate_db = False def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureAdminDeleteProjectTests, self).setUp() pagure.cli.admin.session = self.session @@ -2002,12 +2002,12 @@ class PagureAdminDeleteProjectTests(tests.Modeltests): class PagureCreateBranchTests(tests.Modeltests): - """ Tests for pagure-admin create-branch """ + """Tests for pagure-admin create-branch""" populate_db = True def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureCreateBranchTests, self).setUp() # Create a couple of projects @@ -2128,7 +2128,7 @@ class PagureCreateBranchTests(tests.Modeltests): ) def test_create_branch_from_branch(self): - """ Test the do_create_admin_token function of pagure-admin. """ + """Test the do_create_admin_token function of pagure-admin.""" gitrepo_path = os.path.join(self.path, "repos", "test.git") tests.add_content_git_repo(gitrepo_path) @@ -2161,12 +2161,12 @@ class PagureCreateBranchTests(tests.Modeltests): class PagureSetDefaultBranchTests(tests.Modeltests): - """ Tests for pagure-admin set-default-branch """ + """Tests for pagure-admin set-default-branch""" populate_db = True def setUp(self): - """ Set up the environment, run before every tests. """ + """Set up the environment, run before every tests.""" super(PagureSetDefaultBranchTests, self).setUp() # Create a couple of projects @@ -2232,7 +2232,7 @@ class PagureSetDefaultBranchTests(tests.Modeltests): ) def test_set_default_branch(self): - """ Test the set-default-branch funcion of pagure-admin. """ + """Test the set-default-branch funcion of pagure-admin.""" gitrepo_path = os.path.join(self.path, "repos", "test.git") tests.add_content_git_repo(gitrepo_path) @@ -2254,13 +2254,13 @@ class PagureSetDefaultBranchTests(tests.Modeltests): class PagureAdminUpdateAclsTests(tests.Modeltests): - """ Tests for pagure-admin update-acls """ + """Tests for pagure-admin update-acls""" populate_db = False maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureAdminUpdateAclsTests, self).setUp() pagure.cli.admin.session = self.session diff --git a/tests/test_pagure_exclude_group_index.py b/tests/test_pagure_exclude_group_index.py index aca3dd6..4fd683c 100644 --- a/tests/test_pagure_exclude_group_index.py +++ b/tests/test_pagure_exclude_group_index.py @@ -27,10 +27,10 @@ import tests class PagureExcludeGroupIndex(tests.Modeltests): - """ Tests the EXCLUDE_GROUP_INDEX configuration key in pagure """ + """Tests the EXCLUDE_GROUP_INDEX configuration key in pagure""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureExcludeGroupIndex, self).setUp() tests.create_projects(self.session) @@ -64,7 +64,7 @@ class PagureExcludeGroupIndex(tests.Modeltests): self.assertEqual(msg, "Group added") def test_defaults_pingou(self): - """ Test which repo pingou has by default. """ + """Test which repo pingou has by default.""" repos = pagure.lib.query.search_projects( self.session, username="pingou", fork=False @@ -75,7 +75,7 @@ class PagureExcludeGroupIndex(tests.Modeltests): self.assertEqual(repos[idx].name, name) def test_defaults_foo(self): - """ Test which repo foo has by default. """ + """Test which repo foo has by default.""" repos = pagure.lib.query.search_projects( self.session, username="foo", fork=False @@ -84,7 +84,7 @@ class PagureExcludeGroupIndex(tests.Modeltests): self.assertEqual(len(repos), 0) def test_add_foo_test(self): - """ Test adding foo to the test project. """ + """Test adding foo to the test project.""" group = pagure.lib.query.search_groups( self.session, group_name="provenpackager" @@ -119,7 +119,7 @@ class PagureExcludeGroupIndex(tests.Modeltests): self.assertEqual(repos[0].name, "test2") def test_excluding_provenpackager(self): - """ Test retrieving user's repo with a group excluded. """ + """Test retrieving user's repo with a group excluded.""" # Add `foo` to `provenpackager` group = pagure.lib.query.search_groups( diff --git a/tests/test_pagure_flask.py b/tests/test_pagure_flask.py index ec9fead..6c21678 100644 --- a/tests/test_pagure_flask.py +++ b/tests/test_pagure_flask.py @@ -30,10 +30,10 @@ import tests class PagureGetRemoteRepoPath(tests.SimplePagureTest): - """ Tests for pagure """ + """Tests for pagure""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureGetRemoteRepoPath, self).setUp() tests.create_projects(self.session) @@ -47,7 +47,7 @@ class PagureGetRemoteRepoPath(tests.SimplePagureTest): mock.MagicMock(side_effect=pygit2.GitError), ) def test_passing(self): - """ Test get_remote_repo_path in pagure. """ + """Test get_remote_repo_path in pagure.""" output = pagure.utils.get_remote_repo_path( os.path.join(self.path, "repos", "test2.git"), "master", diff --git a/tests/test_pagure_flask_api.py b/tests/test_pagure_flask_api.py index 0cb90c6..50f5223 100644 --- a/tests/test_pagure_flask_api.py +++ b/tests/test_pagure_flask_api.py @@ -29,12 +29,12 @@ import tests class PagureFlaskApitests(tests.SimplePagureTest): - """ Tests for flask API controller of pagure """ + """Tests for flask API controller of pagure""" maxDiff = None def test_api_doc(self): - """ Test the API documentation page. """ + """Test the API documentation page.""" print(dir(self.app)) output = self.app.get("/api/0/") output_text = output.get_data(as_text=True) @@ -42,7 +42,7 @@ class PagureFlaskApitests(tests.SimplePagureTest): self.assertIn(">Pagure API Reference\n", output_text) def test_api_doc_authenticated(self): - """ Test the API documentation page. """ + """Test the API documentation page.""" user = tests.FakeUser(username="foo") with tests.user_set(self.app.application, user): output = self.app.get("/api/0/") @@ -68,7 +68,7 @@ class PagureFlaskApitests(tests.SimplePagureTest): self.assertEqual(pagure.api.get_request_data()["foo"], "bar") def test_api_version_old_url(self): - """ Test the api_version function. """ + """Test the api_version function.""" output = self.app.get("/api/0/version") self.assertEqual(output.status_code, 200) data = json.loads(output.get_data(as_text=True)) @@ -76,7 +76,7 @@ class PagureFlaskApitests(tests.SimplePagureTest): self.assertEqual(sorted(data.keys()), ["version"]) def test_api_version_new_url(self): - """ Test the api_version function at its new url. """ + """Test the api_version function at its new url.""" output = self.app.get("/api/0/-/version") self.assertEqual(output.status_code, 200) data = json.loads(output.get_data(as_text=True)) @@ -84,7 +84,7 @@ class PagureFlaskApitests(tests.SimplePagureTest): self.assertEqual(sorted(data.keys()), ["version"]) def test_api_groups(self): - """ Test the api_groups function. """ + """Test the api_groups function.""" # Add a couple of groups so that we can list them item = pagure.lib.model.PagureGroup( @@ -123,7 +123,7 @@ class PagureFlaskApitests(tests.SimplePagureTest): self.assertEqual(data["total_groups"], 1) def test_api_whoami_unauth(self): - """ Test the api_whoami function. """ + """Test the api_whoami function.""" output = self.app.post("/api/0/-/whoami") self.assertEqual(output.status_code, 401) @@ -139,7 +139,7 @@ class PagureFlaskApitests(tests.SimplePagureTest): ) def test_api_whoami_invalid_auth(self): - """ Test the api_whoami function with an invalid token. """ + """Test the api_whoami function with an invalid token.""" tests.create_projects(self.session) tests.create_tokens(self.session) @@ -160,7 +160,7 @@ class PagureFlaskApitests(tests.SimplePagureTest): ) def test_api_whoami_auth(self): - """ Test the api_whoami function with a valid token. """ + """Test the api_whoami function with a valid token.""" tests.create_projects(self.session) tests.create_tokens(self.session) @@ -172,7 +172,7 @@ class PagureFlaskApitests(tests.SimplePagureTest): self.assertEqual(data, {"username": "pingou"}) def test_api_error_codes(self): - """ Test the api_error_codes endpoint. """ + """Test the api_error_codes endpoint.""" output = self.app.get("/api/0/-/error_codes") self.assertEqual(output.status_code, 200) data = json.loads(output.get_data(as_text=True)) diff --git a/tests/test_pagure_flask_api_auth.py b/tests/test_pagure_flask_api_auth.py index 051ba1c..0af0946 100644 --- a/tests/test_pagure_flask_api_auth.py +++ b/tests/test_pagure_flask_api_auth.py @@ -28,7 +28,7 @@ import tests class PagureFlaskApiAuthtests(tests.SimplePagureTest): - """ Tests for the authentication in the flask API of pagure """ + """Tests for the authentication in the flask API of pagure""" def test_auth_no_data(self): """Test the authentication when there is nothing in the database.""" diff --git a/tests/test_pagure_flask_api_boards.py b/tests/test_pagure_flask_api_boards.py index 3496c5e..5c38669 100644 --- a/tests/test_pagure_flask_api_boards.py +++ b/tests/test_pagure_flask_api_boards.py @@ -78,7 +78,7 @@ def set_up_board(self): class PagureFlaskApiBoardstests(tests.SimplePagureTest): - """ Tests for flask API Boards controller of pagure """ + """Tests for flask API Boards controller of pagure""" maxDiff = None diff --git a/tests/test_pagure_flask_api_fork.py b/tests/test_pagure_flask_api_fork.py index ddb3cef..232a384 100644 --- a/tests/test_pagure_flask_api_fork.py +++ b/tests/test_pagure_flask_api_fork.py @@ -29,12 +29,12 @@ import tests class PagureFlaskApiForktests(tests.Modeltests): - """ Tests for the flask API of pagure for issue """ + """Tests for the flask API of pagure for issue""" maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiForktests, self).setUp() pagure.config.config["REQUESTS_FOLDER"] = None @@ -338,7 +338,7 @@ class PagureFlaskApiForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_api_pull_request_views(self, send_email): - """ Test the api_pull_request_views method of the flask api. """ + """Test the api_pull_request_views method of the flask api.""" send_email.return_value = True tests.create_projects(self.session) @@ -662,7 +662,7 @@ class PagureFlaskApiForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_api_pull_request_view_pr_disabled(self, send_email): - """ Test the api_pull_request_view method of the flask api. """ + """Test the api_pull_request_view method of the flask api.""" send_email.return_value = True tests.create_projects(self.session) tests.create_tokens(self.session) @@ -706,7 +706,7 @@ class PagureFlaskApiForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_api_pull_request_view(self, send_email): - """ Test the api_pull_request_view method of the flask api. """ + """Test the api_pull_request_view method of the flask api.""" send_email.return_value = True tests.create_projects(self.session) tests.create_tokens(self.session) @@ -890,7 +890,7 @@ class PagureFlaskApiForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_api_pull_request_by_uid_view(self, send_email): - """ Test the api_pull_request_by_uid_view method of the flask api. """ + """Test the api_pull_request_by_uid_view method of the flask api.""" send_email.return_value = True tests.create_projects(self.session) tests.create_tokens(self.session) @@ -1067,7 +1067,7 @@ class PagureFlaskApiForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_api_pull_request_close_pr_disabled(self, send_email): - """ Test the api_pull_request_close method of the flask api. """ + """Test the api_pull_request_close method of the flask api.""" send_email.return_value = True tests.create_projects(self.session) @@ -1116,7 +1116,7 @@ class PagureFlaskApiForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_api_pull_request_close_cross_project_token(self, send_email): - """ Test the api_pull_request_close method of the flask api for cross-project API token. """ + """Test the api_pull_request_close method of the flask api for cross-project API token.""" send_email.return_value = True tests.create_projects(self.session) @@ -1176,7 +1176,7 @@ class PagureFlaskApiForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_api_pull_request_close(self, send_email): - """ Test the api_pull_request_close method of the flask api. """ + """Test the api_pull_request_close method of the flask api.""" send_email.return_value = True tests.create_projects(self.session) @@ -1524,7 +1524,7 @@ class PagureFlaskApiForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_api_pull_request_merge(self, send_email): - """ Test the api_pull_request_merge method of the flask api. """ + """Test the api_pull_request_merge method of the flask api.""" send_email.return_value = True tests.create_projects(self.session) @@ -1641,7 +1641,7 @@ class PagureFlaskApiForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_api_pull_request_merge_conflicting(self, send_email): - """ Test the api_pull_request_merge method of the flask api. """ + """Test the api_pull_request_merge method of the flask api.""" send_email.return_value = True tests.create_projects(self.session) @@ -1719,7 +1719,7 @@ class PagureFlaskApiForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_api_pull_request_merge_user_token(self, send_email): - """ Test the api_pull_request_merge method of the flask api. """ + """Test the api_pull_request_merge method of the flask api.""" send_email.return_value = True tests.create_projects(self.session) @@ -1836,7 +1836,7 @@ class PagureFlaskApiForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_api_pull_request_add_comment(self, mockemail): - """ Test the api_pull_request_add_comment method of the flask api. """ + """Test the api_pull_request_add_comment method of the flask api.""" mockemail.return_value = True tests.create_projects(self.session) @@ -2050,7 +2050,7 @@ class PagureFlaskApiForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_api_pull_request_add_comment_user_token(self, mockemail): - """ Test the api_pull_request_add_comment method of the flask api. """ + """Test the api_pull_request_add_comment method of the flask api.""" mockemail.return_value = True tests.create_projects(self.session) @@ -2157,7 +2157,7 @@ class PagureFlaskApiForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_api_subscribe_pull_request_pr_disabled(self, p_send_email): - """ Test the api_subscribe_pull_request method of the flask api. """ + """Test the api_subscribe_pull_request method of the flask api.""" p_send_email.return_value = True tests.create_projects(self.session) @@ -2192,7 +2192,7 @@ class PagureFlaskApiForktests(tests.Modeltests): def test_api_subscribe_pull_request_invalid_token( self, p_send_email, p_ugt ): - """ Test the api_subscribe_pull_request method of the flask api. """ + """Test the api_subscribe_pull_request method of the flask api.""" p_send_email.return_value = True p_ugt.return_value = True @@ -2258,7 +2258,7 @@ class PagureFlaskApiForktests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_api_subscribe_pull_request(self, p_send_email, p_ugt): - """ Test the api_subscribe_pull_request method of the flask api. """ + """Test the api_subscribe_pull_request method of the flask api.""" p_send_email.return_value = True p_ugt.return_value = True @@ -3088,7 +3088,7 @@ class PagureFlaskApiForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_api_pull_request_open(self): - """ Test the api_pull_request_create method of the flask api. """ + """Test the api_pull_request_create method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -3402,7 +3402,7 @@ class PagureFlaskApiForkPRDiffStatstests(tests.Modeltests): maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiForkPRDiffStatstests, self).setUp() pagure.config.config["REQUESTS_FOLDER"] = None @@ -3438,7 +3438,7 @@ class PagureFlaskApiForkPRDiffStatstests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_api_pull_request_diffstats_no_repo(self): - """ Test the api_pull_request_merge method of the flask api. """ + """Test the api_pull_request_merge method of the flask api.""" output = self.app.get("/api/0/invalid/pull-request/404/diffstats") self.assertEqual(output.status_code, 404) data = json.loads(output.get_data(as_text=True)) @@ -3449,7 +3449,7 @@ class PagureFlaskApiForkPRDiffStatstests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_api_pull_request_diffstats_no_pr(self): - """ Test the api_pull_request_merge method of the flask api. """ + """Test the api_pull_request_merge method of the flask api.""" output = self.app.get("/api/0/test/pull-request/404/diffstats") self.assertEqual(output.status_code, 404) data = json.loads(output.get_data(as_text=True)) @@ -3460,7 +3460,7 @@ class PagureFlaskApiForkPRDiffStatstests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_api_pull_request_diffstats_file_modified(self): - """ Test the api_pull_request_merge method of the flask api. """ + """Test the api_pull_request_merge method of the flask api.""" output = self.app.get("/api/0/test/pull-request/1/diffstats") self.assertEqual(output.status_code, 200) data = json.loads(output.get_data(as_text=True)) @@ -3481,7 +3481,7 @@ class PagureFlaskApiForkPRDiffStatstests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_api_pull_request_diffstats_file_added_mofidied(self): - """ Test the api_pull_request_merge method of the flask api. """ + """Test the api_pull_request_merge method of the flask api.""" tests.add_commit_git_repo( os.path.join(self.path, "repos", "test.git"), ncommits=5 ) @@ -3542,7 +3542,7 @@ class PagureFlaskApiForkPRDiffStatstests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_api_pull_request_diffstats_file_modified_deleted(self): - """ Test the api_pull_request_merge method of the flask api. """ + """Test the api_pull_request_merge method of the flask api.""" repo = pagure.lib.query.get_authorized_project(self.session, "test") self.assertEqual(len(repo.requests), 1) pagure.lib.tasks.update_pull_request(repo.requests[0].uid) @@ -3609,7 +3609,7 @@ class PagureApiThresholdReachedTests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environment for the tests. """ + """Set up the environment for the tests.""" super(PagureApiThresholdReachedTests, self).setUp() tests.create_projects(self.session) @@ -3949,7 +3949,7 @@ class PagureFlaskApiForkGetCommenttests(tests.Modeltests): maxDiff = None def setUp(self): - """ Set up the environment, ran before every tests. """ + """Set up the environment, ran before every tests.""" super(PagureFlaskApiForkGetCommenttests, self).setUp() pagure.config.config["REQUESTS_FOLDER"] = None @@ -3999,7 +3999,7 @@ class PagureFlaskApiForkGetCommenttests(tests.Modeltests): self.assertEqual(req.comments[0].id, 1) def test_api_pull_request_get_comment_not_found(self): - """ Test the api_pull_request_get_comment method of the flask api. """ + """Test the api_pull_request_get_comment method of the flask api.""" output = self.app.get("/api/0/test/pull-request/1/comment/2") self.assertEqual(output.status_code, 404) data = json.loads(output.get_data(as_text=True)) @@ -4008,7 +4008,7 @@ class PagureFlaskApiForkGetCommenttests(tests.Modeltests): ) def test_api_pull_request_get_comment(self): - """ Test the api_pull_request_get_comment method of the flask api. """ + """Test the api_pull_request_get_comment method of the flask api.""" output = self.app.get("/api/0/test/pull-request/1/comment/1") self.assertEqual(output.status_code, 200) data = json.loads(output.get_data(as_text=True)) diff --git a/tests/test_pagure_flask_api_fork_assign.py b/tests/test_pagure_flask_api_fork_assign.py index 514d6ab..01a069f 100644 --- a/tests/test_pagure_flask_api_fork_assign.py +++ b/tests/test_pagure_flask_api_fork_assign.py @@ -34,14 +34,14 @@ import tests class PagureFlaskApiForkAssigntests(tests.SimplePagureTest): - """ Tests for the flask API of pagure for assigning a PR """ + """Tests for the flask API of pagure for assigning a PR""" maxDiff = None @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiForkAssigntests, self).setUp() tests.create_projects(self.session) diff --git a/tests/test_pagure_flask_api_fork_update.py b/tests/test_pagure_flask_api_fork_update.py index 48e7b36..4ffbbc6 100644 --- a/tests/test_pagure_flask_api_fork_update.py +++ b/tests/test_pagure_flask_api_fork_update.py @@ -34,14 +34,14 @@ import tests class PagureFlaskApiForkUpdatetests(tests.SimplePagureTest): - """ Tests for the flask API of pagure for updating a PR """ + """Tests for the flask API of pagure for updating a PR""" maxDiff = None @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiForkUpdatetests, self).setUp() tests.create_projects(self.session) diff --git a/tests/test_pagure_flask_api_group.py b/tests/test_pagure_flask_api_group.py index 9e468e8..8199add 100644 --- a/tests/test_pagure_flask_api_group.py +++ b/tests/test_pagure_flask_api_group.py @@ -26,12 +26,12 @@ import tests class PagureFlaskApiGroupTests(tests.SimplePagureTest): - """ Tests for the flask API of pagure for issue """ + """Tests for the flask API of pagure for issue""" maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiGroupTests, self).setUp() pagure.config.config["REQUESTS_FOLDER"] = None @@ -61,7 +61,7 @@ class PagureFlaskApiGroupTests(tests.SimplePagureTest): self.assertEqual(msg, "Group added") def test_api_groups(self): - """ Test the api_groups function. """ + """Test the api_groups function.""" # Add a couple of groups so that we can list them item = pagure.lib.model.PagureGroup( @@ -100,7 +100,7 @@ class PagureFlaskApiGroupTests(tests.SimplePagureTest): self.assertEqual(data["total_groups"], 1) def test_api_groups_extended(self): - """ Test the api_groups function. """ + """Test the api_groups function.""" # Add a couple of groups so that we can list them item = pagure.lib.model.PagureGroup( diff --git a/tests/test_pagure_flask_api_issue.py b/tests/test_pagure_flask_api_issue.py index 76d1df2..fc4a056 100644 --- a/tests/test_pagure_flask_api_issue.py +++ b/tests/test_pagure_flask_api_issue.py @@ -358,17 +358,17 @@ LCL_ISSUES = [ class PagureFlaskApiIssuetests(tests.SimplePagureTest): - """ Tests for the flask API of pagure for issue """ + """Tests for the flask API of pagure for issue""" maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiIssuetests, self).setUp() pagure.config.config["TICKETS_FOLDER"] = None def test_api_new_issue_wrong_token(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git( os.path.join(self.path, "tickets"), bare=True @@ -392,7 +392,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): "pagure.config.config", {"ENABLE_TICKETS_NAMESPACE": ["foobar"]} ) def test_api_new_issue_wrong_namespace(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git( os.path.join(self.path, "tickets"), bare=True @@ -417,7 +417,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_new_issue_no_input(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git( os.path.join(self.path, "tickets"), bare=True @@ -444,7 +444,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_new_issue_invalid_repo(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git( os.path.join(self.path, "tickets"), bare=True @@ -467,7 +467,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_new_issue_invalid_request(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git( os.path.join(self.path, "tickets"), bare=True @@ -499,7 +499,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): "pagure.config.config", {"FEDORA_MESSAGING_NOTIFICATIONS": True} ) def test_api_new_issue(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git( os.path.join(self.path, "tickets"), bare=True @@ -604,7 +604,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_new_issue_img(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git( os.path.join(self.path, "tickets"), bare=True @@ -645,7 +645,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_new_issue_invalid_milestone(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git( os.path.join(self.path, "tickets"), bare=True @@ -676,7 +676,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_new_issue_milestone(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git( os.path.join(self.path, "tickets"), bare=True @@ -715,7 +715,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_new_issue_public(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git( os.path.join(self.path, "tickets"), bare=True @@ -818,7 +818,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_new_issue_private(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git( os.path.join(self.path, "tickets"), bare=True @@ -875,7 +875,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): "pagure.config.config", {"FEDORA_MESSAGING_NOTIFICATIONS": True} ) def test_api_new_issue_private_no_fedora_messaging_notifs(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git( os.path.join(self.path, "tickets"), bare=True @@ -926,7 +926,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): @patch("pagure.utils.check_api_acls", MagicMock(return_value=None)) def test_api_new_issue_raise_db_error(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git( os.path.join(self.path, "tickets"), bare=True @@ -965,7 +965,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_new_issue_user_token_no_input(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git( os.path.join(self.path, "tickets"), bare=True @@ -992,7 +992,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_new_issue_user_token_invalid_user(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git( os.path.join(self.path, "tickets"), bare=True @@ -1019,7 +1019,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_new_issue_user_token_invalid_repo(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git( os.path.join(self.path, "tickets"), bare=True @@ -1041,7 +1041,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_new_issue_user_token_invalid_request(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git( os.path.join(self.path, "tickets"), bare=True @@ -1069,7 +1069,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_new_issue_user_token(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git( os.path.join(self.path, "tickets"), bare=True @@ -1097,7 +1097,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_new_issue_user_token_milestone(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git( os.path.join(self.path, "tickets"), bare=True @@ -1136,7 +1136,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_new_issue_user_token_public(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git( os.path.join(self.path, "tickets"), bare=True @@ -1239,7 +1239,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_new_issue_user_token_private(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git( os.path.join(self.path, "tickets"), bare=True @@ -1316,7 +1316,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): self.assertDictEqual(data, {"issue": exp, "message": "Issue created"}) def test_api_view_issues(self): - """ Test the api_view_issues method of the flask api. """ + """Test the api_view_issues method of the flask api.""" self.test_api_new_issue() # Invalid repo @@ -1733,7 +1733,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_view_issues_user_token(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git( os.path.join(self.path, "tickets"), bare=True @@ -1800,7 +1800,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_view_issues_private_user_token(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git( os.path.join(self.path, "tickets"), bare=True @@ -1909,7 +1909,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_view_issues_since_invalid_format(self): - """ Test the api_view_issues method of the flask api. """ + """Test the api_view_issues method of the flask api.""" self.test_api_new_issue() # Invalid repo @@ -1922,7 +1922,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_view_issues_since_invalid_timestamp(self): - """ Test the api_view_issues method of the flask api. """ + """Test the api_view_issues method of the flask api.""" self.test_api_new_issue() # Invalid repo @@ -2448,7 +2448,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_view_issues_since(self): - """ Test the api_view_issues method of the flask api for since option """ + """Test the api_view_issues method of the flask api for since option""" tests.create_projects(self.session) tests.create_projects_git( @@ -2744,7 +2744,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_view_issue(self): - """ Test the api_view_issue method of the flask api. """ + """Test the api_view_issue method of the flask api.""" self.test_api_new_issue() # Invalid repo @@ -2946,7 +2946,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_change_milestone_issue_invalid_project(self): - """ Test the api_change_milestone_issue method of the flask api. """ + """Test the api_change_milestone_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "tickets")) tests.create_tokens(self.session) @@ -2972,7 +2972,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): "pagure.config.config", {"ENABLE_TICKETS_NAMESPACE": ["foobar"]} ) def test_api_change_milestone_issue_wrong_namespace(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "tickets")) tests.create_tokens(self.session) @@ -3016,7 +3016,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_change_milestone_issue_wrong_token(self): - """ Test the api_change_milestone_issue method of the flask api. """ + """Test the api_change_milestone_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "tickets")) tests.create_tokens(self.session) @@ -3043,7 +3043,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_change_milestone_issue_no_issue(self): - """ Test the api_change_milestone_issue method of the flask api. """ + """Test the api_change_milestone_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "tickets")) tests.create_tokens(self.session) @@ -3068,7 +3068,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_change_milestone_issue_no_milestone(self): - """ Test the api_change_milestone_issue method of the flask api. """ + """Test the api_change_milestone_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "tickets")) tests.create_tokens(self.session) @@ -3115,7 +3115,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): self.assertEqual(issue.milestone, None) def test_api_change_milestone_issue_invalid_milestone(self): - """ Test the api_change_milestone_issue method of the flask api. """ + """Test the api_change_milestone_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "tickets")) tests.create_tokens(self.session) @@ -3167,7 +3167,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): "pagure.config.config", {"FEDORA_MESSAGING_NOTIFICATIONS": True} ) def test_api_change_milestone_issue(self): - """ Test the api_change_milestone_issue method of the flask api. """ + """Test the api_change_milestone_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "tickets")) tests.create_tokens(self.session) @@ -3292,7 +3292,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_change_milestone_issue_remove_milestone(self): - """ Test the api_change_milestone_issue method of the flask api. """ + """Test the api_change_milestone_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "tickets")) tests.create_tokens(self.session) @@ -3354,7 +3354,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): self.assertEqual(issue.milestone, None) def test_api_change_milestone_issue_remove_milestone2(self): - """ Test the api_change_milestone_issue method of the flask api. """ + """Test the api_change_milestone_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "tickets")) tests.create_tokens(self.session) @@ -3416,7 +3416,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): self.assertEqual(issue.milestone, None) def test_api_change_milestone_issue_unauthorized(self): - """ Test the api_change_milestone_issue method of the flask api. """ + """Test the api_change_milestone_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "tickets")) tests.create_tokens(self.session) @@ -3466,7 +3466,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): MagicMock(side_effect=pagure.exceptions.PagureException("error")), ) def test_api_change_milestone_issue_raises_exception(self): - """ Test the api_change_milestone_issue method of the flask api. """ + """Test the api_change_milestone_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "tickets")) tests.create_tokens(self.session) @@ -3559,7 +3559,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_api_view_issue_comment(self, p_send_email, p_ugt): - """ Test the api_view_issue_comment endpoint. """ + """Test the api_view_issue_comment endpoint.""" p_send_email.return_value = True p_ugt.return_value = True @@ -3676,7 +3676,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_api_view_issue_comment_private(self, p_send_email, p_ugt): - """ Test the api_view_issue_comment endpoint. """ + """Test the api_view_issue_comment endpoint.""" p_send_email.return_value = True p_ugt.return_value = True @@ -3777,7 +3777,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): "pagure.config.config", {"ENABLE_TICKETS_NAMESPACE": ["foobar"]} ) def test_api_assign_issue_wrong_namespace(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "tickets")) tests.create_tokens(self.session) @@ -3828,7 +3828,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_api_assign_issue(self, p_send_email, p_ugt): - """ Test the api_assign_issue method of the flask api. """ + """Test the api_assign_issue method of the flask api.""" p_send_email.return_value = True p_ugt.return_value = True @@ -4232,7 +4232,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_api_assign_issue_issuer(self, p_send_email, p_ugt): - """ Test the api_assign_issue method of the flask api. """ + """Test the api_assign_issue method of the flask api.""" p_send_email.return_value = True p_ugt.return_value = True @@ -4289,7 +4289,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_api_subscribe_issue(self, p_send_email, p_ugt): - """ Test the api_subscribe_issue method of the flask api. """ + """Test the api_subscribe_issue method of the flask api.""" p_send_email.return_value = True p_ugt.return_value = True @@ -4470,7 +4470,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_update_custom_field(self): - """ Test the api_update_custom_field method of the flask api. """ + """Test the api_update_custom_field method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "tickets")) tests.create_tokens(self.session) @@ -4700,7 +4700,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): MagicMock(side_effect=pagure.exceptions.PagureException("error")), ) def test_api_update_custom_field_raises_error(self): - """ Test the api_update_custom_field method of the flask api. """ + """Test the api_update_custom_field method of the flask api.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "tickets")) tests.create_tokens(self.session) @@ -4757,7 +4757,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): self.assertDictEqual(data, {"error": "error", "error_code": "ENOCODE"}) def test_api_view_issues_history_stats(self): - """ Test the api_view_issues_history_stats method of the flask api. """ + """Test the api_view_issues_history_stats method of the flask api.""" self.test_api_new_issue() # Create private issue, closed and without a closed_at date @@ -4786,7 +4786,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): self.assertEqual(data["stats"][k], 0) def test_api_view_issues_history_stats_detailed(self): - """ Test the api_view_issues_history_stats method of the flask api. """ + """Test the api_view_issues_history_stats method of the flask api.""" self.test_api_new_issue() output = self.app.get("/api/0/test/issues/history/detailed_stats") @@ -4807,7 +4807,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_view_issues_history_stats_detailed_invalid_range(self): - """ Test the api_view_issues_history_stats method of the flask api. """ + """Test the api_view_issues_history_stats method of the flask api.""" self.test_api_new_issue() output = self.app.get( @@ -4830,7 +4830,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): ) def test_api_view_issues_history_stats_detailed_one_week(self): - """ Test the api_view_issues_history_stats method of the flask api. """ + """Test the api_view_issues_history_stats method of the flask api.""" self.test_api_new_issue() output = self.app.get( @@ -5117,7 +5117,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): self.assertEqual(data["total_issues_created_pages"], 1) def api_api_view_issue_user_token(self): - """ Testhe the api view issues of the flask api with valid user token """ + """Testhe the api view issues of the flask api with valid user token""" tests.create_projects(self.session) tests.create_projects_git( os.path.join(self.path, "tickets", bare=True) diff --git a/tests/test_pagure_flask_api_issue_change_status.py b/tests/test_pagure_flask_api_issue_change_status.py index d69f119..0723fdd 100644 --- a/tests/test_pagure_flask_api_issue_change_status.py +++ b/tests/test_pagure_flask_api_issue_change_status.py @@ -37,7 +37,7 @@ class PagureFlaskApiIssueChangeStatustests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiIssueChangeStatustests, self).setUp() pagure.config.config["TICKETS_FOLDER"] = None @@ -97,7 +97,7 @@ class PagureFlaskApiIssueChangeStatustests(tests.Modeltests): tests.create_tokens_acl(self.session, token_id="project-less-pingou") def test_api_change_status_issue_invalid_project(self): - """ Test the api_change_status_issue method of the flask api. """ + """Test the api_change_status_issue method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd"} @@ -110,7 +110,7 @@ class PagureFlaskApiIssueChangeStatustests(tests.Modeltests): ) def test_api_change_status_issue_token_not_for_project(self): - """ Test the api_change_status_issue method of the flask api. """ + """Test the api_change_status_issue method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd"} @@ -124,7 +124,7 @@ class PagureFlaskApiIssueChangeStatustests(tests.Modeltests): self.assertEqual(pagure.api.APIERROR.EINVALIDTOK.value, data["error"]) def test_api_change_status_issue_invalid_issue(self): - """ Test the api_change_status_issue method of the flask api. """ + """Test the api_change_status_issue method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd"} @@ -137,7 +137,7 @@ class PagureFlaskApiIssueChangeStatustests(tests.Modeltests): ) def test_api_change_status_issue_incomplete(self): - """ Test the api_change_status_issue method of the flask api. """ + """Test the api_change_status_issue method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd"} @@ -169,7 +169,7 @@ class PagureFlaskApiIssueChangeStatustests(tests.Modeltests): self.assertEqual(issue.status, "Open") def test_api_change_status_issue_no_change(self): - """ Test the api_change_status_issue method of the flask api. """ + """Test the api_change_status_issue method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd"} @@ -194,7 +194,7 @@ class PagureFlaskApiIssueChangeStatustests(tests.Modeltests): MagicMock(side_effect=pagure.exceptions.PagureException("error")), ) def test_api_change_status_issue_raise_error(self): - """ Test the api_change_status_issue method of the flask api. """ + """Test the api_change_status_issue method of the flask api.""" repo = pagure.lib.query.get_authorized_project(self.session, "test") close_status = repo.close_status close_status = ["Fixed", "Upstream", "Invalid"] @@ -217,7 +217,7 @@ class PagureFlaskApiIssueChangeStatustests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_api_change_status_issue(self): - """ Test the api_change_status_issue method of the flask api. """ + """Test the api_change_status_issue method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd"} @@ -255,7 +255,7 @@ class PagureFlaskApiIssueChangeStatustests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_api_change_status_issue_closed_status(self): - """ Test the api_change_status_issue method of the flask api. """ + """Test the api_change_status_issue method of the flask api.""" repo = pagure.lib.query.get_authorized_project(self.session, "test") close_status = repo.close_status close_status = ["Fixed", "Upstream", "Invalid"] @@ -286,7 +286,7 @@ class PagureFlaskApiIssueChangeStatustests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_api_change_status_issue_no_ticket_project_less(self): - """ Test the api_change_status_issue method of the flask api. """ + """Test the api_change_status_issue method of the flask api.""" headers = {"Authorization": "token project-less-foo"} @@ -309,7 +309,7 @@ class PagureFlaskApiIssueChangeStatustests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_api_change_status_issue_project_less(self): - """ Test the api_change_status_issue method of the flask api. """ + """Test the api_change_status_issue method of the flask api.""" headers = {"Authorization": "token project-less-pingou"} diff --git a/tests/test_pagure_flask_api_issue_comment.py b/tests/test_pagure_flask_api_issue_comment.py index 702a51e..a0f5d3f 100644 --- a/tests/test_pagure_flask_api_issue_comment.py +++ b/tests/test_pagure_flask_api_issue_comment.py @@ -34,7 +34,7 @@ class PagureFlaskApiIssueCommenttests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiIssueCommenttests, self).setUp() pagure.config.config["TICKETS_FOLDER"] = None @@ -82,7 +82,7 @@ class PagureFlaskApiIssueCommenttests(tests.Modeltests): tests.create_tokens_acl(self.session, token_id="project-less-foo") def test_api_comment_issue_invalid_project(self): - """ Test the api_comment_issue method of the flask api. """ + """Test the api_comment_issue method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd"} @@ -95,7 +95,7 @@ class PagureFlaskApiIssueCommenttests(tests.Modeltests): ) def test_api_comment_issue_invalid_project_token(self): - """ Test the api_comment_issue method of the flask api. """ + """Test the api_comment_issue method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd"} @@ -109,7 +109,7 @@ class PagureFlaskApiIssueCommenttests(tests.Modeltests): self.assertEqual(pagure.api.APIERROR.EINVALIDTOK.value, data["error"]) def test_api_comment_issue_invalid_issue(self): - """ Test the api_comment_issue method of the flask api. """ + """Test the api_comment_issue method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd"} # Invalid issue @@ -121,7 +121,7 @@ class PagureFlaskApiIssueCommenttests(tests.Modeltests): ) def test_api_comment_issue_incomplete_request(self): - """ Test the api_comment_issue method of the flask api. """ + """Test the api_comment_issue method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd"} # Check comments before @@ -152,7 +152,7 @@ class PagureFlaskApiIssueCommenttests(tests.Modeltests): self.assertEqual(issue.status, "Open") def test_api_comment_issue(self): - """ Test the api_comment_issue method of the flask api. """ + """Test the api_comment_issue method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd"} @@ -180,7 +180,7 @@ class PagureFlaskApiIssueCommenttests(tests.Modeltests): self.assertEqual(len(issue.comments), 1) def test_api_comment_issue_private_un_authorized(self): - """ Test the api_comment_issue method of the flask api. """ + """Test the api_comment_issue method of the flask api.""" # Check before repo = pagure.lib.query.get_authorized_project(self.session, "test") @@ -208,7 +208,7 @@ class PagureFlaskApiIssueCommenttests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_api_comment_issue_private(self): - """ Test the api_comment_issue method of the flask api. """ + """Test the api_comment_issue method of the flask api.""" # Create token for user foo item = pagure.lib.model.Token( @@ -242,7 +242,7 @@ class PagureFlaskApiIssueCommenttests(tests.Modeltests): ) def test_api_comment_issue_invalid_project_project_less(self): - """ Test the api_comment_issue method of the flask api. """ + """Test the api_comment_issue method of the flask api.""" headers = {"Authorization": "token project-less-foo"} @@ -255,7 +255,7 @@ class PagureFlaskApiIssueCommenttests(tests.Modeltests): ) def test_api_comment_issue_invalid_project_token_project_less(self): - """ Test the api_comment_issue method of the flask api. """ + """Test the api_comment_issue method of the flask api.""" headers = {"Authorization": "token project-less-foo"} @@ -268,7 +268,7 @@ class PagureFlaskApiIssueCommenttests(tests.Modeltests): ) def test_api_comment_issue_invalid_issue_project_less(self): - """ Test the api_comment_issue method of the flask api. """ + """Test the api_comment_issue method of the flask api.""" headers = {"Authorization": "token project-less-foo"} # Invalid issue @@ -280,7 +280,7 @@ class PagureFlaskApiIssueCommenttests(tests.Modeltests): ) def test_api_comment_issue_incomplete_request_project_less(self): - """ Test the api_comment_issue method of the flask api. """ + """Test the api_comment_issue method of the flask api.""" headers = {"Authorization": "token project-less-foo"} # Check comments before @@ -312,7 +312,7 @@ class PagureFlaskApiIssueCommenttests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_api_comment_issue_project_less(self): - """ Test the api_comment_issue method of the flask api. """ + """Test the api_comment_issue method of the flask api.""" headers = {"Authorization": "token project-less-foo"} @@ -340,7 +340,7 @@ class PagureFlaskApiIssueCommenttests(tests.Modeltests): self.assertEqual(len(issue.comments), 1) def test_api_comment_issue_private_un_authorized_project_less(self): - """ Test the api_comment_issue method of the flask api. """ + """Test the api_comment_issue method of the flask api.""" # Check before repo = pagure.lib.query.get_authorized_project(self.session, "test") @@ -368,7 +368,7 @@ class PagureFlaskApiIssueCommenttests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_api_comment_issue_private_project_less(self): - """ Test the api_comment_issue method of the flask api. """ + """Test the api_comment_issue method of the flask api.""" # Create token for user foo item = pagure.lib.model.Token( diff --git a/tests/test_pagure_flask_api_issue_create.py b/tests/test_pagure_flask_api_issue_create.py index 0b4b279..6054ff1 100644 --- a/tests/test_pagure_flask_api_issue_create.py +++ b/tests/test_pagure_flask_api_issue_create.py @@ -31,7 +31,7 @@ class PagureFlaskApiIssueCreatetests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiIssueCreatetests, self).setUp() pagure.config.config["TICKETS_FOLDER"] = None diff --git a/tests/test_pagure_flask_api_issue_custom_fields.py b/tests/test_pagure_flask_api_issue_custom_fields.py index 09a8ad7..cfd2d2e 100644 --- a/tests/test_pagure_flask_api_issue_custom_fields.py +++ b/tests/test_pagure_flask_api_issue_custom_fields.py @@ -24,10 +24,10 @@ import tests # noqa: E402 class PagureFlaskApiCustomFieldIssuetests(tests.Modeltests): - """ Tests for the flask API of pagure for issue's custom fields """ + """Tests for the flask API of pagure for issue's custom fields""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" self.maxDiff = None super(PagureFlaskApiCustomFieldIssuetests, self).setUp() diff --git a/tests/test_pagure_flask_api_issue_update.py b/tests/test_pagure_flask_api_issue_update.py index 60d175f..99d76ee 100644 --- a/tests/test_pagure_flask_api_issue_update.py +++ b/tests/test_pagure_flask_api_issue_update.py @@ -24,10 +24,10 @@ import tests # noqa: E402 class PagureFlaskApiIssueUpdatetests(tests.Modeltests): - """ Tests for the flask API of pagure for updating an issue """ + """Tests for the flask API of pagure for updating an issue""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiIssueUpdatetests, self).setUp() pagure.config.config["TICKETS_FOLDER"] = None @@ -35,7 +35,7 @@ class PagureFlaskApiIssueUpdatetests(tests.Modeltests): tests.create_tokens(self.session) def test_api_issue_update_wrong_token(self): - """ Test the api_issue_update method of flask API """ + """Test the api_issue_update method of flask API""" tests.create_tokens_acl(self.session) headers = {"Authorization": "token aaa"} output = self.app.post("/api/0/foo/issue/1", headers=headers) @@ -51,7 +51,7 @@ class PagureFlaskApiIssueUpdatetests(tests.Modeltests): self.assertDictEqual(data, expected_rv) def test_api_issue_update_wrong_project(self): - """ Test the api_issue_update method of flask API """ + """Test the api_issue_update method of flask API""" tests.create_tokens_acl(self.session) headers = {"Authorization": "token aaabbbcccddd"} output = self.app.post("/api/0/foo/issue/1", headers=headers) @@ -64,7 +64,7 @@ class PagureFlaskApiIssueUpdatetests(tests.Modeltests): self.assertDictEqual(data, expected_rv) def test_api_issue_update_wrong_acls(self): - """ Test the api_issue_update method of flask API """ + """Test the api_issue_update method of flask API""" tests.create_tokens_acl(self.session, acl_name="issue_create") headers = {"Authorization": "token aaabbbcccddd"} output = self.app.post("/api/0/test/issue/1", headers=headers) @@ -81,7 +81,7 @@ class PagureFlaskApiIssueUpdatetests(tests.Modeltests): @patch.dict("pagure.config.config", {"ENABLE_TICKETS": False}) def test_api_issue_update_instance_tickets_disabled(self): - """ Test the api_issue_update method of flask API """ + """Test the api_issue_update method of flask API""" tests.create_tokens_acl(self.session) headers = {"Authorization": "token aaabbbcccddd"} output = self.app.post("/api/0/test/issue/1", headers=headers) @@ -94,7 +94,7 @@ class PagureFlaskApiIssueUpdatetests(tests.Modeltests): self.assertDictEqual(data, expected_rv) def test_api_issue_update_project_tickets_disabled(self): - """ Test the api_issue_update method of flask API """ + """Test the api_issue_update method of flask API""" tests.create_tokens_acl(self.session) # disable tickets on this repo repo = pagure.lib.query.get_authorized_project(self.session, "test") @@ -114,7 +114,7 @@ class PagureFlaskApiIssueUpdatetests(tests.Modeltests): self.assertDictEqual(data, expected_rv) def test_api_issue_update_project_read_only_issue_tracker(self): - """ Test the api_issue_update method of flask API """ + """Test the api_issue_update method of flask API""" tests.create_tokens_acl(self.session) # set read only issue tracke on this repo repo = pagure.lib.query.get_authorized_project(self.session, "test") @@ -134,7 +134,7 @@ class PagureFlaskApiIssueUpdatetests(tests.Modeltests): self.assertDictEqual(data, expected_rv) def test_api_issue_update_wrong_issue(self): - """ Test the api_issue_update method of flask API """ + """Test the api_issue_update method of flask API""" tests.create_tokens_acl(self.session) tests.create_projects_git(os.path.join(self.path, "tickets")) headers = {"Authorization": "token aaabbbcccddd"} @@ -145,7 +145,7 @@ class PagureFlaskApiIssueUpdatetests(tests.Modeltests): self.assertDictEqual(data, expected_rv) def test_api_issue_update_no_input(self): - """ Test the api_issue_update method of flask API """ + """Test the api_issue_update method of flask API""" tests.create_tokens_acl(self.session) tests.create_projects_git(os.path.join(self.path, "tickets")) headers = {"Authorization": "token aaabbbcccddd"} @@ -177,7 +177,7 @@ class PagureFlaskApiIssueUpdatetests(tests.Modeltests): self.assertDictEqual(data, expected_rv) def test_api_issue_update_partial_input(self): - """ Test the api_issue_update method of flask API """ + """Test the api_issue_update method of flask API""" tests.create_tokens_acl(self.session) tests.create_projects_git(os.path.join(self.path, "tickets")) headers = {"Authorization": "token aaabbbcccddd"} @@ -223,7 +223,7 @@ class PagureFlaskApiIssueUpdatetests(tests.Modeltests): self.assertDictEqual(data, expected_rv) def test_api_issue_update(self): - """ Test the api_issue_update method of flask API """ + """Test the api_issue_update method of flask API""" tests.create_tokens_acl(self.session) tests.create_projects_git(os.path.join(self.path, "tickets")) headers = {"Authorization": "token aaabbbcccddd"} diff --git a/tests/test_pagure_flask_api_plugins_install.py b/tests/test_pagure_flask_api_plugins_install.py index 4ab759d..836bf92 100644 --- a/tests/test_pagure_flask_api_plugins_install.py +++ b/tests/test_pagure_flask_api_plugins_install.py @@ -31,7 +31,7 @@ class PagureFlaskApiPluginInstalltests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiPluginInstalltests, self).setUp() tests.create_projects(self.session) diff --git a/tests/test_pagure_flask_api_plugins_remove.py b/tests/test_pagure_flask_api_plugins_remove.py index 1bd990d..9064c3a 100644 --- a/tests/test_pagure_flask_api_plugins_remove.py +++ b/tests/test_pagure_flask_api_plugins_remove.py @@ -32,7 +32,7 @@ class PagureFlaskApiPluginRemovetests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiPluginRemovetests, self).setUp() tests.create_projects(self.session) diff --git a/tests/test_pagure_flask_api_plugins_view_project.py b/tests/test_pagure_flask_api_plugins_view_project.py index 1207e0f..77a9b10 100644 --- a/tests/test_pagure_flask_api_plugins_view_project.py +++ b/tests/test_pagure_flask_api_plugins_view_project.py @@ -31,7 +31,7 @@ class PagureFlaskApiPluginViewProjecttests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiPluginViewProjecttests, self).setUp() tests.create_projects(self.session) diff --git a/tests/test_pagure_flask_api_pr_flag.py b/tests/test_pagure_flask_api_pr_flag.py index 4dfc20a..2d73e16 100644 --- a/tests/test_pagure_flask_api_pr_flag.py +++ b/tests/test_pagure_flask_api_pr_flag.py @@ -29,13 +29,13 @@ import tests # noqa class PagureFlaskApiPRFlagtests(tests.Modeltests): - """ Tests for the flask API of pagure for flagging pull-requests """ + """Tests for the flask API of pagure for flagging pull-requests""" maxDiff = None @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiPRFlagtests, self).setUp() pagure.config.config["REQUESTS_FOLDER"] = None @@ -73,7 +73,7 @@ class PagureFlaskApiPRFlagtests(tests.Modeltests): self.assertEqual(len(request.flags), 0) def test_invalid_project(self): - """ Test the flagging a PR on an invalid project. """ + """Test the flagging a PR on an invalid project.""" headers = {"Authorization": "token aaabbbcccddd"} @@ -88,7 +88,7 @@ class PagureFlaskApiPRFlagtests(tests.Modeltests): ) def test_incorrect_project(self): - """ Test the flagging a PR on the wrong project. """ + """Test the flagging a PR on the wrong project.""" headers = {"Authorization": "token aaabbbcccddd"} # Valid token, wrong project @@ -103,7 +103,7 @@ class PagureFlaskApiPRFlagtests(tests.Modeltests): self.assertEqual(pagure.api.APIERROR.EINVALIDTOK.value, data["error"]) def test_pr_disabled(self): - """ Test the flagging a PR when PRs are disabled. """ + """Test the flagging a PR when PRs are disabled.""" repo = pagure.lib.query.get_authorized_project(self.session, "test") settings = repo.settings @@ -129,7 +129,7 @@ class PagureFlaskApiPRFlagtests(tests.Modeltests): ) def test_no_pr(self): - """ Test the flagging a PR when the PR doesn't exist. """ + """Test the flagging a PR when the PR doesn't exist.""" headers = {"Authorization": "token aaabbbcccddd"} # No PR @@ -143,7 +143,7 @@ class PagureFlaskApiPRFlagtests(tests.Modeltests): ) def test_no_input(self): - """ Test the flagging an existing PR but with no data. """ + """Test the flagging an existing PR but with no data.""" headers = {"Authorization": "token aaabbbcccddd"} # No input @@ -166,7 +166,7 @@ class PagureFlaskApiPRFlagtests(tests.Modeltests): ) def test_no_comment(self): - """ Test the flagging an existing PR but with incomplete data. """ + """Test the flagging an existing PR but with incomplete data.""" headers = {"Authorization": "token aaabbbcccddd"} data = { @@ -203,7 +203,7 @@ class PagureFlaskApiPRFlagtests(tests.Modeltests): MagicMock(side_effect=pagure.exceptions.PagureException("error")), ) def test_raise_exception(self): - """ Test the flagging a PR when adding a flag raises an exception. """ + """Test the flagging a PR when adding a flag raises an exception.""" headers = {"Authorization": "token aaabbbcccddd"} data = { @@ -226,7 +226,7 @@ class PagureFlaskApiPRFlagtests(tests.Modeltests): ) @patch("pagure.lib.notify.send_email") def test_flagging_a_pul_request_with_notification(self, mock_email): - """ Test the flagging a PR. """ + """Test the flagging a PR.""" headers = {"Authorization": "token aaabbbcccddd"} # Enable PR notifications @@ -451,7 +451,7 @@ class PagureFlaskApiPRFlagtests(tests.Modeltests): "pagure.config.config", {"FEDORA_MESSAGING_NOTIFICATIONS": True} ) def test_updating_flag(self): - """ Test the updating the flag of a PR. """ + """Test the updating the flag of a PR.""" headers = {"Authorization": "token aaabbbcccddd"} data = { @@ -706,7 +706,7 @@ class PagureFlaskApiPRFlagtests(tests.Modeltests): self.assertEqual(flags[0].percent, 100) def test_adding_two_flags(self): - """ Test the adding two flags to a PR. """ + """Test the adding two flags to a PR.""" headers = {"Authorization": "token aaabbbcccddd"} data = { @@ -845,7 +845,7 @@ class PagureFlaskApiPRFlagtests(tests.Modeltests): }, ) def test_flagging_a_pull_request_while_having_custom_statuses(self): - """ Test flagging a PR while having custom statuses. """ + """Test flagging a PR while having custom statuses.""" headers = {"Authorization": "token aaabbbcccddd"} # No status and no percent => should use FLAG_PENDING @@ -916,7 +916,7 @@ class PagureFlaskApiPRFlagUserTokentests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiPRFlagUserTokentests, self).setUp() pagure.config.config["REQUESTS_FOLDER"] = None @@ -954,7 +954,7 @@ class PagureFlaskApiPRFlagUserTokentests(tests.Modeltests): self.assertEqual(len(request.flags), 0) def test_no_pr(self): - """ Test flagging a non-existing PR. """ + """Test flagging a non-existing PR.""" headers = {"Authorization": "token aaabbbcccddd"} # Invalid project @@ -968,7 +968,7 @@ class PagureFlaskApiPRFlagUserTokentests(tests.Modeltests): ) def test_no_pr_other_project(self): - """ Test flagging a non-existing PR on a different project. """ + """Test flagging a non-existing PR on a different project.""" headers = {"Authorization": "token aaabbbcccddd"} # Valid token, wrong project output = self.app.post( @@ -981,7 +981,7 @@ class PagureFlaskApiPRFlagUserTokentests(tests.Modeltests): ) def test_no_input(self): - """ Test flagging an existing PR but without submitting any data. """ + """Test flagging an existing PR but without submitting any data.""" headers = {"Authorization": "token aaabbbcccddd"} # No input @@ -1271,7 +1271,7 @@ class PagureFlaskApiGetPRFlagtests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiGetPRFlagtests, self).setUp() pagure.config.config["REQUESTS_FOLDER"] = None @@ -1309,7 +1309,7 @@ class PagureFlaskApiGetPRFlagtests(tests.Modeltests): self.assertEqual(len(request.flags), 0) def test_invalid_project(self): - """ Test the retrieving the flags of a PR on an invalid project. """ + """Test the retrieving the flags of a PR on an invalid project.""" # Invalid project output = self.app.get("/api/0/foo/pull-request/1/flag") @@ -1320,7 +1320,7 @@ class PagureFlaskApiGetPRFlagtests(tests.Modeltests): ) def test_pr_disabled(self): - """ Test the retrieving the flags of a PR when PRs are disabled. """ + """Test the retrieving the flags of a PR when PRs are disabled.""" repo = pagure.lib.query.get_authorized_project(self.session, "test") settings = repo.settings @@ -1342,7 +1342,7 @@ class PagureFlaskApiGetPRFlagtests(tests.Modeltests): ) def test_no_pr(self): - """ Test the retrieving the flags of a PR when the PR doesn't exist. """ + """Test the retrieving the flags of a PR when the PR doesn't exist.""" # No PR output = self.app.get("/api/0/test/pull-request/10/flag") @@ -1353,7 +1353,7 @@ class PagureFlaskApiGetPRFlagtests(tests.Modeltests): ) def test_no_flag(self): - """ Test the retrieving the flags of a PR when the PR has no flags. """ + """Test the retrieving the flags of a PR when the PR has no flags.""" # No flag output = self.app.get("/api/0/test/pull-request/1/flag") @@ -1362,7 +1362,7 @@ class PagureFlaskApiGetPRFlagtests(tests.Modeltests): self.assertDictEqual(data, {"flags": []}) def test_get_flag(self): - """ Test the retrieving the flags of a PR when the PR has one flag. """ + """Test the retrieving the flags of a PR when the PR has one flag.""" # Add a flag to the PR request = pagure.lib.query.search_pull_requests( @@ -1422,7 +1422,7 @@ class PagureFlaskApiGetPRFlagtests(tests.Modeltests): ) def test_get_flags(self): - """ Test the retrieving the flags of a PR when the PR has one flag. """ + """Test the retrieving the flags of a PR when the PR has one flag.""" # Add two flags to the PR request = pagure.lib.query.search_pull_requests( diff --git a/tests/test_pagure_flask_api_project.py b/tests/test_pagure_flask_api_project.py index b795e52..8331ce6 100644 --- a/tests/test_pagure_flask_api_project.py +++ b/tests/test_pagure_flask_api_project.py @@ -36,7 +36,7 @@ from pagure.lib.repo import PagureRepo class PagureFlaskApiProjecttests(tests.Modeltests): - """ Tests for the flask API of pagure for issue """ + """Tests for the flask API of pagure for issue""" maxDiff = None @@ -54,7 +54,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): super(PagureFlaskApiProjecttests, self).tearDown() def test_api_git_tags(self): - """ Test the api_git_tags method of the flask api. """ + """Test the api_git_tags method of the flask api.""" tests.create_projects(self.session) # Create a git repo to play with @@ -205,7 +205,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): self.assertDictEqual(data, expected_rv) def test_api_projects_pattern(self): - """ Test the api_projects method of the flask api. """ + """Test the api_projects method of the flask api.""" tests.create_projects(self.session) output = self.app.get("/api/0/projects?pattern=test") @@ -274,7 +274,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): self.assertDictEqual(data, expected_data) def test_api_projects_pattern_short(self): - """ Test the api_projects method of the flask api. """ + """Test the api_projects method of the flask api.""" tests.create_projects(self.session) output = self.app.get("/api/0/projects?pattern=te*&short=1") @@ -319,7 +319,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): self.assertDictEqual(data, expected_data) def test_api_projects_owner(self): - """ Test the api_projects method of the flask api. """ + """Test the api_projects method of the flask api.""" tests.create_projects(self.session) output = self.app.get("/api/0/projects?owner=foo") @@ -345,7 +345,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): self.assertDictEqual(data, expected_data) def test_api_projects_not_owner(self): - """ Test the api_projects method of the flask api. """ + """Test the api_projects method of the flask api.""" tests.create_projects(self.session) output = self.app.get("/api/0/projects?owner=!foo&short=1") @@ -390,7 +390,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): self.assertDictEqual(data, expected_data) def test_api_projects(self): - """ Test the api_projects method of the flask api. """ + """Test the api_projects method of the flask api.""" tests.create_projects(self.session) # Check before adding @@ -930,7 +930,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): self.assertDictEqual(data, expected_data) def test_api_project(self): - """ Test the api_project method of the flask api. """ + """Test the api_project method of the flask api.""" tests.create_projects(self.session) # Check before adding @@ -1008,7 +1008,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): self.assertDictEqual(data, expected_data) def test_api_project_collaborators(self): - """ Test the api_project method of the flask api. """ + """Test the api_project method of the flask api.""" tests.create_projects(self.session) tests.create_user(self.session, "ralph", "Ralph B", ["ralph@b.org"]) tests.create_user(self.session, "nils", "Nils P", ["nils@p.net"]) @@ -1104,7 +1104,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): self.assertDictEqual(data, expected_data) def test_api_project_group(self): - """ Test the api_project method of the flask api. """ + """Test the api_project method of the flask api.""" tests.create_projects(self.session) repo = pagure.lib.query.get_authorized_project(self.session, "test") @@ -1270,7 +1270,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): self.assertDictEqual(data, expected_data) def test_api_projects_pagination(self): - """ Test the api_projects method of the flask api with pagination. """ + """Test the api_projects method of the flask api with pagination.""" tests.create_projects(self.session) output = self.app.get("/api/0/projects?page=1") @@ -2057,7 +2057,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): ) def test_api_project_watchers(self): - """ Test the api_project_watchers method of the flask api. """ + """Test the api_project_watchers method of the flask api.""" tests.create_projects(self.session) # The user is not logged in and the owner is watching issues implicitly output = self.app.get("/api/0/test/watchers") @@ -2266,7 +2266,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): }, ) def test_adopt_repos(self): - """ Test the new_project endpoint with existing git repo. """ + """Test the new_project endpoint with existing git repo.""" # Before projects = pagure.lib.query.search_projects(self.session) self.assertEqual(len(projects), 0) @@ -2316,7 +2316,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): self.assertDictEqual(data, {"message": 'Project "test" created'}) def test_api_fork_project(self): - """ Test the api_fork_project method of the flask api. """ + """Test the api_fork_project method of the flask api.""" tests.create_projects(self.session) for folder in ["docs", "tickets", "requests", "repos"]: tests.create_projects_git( @@ -2419,7 +2419,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): ) def test_api_fork_project_user_token(self): - """ Test the api_fork_project method of the flask api. """ + """Test the api_fork_project method of the flask api.""" tests.create_projects(self.session) for folder in ["docs", "tickets", "requests", "repos"]: tests.create_projects_git( @@ -2522,7 +2522,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): ) def test_api_generate_acls(self): - """ Test the api_generate_acls method of the flask api """ + """Test the api_generate_acls method of the flask api""" tests.create_projects(self.session) tests.create_tokens(self.session, project_id=None) tests.create_tokens_acl( @@ -2548,7 +2548,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): ) def test_api_generate_acls_json(self): - """ Test the api_generate_acls method of the flask api using JSON """ + """Test the api_generate_acls method of the flask api using JSON""" tests.create_projects(self.session) tests.create_tokens(self.session, project_id=None) tests.create_tokens_acl( @@ -2631,7 +2631,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): self.assertEqual(data, expected_output) def test_api_new_git_branch(self): - """ Test the api_new_branch method of the flask api """ + """Test the api_new_branch method of the flask api""" tests.create_projects(self.session) repo_path = os.path.join(self.path, "repos") tests.create_projects_git(repo_path, bare=True) @@ -2652,7 +2652,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): self.assertIn("test123", repo_obj.listall_branches()) def test_api_new_git_branch_json(self): - """ Test the api_new_branch method of the flask api """ + """Test the api_new_branch method of the flask api""" tests.create_projects(self.session) repo_path = os.path.join(self.path, "repos") tests.create_projects_git(repo_path, bare=True) @@ -2676,7 +2676,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): self.assertIn("test123", repo_obj.listall_branches()) def test_api_new_git_branch_from_branch(self): - """ Test the api_new_branch method of the flask api """ + """Test the api_new_branch method of the flask api""" tests.create_projects(self.session) repo_path = os.path.join(self.path, "repos") tests.create_projects_git(repo_path, bare=True) @@ -2721,7 +2721,7 @@ class PagureFlaskApiProjecttests(tests.Modeltests): self.assertEqual(data, expected_output) def test_api_new_git_branch_from_commit(self): - """ Test the api_new_branch method of the flask api """ + """Test the api_new_branch method of the flask api""" tests.create_projects(self.session) repos_path = os.path.join(self.path, "repos") tests.create_projects_git(repos_path, bare=True) @@ -2747,7 +2747,7 @@ class PagureFlaskApiProjectFlagtests(tests.Modeltests): """Tests for the flask API of pagure for flagging commit in project""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiProjectFlagtests, self).setUp() tests.create_projects(self.session) @@ -2759,7 +2759,7 @@ class PagureFlaskApiProjectFlagtests(tests.Modeltests): tests.create_tokens_acl(self.session, "aaabbbcccddd", "commit_flag") def test_flag_commit_missing_status(self): - """ Test flagging a commit with missing precentage. """ + """Test flagging a commit with missing precentage.""" repo_obj = pygit2.Repository(self.git_path) commit = repo_obj.revparse_single("HEAD") @@ -2787,7 +2787,7 @@ class PagureFlaskApiProjectFlagtests(tests.Modeltests): self.assertEqual(data, expected_output) def test_flag_commit_missing_username(self): - """ Test flagging a commit with missing username. """ + """Test flagging a commit with missing username.""" repo_obj = pygit2.Repository(self.git_path) commit = repo_obj.revparse_single("HEAD") @@ -2814,7 +2814,7 @@ class PagureFlaskApiProjectFlagtests(tests.Modeltests): self.assertEqual(data, expected_output) def test_flag_commit_missing_comment(self): - """ Test flagging a commit with missing comment. """ + """Test flagging a commit with missing comment.""" repo_obj = pygit2.Repository(self.git_path) commit = repo_obj.revparse_single("HEAD") @@ -2841,7 +2841,7 @@ class PagureFlaskApiProjectFlagtests(tests.Modeltests): self.assertEqual(data, expected_output) def test_flag_commit_missing_url(self): - """ Test flagging a commit with missing url. """ + """Test flagging a commit with missing url.""" repo_obj = pygit2.Repository(self.git_path) commit = repo_obj.revparse_single("HEAD") @@ -2868,7 +2868,7 @@ class PagureFlaskApiProjectFlagtests(tests.Modeltests): self.assertEqual(data, expected_output) def test_flag_commit_invalid_token(self): - """ Test flagging a commit with missing info. """ + """Test flagging a commit with missing info.""" repo_obj = pygit2.Repository(self.git_path) commit = repo_obj.revparse_single("HEAD") @@ -2897,7 +2897,7 @@ class PagureFlaskApiProjectFlagtests(tests.Modeltests): self.assertEqual(data["errors"], "Invalid token") def test_flag_commit_invalid_status(self): - """ Test flagging a commit with an invalid status. """ + """Test flagging a commit with an invalid status.""" repo_obj = pygit2.Repository(self.git_path) commit = repo_obj.revparse_single("HEAD") @@ -2926,7 +2926,7 @@ class PagureFlaskApiProjectFlagtests(tests.Modeltests): ) def test_flag_commit_with_uid(self): - """ Test flagging a commit with provided uid. """ + """Test flagging a commit with provided uid.""" repo_obj = pygit2.Repository(self.git_path) commit = repo_obj.revparse_single("HEAD") @@ -2978,7 +2978,7 @@ class PagureFlaskApiProjectFlagtests(tests.Modeltests): "pagure.config.config", {"FEDORA_MESSAGING_NOTIFICATIONS": True} ) def test_update_flag_commit_with_uid(self): - """ Test flagging a commit with provided uid. """ + """Test flagging a commit with provided uid.""" repo_obj = pygit2.Repository(self.git_path) commit = repo_obj.revparse_single("HEAD") @@ -3253,7 +3253,7 @@ class PagureFlaskApiProjectFlagtests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_flag_commit_with_notification(self, mock_email): - """ Test flagging a commit with notification enabled. """ + """Test flagging a commit with notification enabled.""" # Enable commit notifications repo = pagure.lib.query.get_authorized_project(self.session, "test") @@ -3378,7 +3378,7 @@ class PagureFlaskApiProjectFlagtests(tests.Modeltests): ) def test_commit_flags(self): - """ Test retrieving commit flags. """ + """Test retrieving commit flags.""" repo = pagure.lib.query.get_authorized_project(self.session, "test") repo_obj = pygit2.Repository(self.git_path) commit = repo_obj.revparse_single("HEAD") @@ -3475,7 +3475,7 @@ class PagureFlaskApiProjectModifyAclTests(tests.Modeltests): maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiProjectModifyAclTests, self).setUp() tests.create_projects(self.session) tests.create_tokens(self.session, project_id=None) @@ -4205,7 +4205,7 @@ class PagureFlaskApiProjectOptionsTests(tests.Modeltests): maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiProjectOptionsTests, self).setUp() tests.create_projects(self.session) tests.create_tokens(self.session, project_id=None) @@ -4218,7 +4218,7 @@ class PagureFlaskApiProjectOptionsTests(tests.Modeltests): ) def test_api_get_project_options_wrong_project(self): - """ Test accessing api_get_project_options w/o auth header. """ + """Test accessing api_get_project_options w/o auth header.""" headers = {"Authorization": "token aaabbbcccddd"} output = self.app.get("/api/0/unknown/options", headers=headers) @@ -4229,7 +4229,7 @@ class PagureFlaskApiProjectOptionsTests(tests.Modeltests): ) def test_api_get_project_options_wo_header(self): - """ Test accessing api_get_project_options w/o auth header. """ + """Test accessing api_get_project_options w/o auth header.""" output = self.app.get("/api/0/test/options") self.assertEqual(output.status_code, 401) @@ -4246,7 +4246,7 @@ class PagureFlaskApiProjectOptionsTests(tests.Modeltests): ) def test_api_get_project_options_w_header(self): - """ Test accessing api_get_project_options w/ auth header. """ + """Test accessing api_get_project_options w/ auth header.""" headers = {"Authorization": "token aaabbbcccddd"} output = self.app.get("/api/0/test/options", headers=headers) @@ -4293,7 +4293,7 @@ class PagureFlaskApiProjectOptionsTests(tests.Modeltests): ) def test_api_modify_project_options_wo_header(self): - """ Test accessing api_modify_project_options w/o auth header. """ + """Test accessing api_modify_project_options w/o auth header.""" output = self.app.post("/api/0/test/options/update") self.assertEqual(output.status_code, 401) @@ -4310,7 +4310,7 @@ class PagureFlaskApiProjectOptionsTests(tests.Modeltests): ) def test_api_modify_project_options_no_data(self): - """ Test accessing api_modify_project_options w/ auth header. """ + """Test accessing api_modify_project_options w/ auth header.""" # check before headers = {"Authorization": "token aaabbbcccddd"} @@ -4363,7 +4363,7 @@ class PagureFlaskApiProjectOptionsTests(tests.Modeltests): self.assertEqual(after, before) def test_api_modify_project_options(self): - """ Test accessing api_modify_project_options w/ auth header. """ + """Test accessing api_modify_project_options w/ auth header.""" # check before headers = {"Authorization": "token aaabbbcccddd"} @@ -4422,7 +4422,7 @@ class PagureFlaskApiProjectOptionsTests(tests.Modeltests): self.assertEqual(after, before) def test_api_modify_project_options2(self): - """ Test accessing api_modify_project_options w/ auth header. """ + """Test accessing api_modify_project_options w/ auth header.""" # check before headers = {"Authorization": "token aaabbbcccddd"} @@ -4548,14 +4548,14 @@ class PagureFlaskApiProjectCreateAPITokenTests(tests.Modeltests): maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiProjectCreateAPITokenTests, self).setUp() tests.create_projects(self.session) tests.create_tokens(self.session, project_id=None) tests.create_tokens_acl(self.session, "aaabbbcccddd", "modify_project") def test_api_createapitoken_as_owner(self): - """ Test accessing api_project_create_token as owner. """ + """Test accessing api_project_create_token as owner.""" headers = {"Authorization": "token aaabbbcccddd"} project = pagure.lib.query._get_project(self.session, "test") @@ -4586,7 +4586,7 @@ class PagureFlaskApiProjectCreateAPITokenTests(tests.Modeltests): self.assertEqual(output.status_code, 400) def test_api_createapitoken_as_admin(self): - """ Test accessing api_project_create_token as admin. """ + """Test accessing api_project_create_token as admin.""" project = pagure.lib.query._get_project(self.session, "test") @@ -4726,14 +4726,14 @@ class PagureFlaskApiProjectConnectorTests(tests.Modeltests): maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiProjectConnectorTests, self).setUp() tests.create_projects(self.session) tests.create_tokens(self.session, project_id=None) tests.create_tokens_acl(self.session, "aaabbbcccddd", "modify_project") def test_api_get_project_connector_as_owner(self): - """ Test accessing api_get_project_connector as project owner. """ + """Test accessing api_get_project_connector as project owner.""" project = pagure.lib.query._get_project(self.session, "test") @@ -4775,7 +4775,7 @@ class PagureFlaskApiProjectConnectorTests(tests.Modeltests): ) def test_api_get_project_connector_as_admin(self): - """ Test accessing api_get_project_connector as project admin """ + """Test accessing api_get_project_connector as project admin""" project = pagure.lib.query._get_project(self.session, "test") @@ -4916,7 +4916,7 @@ class PagureFlaskApiProjectWebhookTokenTests(tests.Modeltests): maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiProjectWebhookTokenTests, self).setUp() tests.create_projects(self.session) tests.create_tokens(self.session, project_id=None) @@ -4924,7 +4924,7 @@ class PagureFlaskApiProjectWebhookTokenTests(tests.Modeltests): tests.create_tokens_acl(self.session, "aaabbbcccddd", "issue_assign") def test_api_get_project_webhook_token_as_owner(self): - """ Test accessing webhook token as project owner. """ + """Test accessing webhook token as project owner.""" project = pagure.lib.query._get_project(self.session, "test") @@ -4938,7 +4938,7 @@ class PagureFlaskApiProjectWebhookTokenTests(tests.Modeltests): ) def test_api_get_project_webhook_token_as_collaborator(self): - """ Test accessing webhook token as project collaborator. """ + """Test accessing webhook token as project collaborator.""" project = pagure.lib.query._get_project(self.session, "test") @@ -4971,7 +4971,7 @@ class PagureFlaskApiProjectWebhookTokenTests(tests.Modeltests): ) def test_api_get_project_webhook_token_as_not_collaborator(self): - """ Test accessing webhook token as not a project collaborator. """ + """Test accessing webhook token as not a project collaborator.""" # Create token for foo user with a default ACL mtoken = pagure.lib.query.add_token_to_user( @@ -4992,7 +4992,7 @@ class PagureFlaskApiProjectCommitInfotests(tests.Modeltests): """Tests for the flask API of pagure for commit info""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiProjectCommitInfotests, self).setUp() tests.create_projects(self.session) @@ -5005,7 +5005,7 @@ class PagureFlaskApiProjectCommitInfotests(tests.Modeltests): self.commit = repo_obj.revparse_single("HEAD") def test_api_commit_info(self): - """ Test flagging a commit with missing precentage. """ + """Test flagging a commit with missing precentage.""" output = self.app.get("/api/0/test/c/%s/info" % self.commit.oid.hex) self.assertEqual(output.status_code, 200) @@ -5024,7 +5024,7 @@ class PagureFlaskApiProjectCommitInfotests(tests.Modeltests): self.assertEqual(data, expected_output) def test_api_commit_info_invalid_commit(self): - """ Test flagging a commit with missing username. """ + """Test flagging a commit with missing username.""" output = self.app.get("/api/0/test/c/invalid_commit_hash/info") self.assertEqual(output.status_code, 404) @@ -5035,7 +5035,7 @@ class PagureFlaskApiProjectCommitInfotests(tests.Modeltests): self.assertEqual(pagure.api.APIERROR.ENOCOMMIT.value, data["error"]) def test_api_commit_info_hash_tree(self): - """ Test flagging a commit with missing username. """ + """Test flagging a commit with missing username.""" output = self.app.get( "/api/0/test/c/%s/info" % self.commit.tree_id.hex ) @@ -5054,7 +5054,7 @@ class PagureFlaskApiProjectGitBranchestests(tests.Modeltests): maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiProjectGitBranchestests, self).setUp() tests.create_projects(self.session) @@ -5082,7 +5082,7 @@ class PagureFlaskApiProjectGitBranchestests(tests.Modeltests): PagureRepo.push(clone_repo.remotes[0], refname) def test_api_git_branches(self): - """ Test the api_git_branches method of the flask api. """ + """Test the api_git_branches method of the flask api.""" # Check that the branches show up on the API output = self.app.get("/api/0/test/git/branches") @@ -5098,7 +5098,7 @@ class PagureFlaskApiProjectGitBranchestests(tests.Modeltests): ) def test_api_git_branches_with_commits(self): - """ Test the api_git_branches method of the flask api with with_commits=True. """ + """Test the api_git_branches method of the flask api with with_commits=True.""" # Check that the branches show up on the API output = self.app.get("/api/0/test/git/branches?with_commits=true") @@ -5132,7 +5132,7 @@ class PagureFlaskApiProjectGitBranchestests(tests.Modeltests): ) def test_api_set_git_default_branch(self): - """ Test the api_git_branches method of the flask api. """ + """Test the api_git_branches method of the flask api.""" headers = {"Authorization": "token foo_token"} data = {"branch_name": "pats-win-49"} output = self.app.post( @@ -5150,7 +5150,7 @@ class PagureFlaskApiProjectGitBranchestests(tests.Modeltests): ) def test_api_set_git_default_branch_with_commits_form(self): - """ Test the api_git_branches method of the flask api with with_commits=True. """ + """Test the api_git_branches method of the flask api with with_commits=True.""" headers = {"Authorization": "token foo_token"} data = {"branch_name": "pats-win-49", "with_commits": True} output = self.app.post( @@ -5174,7 +5174,7 @@ class PagureFlaskApiProjectGitBranchestests(tests.Modeltests): ) def test_api_set_git_default_branch_with_commits_url(self): - """ Test the api_git_branches method of the flask api with with_commits=True. """ + """Test the api_git_branches method of the flask api with with_commits=True.""" headers = {"Authorization": "token foo_token"} data = {"branch_name": "pats-win-49"} output = self.app.post( @@ -5200,7 +5200,7 @@ class PagureFlaskApiProjectGitBranchestests(tests.Modeltests): ) def test_api_set_git_default_branch_invalid_branch(self): - """ Test the api_git_branches method of the flask api with with_commits=True. """ + """Test the api_git_branches method of the flask api with with_commits=True.""" headers = {"Authorization": "token foo_token"} data = {"branch_name": "main"} output = self.app.post( @@ -5219,7 +5219,7 @@ class PagureFlaskApiProjectGitBranchestests(tests.Modeltests): ) def test_api_set_git_default_branch_invalid_token(self): - """ Test the api_git_branches method of the flask api with with_commits=True. """ + """Test the api_git_branches method of the flask api with with_commits=True.""" headers = {"Authorization": "token aaabbbcccddd"} data = {"branch_name": "main"} output = self.app.post( @@ -5266,7 +5266,7 @@ class PagureFlaskApiProjectCreateProjectTests(tests.Modeltests): maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiProjectCreateProjectTests, self).setUp() tests.create_projects(self.session) @@ -5577,7 +5577,7 @@ class PagureFlaskApiProjectCreateProjectTests(tests.Modeltests): ) def test_api_new_project_user_token(self): - """ Test the api_new_project method of the flask api. """ + """Test the api_new_project method of the flask api.""" headers = {"Authorization": "token foo_token_user"} @@ -5689,7 +5689,7 @@ class PagureFlaskApiProjectCreateProjectTests(tests.Modeltests): @patch.dict("pagure.config.config", {"USER_NAMESPACE": True}) def test_api_new_project_user_ns(self): - """ Test the api_new_project method of the flask api. """ + """Test the api_new_project method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd"} diff --git a/tests/test_pagure_flask_api_project_blockuser.py b/tests/test_pagure_flask_api_project_blockuser.py index 45bdabe..004e07f 100644 --- a/tests/test_pagure_flask_api_project_blockuser.py +++ b/tests/test_pagure_flask_api_project_blockuser.py @@ -34,14 +34,14 @@ import tests class PagureFlaskApiProjectBlockuserTests(tests.SimplePagureTest): - """ Tests for the flask API of pagure for assigning a PR """ + """Tests for the flask API of pagure for assigning a PR""" maxDiff = None @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiProjectBlockuserTests, self).setUp() tests.create_projects(self.session) @@ -72,7 +72,7 @@ class PagureFlaskApiProjectBlockuserTests(tests.SimplePagureTest): self.session.commit() def tearDown(self): - """ Tears down the environment at the end of the tests. """ + """Tears down the environment at the end of the tests.""" project = pagure.lib.query.get_authorized_project(self.session, "test") self.assertEqual(project.block_users, self.blocked_users) diff --git a/tests/test_pagure_flask_api_project_contributors.py b/tests/test_pagure_flask_api_project_contributors.py index fe7021d..2090cc9 100644 --- a/tests/test_pagure_flask_api_project_contributors.py +++ b/tests/test_pagure_flask_api_project_contributors.py @@ -41,7 +41,7 @@ class PagureFlaskApiProjectContributorsTests(tests.SimplePagureTest): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiProjectContributorsTests, self).setUp() tests.create_projects(self.session) diff --git a/tests/test_pagure_flask_api_project_delete_project.py b/tests/test_pagure_flask_api_project_delete_project.py index 7a0d3a1..0831252 100644 --- a/tests/test_pagure_flask_api_project_delete_project.py +++ b/tests/test_pagure_flask_api_project_delete_project.py @@ -34,7 +34,7 @@ from pagure.lib.repo import PagureRepo class PagureFlaskApiProjectDeleteProjecttests(tests.Modeltests): - """ Tests for the flask API of pagure for deleting projects """ + """Tests for the flask API of pagure for deleting projects""" maxDiff = None diff --git a/tests/test_pagure_flask_api_project_git_alias.py b/tests/test_pagure_flask_api_project_git_alias.py index 54abe1a..43f1b3e 100644 --- a/tests/test_pagure_flask_api_project_git_alias.py +++ b/tests/test_pagure_flask_api_project_git_alias.py @@ -70,7 +70,7 @@ def set_up_board(self): class PagureFlaskApiProjectGitAliastests(tests.SimplePagureTest): - """ Tests for flask API for branch alias in pagure """ + """Tests for flask API for branch alias in pagure""" maxDiff = None diff --git a/tests/test_pagure_flask_api_project_git_tags.py b/tests/test_pagure_flask_api_project_git_tags.py index 53c0c68..b7c3a17 100644 --- a/tests/test_pagure_flask_api_project_git_tags.py +++ b/tests/test_pagure_flask_api_project_git_tags.py @@ -22,12 +22,12 @@ import pagure.lib.query class PagureFlaskApiProjectGitTagstests(tests.Modeltests): - """ Tests for the flask API of pagure for creating new git tags """ + """Tests for the flask API of pagure for creating new git tags""" maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiProjectGitTagstests, self).setUp() tests.create_projects(self.session) @@ -41,7 +41,7 @@ class PagureFlaskApiProjectGitTagstests(tests.Modeltests): self.headers = {"Authorization": "token aaabbbcccddd"} def test_api_new_git_tags_no_project(self): - """ Test the api_new_git_tags function. """ + """Test the api_new_git_tags function.""" output = self.app.post("/api/0/foo/git/tags", headers=self.headers) self.assertEqual(output.status_code, 404) expected_rv = { @@ -52,7 +52,7 @@ class PagureFlaskApiProjectGitTagstests(tests.Modeltests): self.assertDictEqual(data, expected_rv) def test_api_new_git_tags_invalid_auth(self): - """ Test the api_new_git_tags function. """ + """Test the api_new_git_tags function.""" headers = self.headers headers["Authorization"] += "foo" output = self.app.post("/api/0/foo/git/tags", headers=headers) @@ -72,7 +72,7 @@ class PagureFlaskApiProjectGitTagstests(tests.Modeltests): self.assertEqual("Invalid token", data["errors"]) def test_api_new_git_tag(self): - """ Test the api_new_git_tags function. """ + """Test the api_new_git_tags function.""" # Before output = self.app.get("/api/0/test/git/tags") @@ -113,7 +113,7 @@ class PagureFlaskApiProjectGitTagstests(tests.Modeltests): self.assertEqual(data["total_tags"], 1) def test_api_new_git_tag_with_commits(self): - """ Test the api_new_git_tags function. """ + """Test the api_new_git_tags function.""" # Before output = self.app.get("/api/0/test/git/tags") @@ -148,7 +148,7 @@ class PagureFlaskApiProjectGitTagstests(tests.Modeltests): self.assertEqual(data["tag_created"], True) def test_api_new_git_tag_with_message(self): - """ Test the api_new_git_tags function. """ + """Test the api_new_git_tags function.""" # Before output = self.app.get("/api/0/test/git/tags") @@ -180,7 +180,7 @@ class PagureFlaskApiProjectGitTagstests(tests.Modeltests): self.assertEqual(data["tag_created"], True) def test_api_new_git_tag_with_message_twice(self): - """ Test the api_new_git_tags function. """ + """Test the api_new_git_tags function.""" # Before output = self.app.get("/api/0/test/git/tags") @@ -231,7 +231,7 @@ class PagureFlaskApiProjectGitTagstests(tests.Modeltests): self.assertEqual(data["tag_created"], False) def test_api_new_git_tag_user_no_access(self): - """ Test the api_new_git_tags function. """ + """Test the api_new_git_tags function.""" tests.create_tokens( self.session, user_id=2, project_id=2, suffix="foo" @@ -269,7 +269,7 @@ class PagureFlaskApiProjectGitTagstests(tests.Modeltests): self.assertEqual(pagure.api.APIERROR.EINVALIDTOK.value, data["error"]) def test_api_new_git_tag_user_global_token(self): - """ Test the api_new_git_tags function. """ + """Test the api_new_git_tags function.""" tests.create_tokens( self.session, user_id=2, project_id=None, suffix="foo" @@ -308,7 +308,7 @@ class PagureFlaskApiProjectGitTagstests(tests.Modeltests): self.assertEqual(data["tag_created"], True) def test_api_new_git_tag_forced(self): - """ Test the api_new_git_tags function. """ + """Test the api_new_git_tags function.""" # Before output = self.app.get("/api/0/test/git/tags") diff --git a/tests/test_pagure_flask_api_project_hascommit.py b/tests/test_pagure_flask_api_project_hascommit.py index 150e157..d6c99ca 100644 --- a/tests/test_pagure_flask_api_project_hascommit.py +++ b/tests/test_pagure_flask_api_project_hascommit.py @@ -41,7 +41,7 @@ class PagureFlaskApiProjectHascommitTests(tests.SimplePagureTest): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiProjectHascommitTests, self).setUp() tests.create_projects(self.session) diff --git a/tests/test_pagure_flask_api_project_tags.py b/tests/test_pagure_flask_api_project_tags.py index 6b57a47..64a4a9d 100644 --- a/tests/test_pagure_flask_api_project_tags.py +++ b/tests/test_pagure_flask_api_project_tags.py @@ -20,10 +20,10 @@ import pagure.lib.query class PagureFlaskApiProjectTagstests(tests.Modeltests): - """ Tests for the flask API of pagure project tags """ + """Tests for the flask API of pagure project tags""" def test_api_project_tags_no_project(self): - """ Test the api_project_tags function. """ + """Test the api_project_tags function.""" output = self.app.get("/api/0/foo/tags/") self.assertEqual(output.status_code, 404) expected_rv = { @@ -34,7 +34,7 @@ class PagureFlaskApiProjectTagstests(tests.Modeltests): self.assertDictEqual(data, expected_rv) def test_api_project_tags(self): - """ Test the api_project_tags function. """ + """Test the api_project_tags function.""" tests.create_projects(self.session) output = self.app.get("/api/0/test/tags/") @@ -73,7 +73,7 @@ class PagureFlaskApiProjectTagstests(tests.Modeltests): self.assertEqual(data["total_tags"], 0) def test_api_project_tags_new_wrong_token(self): - """ Test the api_tags_new method of the flask api. """ + """Test the api_tags_new method of the flask api.""" tests.create_projects(self.session) tests.create_tokens(self.session) tests.create_tokens_acl(self.session) @@ -92,7 +92,7 @@ class PagureFlaskApiProjectTagstests(tests.Modeltests): self.assertDictEqual(data, expected_rv) def test_api_project_tags_new_wrong_project(self): - """ Test the api_tags_new method of the flask api. """ + """Test the api_tags_new method of the flask api.""" tests.create_projects(self.session) tests.create_tokens(self.session) @@ -109,7 +109,7 @@ class PagureFlaskApiProjectTagstests(tests.Modeltests): self.assertDictEqual(data, expected_rv) def test_api_project_tags_new_wrong_acls(self): - """ Test the api_tags_new method of the flask api. """ + """Test the api_tags_new method of the flask api.""" tests.create_projects(self.session) tests.create_tokens(self.session) tests.create_tokens_acl(self.session, acl_name="create_project") @@ -127,7 +127,7 @@ class PagureFlaskApiProjectTagstests(tests.Modeltests): self.assertDictEqual(data, expected_rv) def test_api_project_tags_new_no_input(self): - """ Test the api_tags_new method of the flask api. """ + """Test the api_tags_new method of the flask api.""" tests.create_projects(self.session) tests.create_tokens(self.session) tests.create_tokens_acl(self.session) @@ -146,7 +146,7 @@ class PagureFlaskApiProjectTagstests(tests.Modeltests): self.assertDictEqual(data, expected_rv) def test_api_project_tags_new(self): - """ Test the api_tags_new method of the flask api. """ + """Test the api_tags_new method of the flask api.""" tests.create_projects(self.session) tests.create_tokens(self.session) tests.create_tokens_acl(self.session) @@ -181,7 +181,7 @@ class PagureFlaskApiProjectTagstests(tests.Modeltests): self.assertDictEqual(data, expected_rv) def test_api_project_tags_new_existing_tag(self): - """ Test the api_tags_new method of the flask api. """ + """Test the api_tags_new method of the flask api.""" tests.create_projects(self.session) tests.create_tokens(self.session) tests.create_tokens_acl(self.session) @@ -219,7 +219,7 @@ class PagureFlaskApiProjectTagstests(tests.Modeltests): self.assertDictEqual(data, expected_rv) def test_api_project_tag_delete_wrong_token(self): - """ Test the api_project_tag_delete method of flask api. """ + """Test the api_project_tag_delete method of flask api.""" tests.create_projects(self.session) tests.create_tokens(self.session) tests.create_tokens_acl(self.session) @@ -238,7 +238,7 @@ class PagureFlaskApiProjectTagstests(tests.Modeltests): self.assertDictEqual(data, expected_rv) def test_api_project_tag_delete_wrong_project(self): - """ Test the api_project_tag_delete method of flask api. """ + """Test the api_project_tag_delete method of flask api.""" tests.create_projects(self.session) tests.create_tokens(self.session) tests.create_tokens_acl(self.session) @@ -254,7 +254,7 @@ class PagureFlaskApiProjectTagstests(tests.Modeltests): self.assertDictEqual(data, expected_rv) def test_api_project_tag_delete_wrong_tag(self): - """ Test the api_project_tag_delete method of flask api. """ + """Test the api_project_tag_delete method of flask api.""" tests.create_projects(self.session) tests.create_tokens(self.session) tests.create_tokens_acl(self.session) @@ -267,7 +267,7 @@ class PagureFlaskApiProjectTagstests(tests.Modeltests): self.assertDictEqual(data, expected_rv) def test_api_project_tag_delete(self): - """ Test the api_project_tag_delete method of flask api. """ + """Test the api_project_tag_delete method of flask api.""" tests.create_projects(self.session) tests.create_tokens(self.session) tests.create_tokens_acl(self.session) @@ -296,7 +296,7 @@ class PagureFlaskApiProjectTagstests(tests.Modeltests): self.assertDictEqual(data, expected_rv) def test_api_project_tag_delete_with_assigned_issue_and_pr(self): - """ Test the api_project_tag_delete method of flask api. """ + """Test the api_project_tag_delete method of flask api.""" tests.create_projects(self.session) tests.create_tokens(self.session) tests.create_tokens_acl(self.session) @@ -360,7 +360,7 @@ class PagureFlaskApiProjectTagstests(tests.Modeltests): self.assertDictEqual(data, expected_rv) def test_api_project_tag_view_no_project(self): - """ Test the api_project_tag_view method of the flask api. """ + """Test the api_project_tag_view method of the flask api.""" output = self.app.get("/api/0/foo/tag/tag1") self.assertEqual(output.status_code, 404) expected_rv = { @@ -371,7 +371,7 @@ class PagureFlaskApiProjectTagstests(tests.Modeltests): self.assertDictEqual(data, expected_rv) def test_api_project_tag_view_wrong_tag(self): - """ Test the api_project_tag_view method of the flask api. """ + """Test the api_project_tag_view method of the flask api.""" tests.create_projects(self.session) tests.create_tokens(self.session) tests.create_tokens_acl(self.session) @@ -388,7 +388,7 @@ class PagureFlaskApiProjectTagstests(tests.Modeltests): self.assertDictEqual(data, expected_rv) def test_api_project_tag_view(self): - """ Test the api_project_tag_view method of the flask api. """ + """Test the api_project_tag_view method of the flask api.""" tests.create_projects(self.session) tests.create_tokens(self.session) tests.create_tokens_acl(self.session) diff --git a/tests/test_pagure_flask_api_project_update_watch.py b/tests/test_pagure_flask_api_project_update_watch.py index f699e62..3025413 100644 --- a/tests/test_pagure_flask_api_project_update_watch.py +++ b/tests/test_pagure_flask_api_project_update_watch.py @@ -36,7 +36,7 @@ class PagureFlaskApiProjectUpdateWatchTests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiProjectUpdateWatchTests, self).setUp() tests.create_projects(self.session) @@ -78,7 +78,7 @@ class PagureFlaskApiProjectUpdateWatchTests(tests.Modeltests): tests.create_tokens_acl(self.session, token_id="project-less-foo") def test_api_update_project_watchers_invalid_project(self): - """ Test the api_update_project_watchers method of the flask api. """ + """Test the api_update_project_watchers method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd"} @@ -93,7 +93,7 @@ class PagureFlaskApiProjectUpdateWatchTests(tests.Modeltests): ) def test_api_change_status_issue_token_not_for_project(self): - """ Test the api_update_project_watchers method of the flask api. """ + """Test the api_update_project_watchers method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd"} @@ -107,7 +107,7 @@ class PagureFlaskApiProjectUpdateWatchTests(tests.Modeltests): self.assertEqual(pagure.api.APIERROR.EINVALIDTOK.value, data["error"]) def test_api_update_project_watchers_no_user_watching(self): - """ Test the api_update_project_watchers method of the flask api. """ + """Test the api_update_project_watchers method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd"} data = {"status": "42"} @@ -126,7 +126,7 @@ class PagureFlaskApiProjectUpdateWatchTests(tests.Modeltests): ) def test_api_update_project_watchers_no_watch_status(self): - """ Test the api_update_project_watchers method of the flask api. """ + """Test the api_update_project_watchers method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd"} data = {"watcher": "pingou"} @@ -145,7 +145,7 @@ class PagureFlaskApiProjectUpdateWatchTests(tests.Modeltests): ) def test_api_update_project_watchers_invalid_status(self): - """ Test the api_update_project_watchers method of the flask api. """ + """Test the api_update_project_watchers method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd"} data = {"watcher": "pingou", "status": "42"} @@ -164,7 +164,7 @@ class PagureFlaskApiProjectUpdateWatchTests(tests.Modeltests): ) def test_api_update_project_watchers_invalid_user(self): - """ Test the api_update_project_watchers method of the flask api. """ + """Test the api_update_project_watchers method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd"} data = {"watcher": "example", "status": "2"} @@ -183,7 +183,7 @@ class PagureFlaskApiProjectUpdateWatchTests(tests.Modeltests): ) def test_api_update_project_watchers_other_user(self): - """ Test the api_update_project_watchers method of the flask api. """ + """Test the api_update_project_watchers method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd"} data = {"watcher": "foo", "status": "2"} @@ -202,7 +202,7 @@ class PagureFlaskApiProjectUpdateWatchTests(tests.Modeltests): ) def test_api_update_project_watchers_all_good(self): - """ Test the api_update_project_watchers method of the flask api. """ + """Test the api_update_project_watchers method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd"} data = {"watcher": "pingou", "status": 1} @@ -222,7 +222,7 @@ class PagureFlaskApiProjectUpdateWatchTests(tests.Modeltests): @patch("pagure.utils.is_admin", MagicMock(return_value=True)) def test_api_update_project_watchers_other_user_admin(self): - """ Test the api_update_project_watchers method of the flask api. """ + """Test the api_update_project_watchers method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd"} data = {"watcher": "foo", "status": "2"} @@ -242,7 +242,7 @@ class PagureFlaskApiProjectUpdateWatchTests(tests.Modeltests): @patch("pagure.utils.is_admin", MagicMock(return_value=True)) def test_api_update_project_watchers_set_then_reset(self): - """ Test the api_update_project_watchers method of the flask api. """ + """Test the api_update_project_watchers method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd_project_less"} data = {"watcher": "foo", "status": "2"} @@ -274,7 +274,7 @@ class PagureFlaskApiProjectUpdateWatchTests(tests.Modeltests): @patch("pagure.utils.is_admin", MagicMock(return_value=True)) def test_api_update_project_watchers_invalid_user_admin(self): - """ Test the api_update_project_watchers method of the flask api. """ + """Test the api_update_project_watchers method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd"} data = {"watcher": "example", "status": "2"} @@ -294,7 +294,7 @@ class PagureFlaskApiProjectUpdateWatchTests(tests.Modeltests): @patch("pagure.utils.is_admin", MagicMock(return_value=True)) def test_api_update_project_watchers_missing_user_admin(self): - """ Test the api_update_project_watchers method of the flask api. """ + """Test the api_update_project_watchers method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd"} data = {"status": "2"} diff --git a/tests/test_pagure_flask_api_project_view_file.py b/tests/test_pagure_flask_api_project_view_file.py index 708a968..a05e16f 100644 --- a/tests/test_pagure_flask_api_project_view_file.py +++ b/tests/test_pagure_flask_api_project_view_file.py @@ -33,7 +33,7 @@ from pagure.lib.repo import PagureRepo class PagureFlaskApiProjectViewFiletests(tests.Modeltests): - """ Tests for the flask API of pagure for issue """ + """Tests for the flask API of pagure for issue""" maxDiff = None diff --git a/tests/test_pagure_flask_api_ui_private_repo.py b/tests/test_pagure_flask_api_ui_private_repo.py index e5669ee..f0aba34 100644 --- a/tests/test_pagure_flask_api_ui_private_repo.py +++ b/tests/test_pagure_flask_api_ui_private_repo.py @@ -250,12 +250,12 @@ FULL_ISSUE_LIST = [ class PagurePrivateRepotest(tests.Modeltests): - """ Tests for private repo in pagure """ + """Tests for private repo in pagure""" maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagurePrivateRepotest, self).setUp() pagure.config.config["TESTING"] = True @@ -411,7 +411,7 @@ class PagurePrivateRepotest(tests.Modeltests): shutil.rmtree(newpath) def test_index(self): - """ Test the index endpoint. """ + """Test the index endpoint.""" output = self.app.get("/") self.assertEqual(output.status_code, 200) @@ -469,7 +469,7 @@ class PagurePrivateRepotest(tests.Modeltests): ) def test_view_user(self): - """ Test the view_user endpoint. """ + """Test the view_user endpoint.""" output = self.app.get("/user/foo?repopage=abc&forkpage=def") self.assertEqual(output.status_code, 200) @@ -703,7 +703,7 @@ class PagurePrivateRepotest(tests.Modeltests): @patch("pagure.decorators.admin_session_timedout") def test_private_settings_ui(self, ast): - """ Test UI for private repo""" + """Test UI for private repo""" ast.return_value = False # Add private repo @@ -758,7 +758,7 @@ class PagurePrivateRepotest(tests.Modeltests): @patch("pagure.decorators.admin_session_timedout") def test_private_settings_ui_update_privacy_false(self, ast): - """ Test UI for private repo""" + """Test UI for private repo""" ast.return_value = False # Add private repo @@ -815,7 +815,7 @@ class PagurePrivateRepotest(tests.Modeltests): @patch("pagure.decorators.admin_session_timedout") def test_private_settings_ui_update_privacy_true(self, ast): - """ Test UI for private repo""" + """Test UI for private repo""" ast.return_value = False # Add private repo @@ -980,7 +980,7 @@ class PagurePrivateRepotest(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_private_repo_issues_ui(self, p_send_email, p_ugt): - """ Test issues made to private repo""" + """Test issues made to private repo""" p_send_email.return_value = True p_ugt.return_value = True @@ -1086,7 +1086,7 @@ class PagurePrivateRepotest(tests.Modeltests): @patch("pagure.decorators.admin_session_timedout") def test_private_repo_ui_for_different_repo_user(self, ast): - """ Test the private repo for different ACLS""" + """Test the private repo for different ACLS""" ast.return_value = False # Add private repo @@ -1183,7 +1183,7 @@ class PagurePrivateRepotest(tests.Modeltests): # API checks def test_api_private_repo_projects(self): - """ Test api points for private repo for projects""" + """Test api points for private repo for projects""" # Add private repo item = pagure.lib.model.Project( @@ -1514,7 +1514,7 @@ class PagurePrivateRepotest(tests.Modeltests): # Api pull-request views @patch("pagure.lib.notify.send_email") def test_api_private_repo_fork(self, send_email): - """ Test api endpoints in api/fork""" + """Test api endpoints in api/fork""" send_email.return_value = True @@ -1858,7 +1858,7 @@ class PagurePrivateRepotest(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_api_pr_private_repo_add_comment(self, mockemail): - """ Test the api_pull_request_add_comment method of the flask api. """ + """Test the api_pull_request_add_comment method of the flask api.""" mockemail.return_value = True pagure.config.config["REQUESTS_FOLDER"] = None @@ -1942,7 +1942,7 @@ class PagurePrivateRepotest(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_api_private_repo_pr_add_flag(self, mockemail): - """ Test the api_pull_request_add_flag method of the flask api. """ + """Test the api_pull_request_add_flag method of the flask api.""" mockemail.return_value = True pagure.config.config["REQUESTS_FOLDER"] = None @@ -2179,7 +2179,7 @@ class PagurePrivateRepotest(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_api_private_repo_pr_close(self, send_email): - """ Test the api_pull_request_close method of the flask api. """ + """Test the api_pull_request_close method of the flask api.""" send_email.return_value = True pagure.config.config["REQUESTS_FOLDER"] = None @@ -2305,7 +2305,7 @@ class PagurePrivateRepotest(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_api_private_repo_pr_merge(self, send_email): - """ Test the api_pull_request_merge method of the flask api. """ + """Test the api_pull_request_merge method of the flask api.""" send_email.return_value = True pagure.config.config["REQUESTS_FOLDER"] = None @@ -2441,7 +2441,7 @@ class PagurePrivateRepotest(tests.Modeltests): self.assertDictEqual(data, {"message": "Changes merged!"}) def test_api_private_repo_new_issue(self): - """ Test the api_new_issue method of the flask api. """ + """Test the api_new_issue method of the flask api.""" # Add private repo item = pagure.lib.model.Project( user_id=1, # pingou @@ -2552,7 +2552,7 @@ class PagurePrivateRepotest(tests.Modeltests): ) def test_api_private_repo_view_issues(self): - """ Test the api_view_issues method of the flask api. """ + """Test the api_view_issues method of the flask api.""" self.test_api_private_repo_new_issue() # Invalid repo @@ -3024,7 +3024,7 @@ class PagurePrivateRepotest(tests.Modeltests): ) def test_api_pivate_repo_view_issue(self): - """ Test the api_view_issue method of the flask api. """ + """Test the api_view_issue method of the flask api.""" self.test_api_private_repo_new_issue() # Invalid repo @@ -3151,7 +3151,7 @@ class PagurePrivateRepotest(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_api_private_repo_change_status_issue(self): - """ Test the api_change_status_issue method of the flask api. """ + """Test the api_change_status_issue method of the flask api.""" item = pagure.lib.model.Project( user_id=1, # pingou name="test4", @@ -3293,7 +3293,7 @@ class PagurePrivateRepotest(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_api_private_repo_comment_issue(self, p_send_email, p_ugt): - """ Test the api_comment_issue method of the flask api. """ + """Test the api_comment_issue method of the flask api.""" p_send_email.return_value = True p_ugt.return_value = True @@ -3412,7 +3412,7 @@ class PagurePrivateRepotest(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_api_view_issue_comment(self, p_send_email, p_ugt): - """ Test the api_view_issue_comment endpoint. """ + """Test the api_view_issue_comment endpoint.""" p_send_email.return_value = True p_ugt.return_value = True diff --git a/tests/test_pagure_flask_api_user.py b/tests/test_pagure_flask_api_user.py index 3609294..04a0e6c 100644 --- a/tests/test_pagure_flask_api_user.py +++ b/tests/test_pagure_flask_api_user.py @@ -32,18 +32,18 @@ import tests class PagureFlaskApiUSertests(tests.Modeltests): - """ Tests for the flask API of pagure for issue """ + """Tests for the flask API of pagure for issue""" maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiUSertests, self).setUp() pagure.config.config["REQUESTS_FOLDER"] = None def test_api_users(self): - """ Test the api_users function. """ + """Test the api_users function.""" output = self.app.get("/api/0/users") self.assertEqual(output.status_code, 200) @@ -759,12 +759,12 @@ class PagureFlaskApiUSertests(tests.Modeltests): class PagureFlaskApiUsertestrequests(tests.Modeltests): - """ Tests for the user requests endpoints """ + """Tests for the user requests endpoints""" maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiUsertestrequests, self).setUp() pagure.config.config["REQUESTS_FOLDER"] = None @@ -1288,7 +1288,7 @@ class PagureFlaskApiUsertestrequests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_api_view_user_requests_filed_foo_grp_access(self, mockemail): - """ Test when the user has accessed to some PRs via a group. """ + """Test when the user has accessed to some PRs via a group.""" # Add the user to a group msg = pagure.lib.query.add_group( @@ -1652,12 +1652,12 @@ class PagureFlaskApiUsertestrequests(tests.Modeltests): class PagureFlaskApiUsertestissues(tests.Modeltests): - """ Tests for the user issues endpoints """ + """Tests for the user issues endpoints""" maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskApiUsertestissues, self).setUp() pagure.config.config["REQUESTS_FOLDER"] = None @@ -1678,7 +1678,7 @@ class PagureFlaskApiUsertestissues(tests.Modeltests): self.assertEqual(msg.title, "Test issue") def test_user_issues_empty(self): - """ Return the list of issues associated with the specified user. """ + """Return the list of issues associated with the specified user.""" output = self.app.get("/api/0/user/foo/issues") self.assertEqual(output.status_code, 200) @@ -1733,7 +1733,7 @@ class PagureFlaskApiUsertestissues(tests.Modeltests): ) def test_user_issues(self): - """ Return the list of issues associated with the specified user. """ + """Return the list of issues associated with the specified user.""" output = self.app.get("/api/0/user/pingou/issues") self.assertEqual(output.status_code, 200) diff --git a/tests/test_pagure_flask_docs.py b/tests/test_pagure_flask_docs.py index d187bd8..0752d3d 100644 --- a/tests/test_pagure_flask_docs.py +++ b/tests/test_pagure_flask_docs.py @@ -31,10 +31,10 @@ from pagure.lib.repo import PagureRepo class PagureFlaskDocstests(tests.SimplePagureTest): - """ Tests for flask docs of pagure """ + """Tests for flask docs of pagure""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskDocstests, self).setUp() pagure.docs_server.APP.config["TESTING"] = True @@ -98,7 +98,7 @@ class PagureFlaskDocstests(tests.SimplePagureTest): self.session.commit() def test_view_docs_no_project(self): - """ Test the view_docs endpoint with no project. """ + """Test the view_docs endpoint with no project.""" output = self.app.get("/foo/docs") self.assertEqual(output.status_code, 404) @@ -146,7 +146,7 @@ class PagureFlaskDocstests(tests.SimplePagureTest): self.assertEqual(output.status_code, 404) def test_view_docs_empty_repo(self): - """ Test the view_docs endpoint when the git repo is empty. """ + """Test the view_docs endpoint when the git repo is empty.""" tests.create_projects(self.session) repo = pygit2.init_repository( os.path.join(self.path, "repos", "docs", "test.git"), bare=True @@ -169,7 +169,7 @@ class PagureFlaskDocstests(tests.SimplePagureTest): ) def test_view_docs(self): - """ Test the view_docs endpoint. """ + """Test the view_docs endpoint.""" tests.create_projects(self.session) repo = pygit2.init_repository( os.path.join(self.path, "repos", "docs", "test.git"), bare=True @@ -220,7 +220,7 @@ class PagureFlaskDocstests(tests.SimplePagureTest): mock.MagicMock(side_effect=pagure.exceptions.PagureEncodingException), ) def test_view_docs_encoding_error(self): - """ Test viewing a file of which we cannot find the encoding. """ + """Test viewing a file of which we cannot find the encoding.""" tests.create_projects(self.session) repo = pygit2.init_repository( os.path.join(self.path, "repos", "docs", "test.git"), bare=True @@ -246,7 +246,7 @@ class PagureFlaskDocstests(tests.SimplePagureTest): "pagure.lib.encoding_utils.decode", mock.MagicMock(side_effect=IOError) ) def test_view_docs_unknown_error(self): - """ Test viewing a file of which we cannot find the encoding. """ + """Test viewing a file of which we cannot find the encoding.""" tests.create_projects(self.session) repo = pygit2.init_repository( os.path.join(self.path, "repos", "docs", "test.git"), bare=True diff --git a/tests/test_pagure_flask_dump_load_ticket.py b/tests/test_pagure_flask_dump_load_ticket.py index d20597b..828a668 100644 --- a/tests/test_pagure_flask_dump_load_ticket.py +++ b/tests/test_pagure_flask_dump_load_ticket.py @@ -39,7 +39,7 @@ class PagureFlaskDumpLoadTicketTests(tests.Modeltests): @patch("pagure.lib.notify.send_email") @patch("pagure.lib.git._maybe_wait") def test_dumping_reloading_ticket(self, mw, send_email): - """ Test dumping a ticket into a JSON blob. """ + """Test dumping a ticket into a JSON blob.""" mw.side_effect = lambda result: result.get() send_email.return_value = True diff --git a/tests/test_pagure_flask_form.py b/tests/test_pagure_flask_form.py index b32648d..3613554 100644 --- a/tests/test_pagure_flask_form.py +++ b/tests/test_pagure_flask_form.py @@ -29,7 +29,7 @@ import tests class PagureFlaskFormTests(tests.SimplePagureTest): - """ Tests for forms of the flask application """ + """Tests for forms of the flask application""" @patch.dict( "pagure.config.config", {"SERVER_NAME": "localhost.localdomain"} @@ -38,14 +38,14 @@ class PagureFlaskFormTests(tests.SimplePagureTest): super(PagureFlaskFormTests, self).setUp() def test_csrf_form_no_input(self): - """ Test the CSRF validation if not CSRF is specified. """ + """Test the CSRF validation if not CSRF is specified.""" with self.app.application.test_request_context(method="POST"): flask.g.session = MagicMock() form = pagure.forms.ConfirmationForm() self.assertFalse(form.validate_on_submit()) def test_csrf_form_w_invalid_input(self): - """ Test the CSRF validation with an invalid CSRF specified. """ + """Test the CSRF validation with an invalid CSRF specified.""" with self.app.application.test_request_context(method="POST"): flask.g.session = MagicMock() form = pagure.forms.ConfirmationForm() @@ -53,7 +53,7 @@ class PagureFlaskFormTests(tests.SimplePagureTest): self.assertFalse(form.validate_on_submit()) def test_csrf_form_w_input(self): - """ Test the CSRF validation with a valid CSRF specified. """ + """Test the CSRF validation with a valid CSRF specified.""" with self.app.application.test_request_context(method="POST"): flask.g.session = MagicMock() form = pagure.forms.ConfirmationForm() @@ -61,7 +61,7 @@ class PagureFlaskFormTests(tests.SimplePagureTest): self.assertTrue(form.validate_on_submit()) def test_csrf_form_w_expired_input(self): - """ Test the CSRF validation with an expired CSRF specified. """ + """Test the CSRF validation with an expired CSRF specified.""" with self.app.application.test_request_context(method="POST"): flask.g.session = MagicMock() form = pagure.forms.ConfirmationForm() @@ -101,7 +101,7 @@ class PagureFlaskFormTests(tests.SimplePagureTest): self.assertFalse(form.validate_on_submit()) def test_csrf_form_w_unexpiring_input(self): - """ Test the CSRF validation with a CSRF not expiring. """ + """Test the CSRF validation with a CSRF not expiring.""" pagure.config.config["WTF_CSRF_TIME_LIMIT"] = None with self.app.application.test_request_context(method="POST"): flask.g.session = MagicMock() @@ -119,7 +119,7 @@ class PagureFlaskFormTests(tests.SimplePagureTest): self.assertTrue(form.validate_on_submit()) def test_add_user_form(self): - """ Test the AddUserForm of pagure.forms """ + """Test the AddUserForm of pagure.forms""" with self.app.application.test_request_context(method="POST"): flask.g.session = MagicMock() form = pagure.forms.AddUserForm() @@ -133,7 +133,7 @@ class PagureFlaskFormTests(tests.SimplePagureTest): self.assertTrue(form.validate_on_submit()) def test_add_user_to_group_form(self): - """ Test the AddUserToGroup form of pagure.forms """ + """Test the AddUserToGroup form of pagure.forms""" with self.app.application.test_request_context(method="POST"): flask.g.session = MagicMock() form = pagure.forms.AddUserToGroupForm() @@ -145,7 +145,7 @@ class PagureFlaskFormTests(tests.SimplePagureTest): self.assertTrue(form.validate_on_submit()) def test_add_group_form(self): - """ Test the AddGroupForm form of pagure.forms """ + """Test the AddGroupForm form of pagure.forms""" with self.app.application.test_request_context(method="POST"): flask.g.session = MagicMock() form = pagure.forms.AddGroupForm() diff --git a/tests/test_pagure_flask_internal.py b/tests/test_pagure_flask_internal.py index 6853068..eae24a5 100644 --- a/tests/test_pagure_flask_internal.py +++ b/tests/test_pagure_flask_internal.py @@ -31,12 +31,12 @@ from pagure.lib.repo import PagureRepo class PagureFlaskInternaltests(tests.Modeltests): - """ Tests for flask Internal controller of pagure """ + """Tests for flask Internal controller of pagure""" maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskInternaltests, self).setUp() pagure.config.config["IP_ALLOWED_INTERNAL"] = list( @@ -75,7 +75,7 @@ class PagureFlaskInternaltests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_pull_request_add_comment(self, send_email): - """ Test the pull_request_add_comment function. """ + """Test the pull_request_add_comment function.""" send_email.return_value = True tests.create_projects(self.session) @@ -150,7 +150,7 @@ class PagureFlaskInternaltests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_ticket_add_comment(self, send_email): - """ Test the ticket_add_comment function. """ + """Test the ticket_add_comment function.""" send_email.return_value = True tests.create_projects(self.session) @@ -221,7 +221,7 @@ class PagureFlaskInternaltests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_private_ticket_add_comment(self, send_email): - """ Test the ticket_add_comment function on a private ticket. """ + """Test the ticket_add_comment function on a private ticket.""" send_email.return_value = True tests.create_projects(self.session) @@ -298,7 +298,7 @@ class PagureFlaskInternaltests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_private_ticket_add_comment_acl(self, send_email): - """ Test the ticket_add_comment function on a private ticket. """ + """Test the ticket_add_comment function on a private ticket.""" send_email.return_value = True tests.create_projects(self.session) @@ -1549,7 +1549,7 @@ class PagureFlaskInternaltests(tests.Modeltests): self.assertDictEqual(js_data, exp) def test_get_branches_of_commit(self): - """ Test the get_branches_of_commit from the internal API. """ + """Test the get_branches_of_commit from the internal API.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos")) @@ -1720,7 +1720,7 @@ class PagureFlaskInternaltests(tests.Modeltests): ) def test_get_branches_of_commit_with_unrelated_branches(self): - """ Test the get_branches_of_commit from the internal API. """ + """Test the get_branches_of_commit from the internal API.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos")) @@ -1791,7 +1791,7 @@ class PagureFlaskInternaltests(tests.Modeltests): self.assertDictEqual(js_data, {"code": "OK", "branches": ["feature"]}) def test_get_branches_head(self): - """ Test the get_branches_head from the internal API. """ + """Test the get_branches_head from the internal API.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos")) @@ -1942,7 +1942,7 @@ class PagureFlaskInternaltests(tests.Modeltests): self.assertEqual(len(js_data["branches"]), 3) def test_get_stats_commits_no_token(self): - """ Test the get_stats_commits from the internal API. """ + """Test the get_stats_commits from the internal API.""" # No CSRF token data = {"repo": "fakerepo"} output = self.app.post("/pv/stats/commits/authors", data=data) @@ -1953,7 +1953,7 @@ class PagureFlaskInternaltests(tests.Modeltests): ) def test_get_stats_commits_invalid_repo(self): - """ Test the get_stats_commits from the internal API. """ + """Test the get_stats_commits from the internal API.""" user = tests.FakeUser() user.username = "pingou" with tests.user_set(self.app.application, user): @@ -1973,7 +1973,7 @@ class PagureFlaskInternaltests(tests.Modeltests): ) def test_get_stats_commits_empty_git(self): - """ Test the get_stats_commits from the internal API. """ + """Test the get_stats_commits from the internal API.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos")) @@ -2005,7 +2005,7 @@ class PagureFlaskInternaltests(tests.Modeltests): ) def test_get_stats_commits_git_populated(self): - """ Test the get_stats_commits from the internal API. """ + """Test the get_stats_commits from the internal API.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) tests.add_content_git_repo( @@ -2084,7 +2084,7 @@ class PagureFlaskInternaltests(tests.Modeltests): ) def test_get_stats_commits_trend_no_token(self): - """ Test the get_stats_commits_trend from the internal API. """ + """Test the get_stats_commits_trend from the internal API.""" # No CSRF token data = {"repo": "fakerepo"} output = self.app.post("/pv/stats/commits/trend", data=data) @@ -2095,7 +2095,7 @@ class PagureFlaskInternaltests(tests.Modeltests): ) def test_get_stats_commits_trend_invalid_repo(self): - """ Test the get_stats_commits_trend from the internal API. """ + """Test the get_stats_commits_trend from the internal API.""" user = tests.FakeUser() user.username = "pingou" with tests.user_set(self.app.application, user): @@ -2115,7 +2115,7 @@ class PagureFlaskInternaltests(tests.Modeltests): ) def test_get_stats_commits_trend_empty_git(self): - """ Test the get_stats_commits_trend from the internal API. """ + """Test the get_stats_commits_trend from the internal API.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos")) @@ -2147,7 +2147,7 @@ class PagureFlaskInternaltests(tests.Modeltests): ) def test_get_stats_commits_trend_git_populated(self): - """ Test the get_stats_commits_trend from the internal API. """ + """Test the get_stats_commits_trend from the internal API.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) tests.add_content_git_repo( @@ -2177,12 +2177,12 @@ class PagureFlaskInternaltests(tests.Modeltests): self.assertDictEqual(js_data2, {"results": [[str(today), 2]]}) def test_get_project_family_no_project(self): - """ Test the get_project_family from the internal API. """ + """Test the get_project_family from the internal API.""" output = self.app.post("/pv/test/family") self.assertEqual(output.status_code, 404) def test_get_project_family_no_csrf(self): - """ Test the get_project_family from the internal API. """ + """Test the get_project_family from the internal API.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) tests.add_content_git_repo( @@ -2197,7 +2197,7 @@ class PagureFlaskInternaltests(tests.Modeltests): self.assertEqual(js_data["message"], "Invalid input submitted") def test_get_project_family(self): - """ Test the get_project_family from the internal API. """ + """Test the get_project_family from the internal API.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) tests.add_content_git_repo( @@ -2218,7 +2218,7 @@ class PagureFlaskInternaltests(tests.Modeltests): self.assertEqual(js_data["family"], ["test"]) def test_get_project_larger_family(self): - """ Test the get_project_family from the internal API. """ + """Test the get_project_family from the internal API.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -2284,7 +2284,7 @@ class PagureFlaskInternaltests(tests.Modeltests): ) def test_get_project_larger_family_pr_only(self): - """ Test the get_project_family from the internal API. """ + """Test the get_project_family from the internal API.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -2858,7 +2858,7 @@ class PagureFlaskInternaltests(tests.Modeltests): {"REPOSPANNER_REGIONS": {"region": {"repo_prefix": "prefix"}}}, ) def test_check_ssh_access(self): - """ Test the SSH access check endpoint. """ + """Test the SSH access check endpoint.""" tests.create_projects(self.session) self.session.query(pagure.lib.model.Project).filter( pagure.lib.model.Project.name == "test2" diff --git a/tests/test_pagure_flask_rebase.py b/tests/test_pagure_flask_rebase.py index f7632f0..ca40101 100644 --- a/tests/test_pagure_flask_rebase.py +++ b/tests/test_pagure_flask_rebase.py @@ -31,14 +31,14 @@ import tests class PagureRebaseBasetests(tests.Modeltests): - """ Tests rebasing pull-request in pagure """ + """Tests rebasing pull-request in pagure""" maxDiff = None config_values = {"authbackend": "pagure"} @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureRebaseBasetests, self).setUp() pagure.config.config["REQUESTS_FOLDER"] = None @@ -104,10 +104,10 @@ class PagureRebaseBasetests(tests.Modeltests): class PagureRebasetests(PagureRebaseBasetests): - """ Tests rebasing pull-request in pagure """ + """Tests rebasing pull-request in pagure""" def test_merge_status_merge(self): - """ Test that the PR can be merged with a merge commit. """ + """Test that the PR can be merged with a merge commit.""" user = tests.FakeUser(username="pingou") with tests.user_set(self.app.application, user): @@ -160,7 +160,7 @@ class PagureRebasetests(PagureRebaseBasetests): ) def test_rebase_task(self): - """ Test the rebase PR task and its outcome. """ + """Test the rebase PR task and its outcome.""" pagure.lib.tasks.rebase_pull_request( "test", namespace=None, @@ -377,7 +377,7 @@ class PagureRebasetests(PagureRebaseBasetests): ) def test_rebase_api_api_logged_in_unknown_project(self): - """ Test the rebase PR API endpoint when the project doesn't exist """ + """Test the rebase PR API endpoint when the project doesn't exist""" tests.create_tokens(self.session) tests.create_tokens_acl(self.session) @@ -394,7 +394,7 @@ class PagureRebasetests(PagureRebaseBasetests): ) def test_rebase_api_api_logged_in_unknown_pr(self): - """ Test the rebase PR API endpoint when the PR doesn't exist """ + """Test the rebase PR API endpoint when the PR doesn't exist""" tests.create_tokens(self.session) tests.create_tokens_acl(self.session) @@ -411,7 +411,7 @@ class PagureRebasetests(PagureRebaseBasetests): ) def test_rebase_api_api_logged_in_unknown_token(self): - """ Test the rebase PR API endpoint with an invalid API token """ + """Test the rebase PR API endpoint with an invalid API token""" tests.create_tokens(self.session) tests.create_tokens_acl(self.session) @@ -436,7 +436,7 @@ class PagureRebasetests(PagureRebaseBasetests): class PagureRebaseNoHooktests(PagureRebaseBasetests): - """ Tests rebasing pull-request in pagure """ + """Tests rebasing pull-request in pagure""" config_values = {"authbackend": "pagure", "nogithooks": True} @@ -826,13 +826,13 @@ class PagureRebaseNoHooktests(PagureRebaseBasetests): class PagureRebaseNotAllowedtests(tests.Modeltests): - """ Tests rebasing pull-request in pagure """ + """Tests rebasing pull-request in pagure""" maxDiff = None @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureRebaseNotAllowedtests, self).setUp() pagure.config.config["REQUESTS_FOLDER"] = None diff --git a/tests/test_pagure_flask_ui_app.py b/tests/test_pagure_flask_ui_app.py index d981262..9f50fe3 100644 --- a/tests/test_pagure_flask_ui_app.py +++ b/tests/test_pagure_flask_ui_app.py @@ -31,10 +31,10 @@ import tests class PagureFlaskApptests(tests.Modeltests): - """ Tests for flask app controller of pagure """ + """Tests for flask app controller of pagure""" def test_watch_list(self): - """ Test for watch list of a user """ + """Test for watch list of a user""" user = tests.FakeUser(username="pingou") with tests.user_set(self.app.application, user): @@ -55,7 +55,7 @@ class PagureFlaskApptests(tests.Modeltests): ) def test_view_users(self): - """ Test the view_users endpoint. """ + """Test the view_users endpoint.""" output = self.app.get("/users/?page=abc") self.assertEqual(output.status_code, 200) @@ -78,7 +78,7 @@ class PagureFlaskApptests(tests.Modeltests): @patch.dict("pagure.config.config", {"ITEM_PER_PAGE": 2}) def test_view_user_repo_cnt(self): - """ Test the repo counts on the view_user endpoint. """ + """Test the repo counts on the view_user endpoint.""" tests.create_projects(self.session) self.gitrepos = tests.create_projects_git( pagure.config.config["GIT_FOLDER"] @@ -113,7 +113,7 @@ class PagureFlaskApptests(tests.Modeltests): ) def test_view_user(self): - """ Test the view_user endpoint. """ + """Test the view_user endpoint.""" output = self.app.get("/user/pingou?repopage=abc&forkpage=def") self.assertEqual(output.status_code, 200) @@ -188,7 +188,7 @@ class PagureFlaskApptests(tests.Modeltests): }, ) def test_adopt_repos(self): - """ Test the new_project endpoint with existing git repo. """ + """Test the new_project endpoint with existing git repo.""" # Before projects = pagure.lib.query.search_projects(self.session) self.assertEqual(len(projects), 0) @@ -221,7 +221,7 @@ class PagureFlaskApptests(tests.Modeltests): {"PAGURE_ADMIN_USERS": [], "USERS_IGNORE_EXISTING_REPOS": ["pingou"]}, ) def test_adopt_repos_non_admin(self): - """ Test the new_project endpoint with existing git repo for non-admins. """ + """Test the new_project endpoint with existing git repo for non-admins.""" # Before projects = pagure.lib.query.search_projects(self.session) self.assertEqual(len(projects), 0) @@ -254,7 +254,7 @@ class PagureFlaskApptests(tests.Modeltests): {"PAGURE_ADMIN_USERS": [], "USERS_IGNORE_EXISTING_REPOS": []}, ) def test_adopt_repos_not_allowed(self): - """ Test the new_project endpoint with existing git repo for no access. """ + """Test the new_project endpoint with existing git repo for no access.""" # Before projects = pagure.lib.query.search_projects(self.session) self.assertEqual(len(projects), 0) @@ -284,7 +284,7 @@ class PagureFlaskApptests(tests.Modeltests): @patch.dict("pagure.config.config", {"PROJECT_NAME_REGEX": "^1[a-z]*$"}) def test_new_project_diff_regex(self): - """ Test the new_project endpoint with a different regex. """ + """Test the new_project endpoint with a different regex.""" # Before projects = pagure.lib.query.search_projects(self.session) self.assertEqual(len(projects), 0) @@ -317,7 +317,7 @@ class PagureFlaskApptests(tests.Modeltests): @patch.dict("pagure.config.config", {"PRIVATE_PROJECTS": True}) def test_new_project_private(self): - """ Test the new_project endpoint for a private project. """ + """Test the new_project endpoint for a private project.""" # Before projects = pagure.lib.query.search_projects(self.session) self.assertEqual(len(projects), 0) @@ -436,7 +436,7 @@ class PagureFlaskApptests(tests.Modeltests): ) def test_non_ascii_new_project(self): - """ Test the new_project endpoint with a non-ascii project. """ + """Test the new_project endpoint with a non-ascii project.""" # Before projects = pagure.lib.query.search_projects(self.session) self.assertEqual(len(projects), 0) @@ -659,7 +659,7 @@ class PagureFlaskApptests(tests.Modeltests): @patch("pagure.ui.app.admin_session_timedout") def test_user_settings(self, ast): - """ Test the user_settings endpoint. """ + """Test the user_settings endpoint.""" ast.return_value = False user = tests.FakeUser() @@ -685,7 +685,7 @@ class PagureFlaskApptests(tests.Modeltests): @patch("pagure.decorators.admin_session_timedout") def test_add_user_sshkey(self, ast): - """ Test the add_user_sshkey endpoint. """ + """Test the add_user_sshkey endpoint.""" ast.return_value = False # User not logged in @@ -786,7 +786,7 @@ class PagureFlaskApptests(tests.Modeltests): @patch("pagure.decorators.admin_session_timedout") def test_remove_user_sshkey(self, ast): - """ Test the remove_sshkey endpoint. """ + """Test the remove_sshkey endpoint.""" ast.return_value = False user = tests.FakeUser() @@ -865,7 +865,7 @@ class PagureFlaskApptests(tests.Modeltests): MagicMock(side_effect=patched_commit_exists), ) def test_patched_markdown_preview(self): - """ Test the markdown_preview endpoint. """ + """Test the markdown_preview endpoint.""" data = {"content": "test\n----\n\n * 1\n * item 2"} @@ -958,7 +958,7 @@ class PagureFlaskApptests(tests.Modeltests): self.assertEqual(exp, output.get_data(as_text=True)) def test_markdown_preview_valid_commit(self): - """ Test the markdown_preview endpoint with an existing commit. """ + """Test the markdown_preview endpoint with an existing commit.""" user = tests.FakeUser() user.username = "foo" @@ -996,7 +996,7 @@ class PagureFlaskApptests(tests.Modeltests): @patch("pagure.ui.app.admin_session_timedout") def test_remove_user_email(self, ast): - """ Test the remove_user_email endpoint. """ + """Test the remove_user_email endpoint.""" ast.return_value = False user = tests.FakeUser() @@ -1096,7 +1096,7 @@ class PagureFlaskApptests(tests.Modeltests): @patch("pagure.lib.notify.send_email") @patch("pagure.ui.app.admin_session_timedout") def test_add_api_user_email(self, ast, send_email): - """ Test the add_api_user_email endpoint. """ + """Test the add_api_user_email endpoint.""" send_email.return_value = True ast.return_value = False @@ -1231,7 +1231,7 @@ class PagureFlaskApptests(tests.Modeltests): @patch("pagure.lib.notify.send_email") @patch("pagure.ui.app.admin_session_timedout") def test_set_default_email(self, ast, send_email): - """ Test the set_default_email endpoint. """ + """Test the set_default_email endpoint.""" send_email.return_value = True ast.return_value = False @@ -1308,7 +1308,7 @@ class PagureFlaskApptests(tests.Modeltests): @patch("pagure.lib.notify.send_email") @patch("pagure.ui.app.admin_session_timedout") def test_reconfirm_email(self, ast, send_email): - """ Test the reconfirm_email endpoint. """ + """Test the reconfirm_email endpoint.""" send_email.return_value = True ast.return_value = False @@ -1391,7 +1391,7 @@ class PagureFlaskApptests(tests.Modeltests): @patch("pagure.ui.app.admin_session_timedout") def test_confirm_email(self, ast): - """ Test the confirm_email endpoint. """ + """Test the confirm_email endpoint.""" output = self.app.get("/settings/email/confirm/foobar") self.assertEqual(output.status_code, 302) @@ -1448,7 +1448,7 @@ class PagureFlaskApptests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_view_my_requests(self): - """Test the view_user_requests endpoint. """ + """Test the view_user_requests endpoint.""" # Create the PR tests.create_projects(self.session) repo = pagure.lib.query._get_project(self.session, "test") @@ -1733,7 +1733,7 @@ class PagureFlaskApptests(tests.Modeltests): @patch("pagure.ui.app.admin_session_timedout") def test_add_user_token(self, ast): - """ Test the add_user_token endpoint. """ + """Test the add_user_token endpoint.""" ast.return_value = False user = tests.FakeUser() @@ -1825,7 +1825,7 @@ class PagureFlaskApptests(tests.Modeltests): @patch("pagure.ui.app.admin_session_timedout") def test_revoke_api_user_token(self, ast): - """ Test the revoke_api_user_token endpoint. """ + """Test the revoke_api_user_token endpoint.""" ast.return_value = False user = tests.FakeUser() @@ -1950,10 +1950,10 @@ class PagureFlaskApptests(tests.Modeltests): class PagureFlaskAppAboutPagetests(tests.Modeltests): - """ Unit-tests for the about page. """ + """Unit-tests for the about page.""" def test_about_page(self): - """ Test the about page when an admin_email is set. """ + """Test the about page when an admin_email is set.""" output = self.app.get("/about/") self.assertEqual(output.status_code, 200) output_text = output.get_data(as_text=True) @@ -1970,7 +1970,7 @@ class PagureFlaskAppAboutPagetests(tests.Modeltests): @patch.dict("pagure.config.config", {"ADMIN_EMAIL": "admin@fp.o"}) def test_about_page_admin_email(self): - """ Test the about page when an admin_email is set. """ + """Test the about page when an admin_email is set.""" output = self.app.get("/about/") self.assertEqual(output.status_code, 200) output_text = output.get_data(as_text=True) @@ -1985,12 +1985,12 @@ class PagureFlaskAppAboutPagetests(tests.Modeltests): class PagureFlaskAppNoDocstests(tests.Modeltests): - """ Tests for flask app controller of pagure """ + """Tests for flask app controller of pagure""" config_values = {"enable_docs": False, "docs_folder": None} def test_new_project_no_docs_folder(self): - """ Test the new_project endpoint with DOCS_FOLDER is None. """ + """Test the new_project endpoint with DOCS_FOLDER is None.""" # Before projects = pagure.lib.query.search_projects(self.session) self.assertEqual(len(projects), 0) @@ -2059,12 +2059,12 @@ class PagureFlaskAppNoDocstests(tests.Modeltests): class PagureFlaskAppNoTicketstests(tests.Modeltests): - """ Tests for flask app controller of pagure """ + """Tests for flask app controller of pagure""" config_values = {"enable_tickets": False, "tickets_folder": None} def test_new_project_no_tickets_folder(self): - """ Test the new_project endpoint with TICKETS_FOLDER is None. """ + """Test the new_project endpoint with TICKETS_FOLDER is None.""" # Before projects = pagure.lib.query.search_projects(self.session) self.assertEqual(len(projects), 0) @@ -2135,7 +2135,7 @@ class PagureFlaskAppNoTicketstests(tests.Modeltests): class PagureFlaskAppRenewUserApiTokentests(tests.Modeltests): @patch("pagure.decorators.admin_session_timedout") def setUp(self, ast): - """ Constructor """ + """Constructor""" super(PagureFlaskAppRenewUserApiTokentests, self).setUp() self.ast = ast @@ -2171,14 +2171,14 @@ class PagureFlaskAppRenewUserApiTokentests(tests.Modeltests): self.token = userobj.tokens[0].id def test_renew_api_token_not_in(self): - """ Test the renew_api_token endpoint. """ + """Test the renew_api_token endpoint.""" # User not logged in output = self.app.post("/settings/token/renew/123") self.assertEqual(output.status_code, 302) @patch("pagure.ui.app.admin_session_timedout") def test_renew_api_token_session_old(self, ast): - """ Test the renew_api_token endpoint. """ + """Test the renew_api_token endpoint.""" ast.return_value = True user = tests.FakeUser(username="pingou") @@ -2194,7 +2194,7 @@ class PagureFlaskAppRenewUserApiTokentests(tests.Modeltests): self.assertIn("Action canceled, try it again", output_text) def test_renew_api_token_invalid_token(self): - """ Test the renew_api_token endpoint. """ + """Test the renew_api_token endpoint.""" user = tests.FakeUser(username="pingou") with tests.user_set(self.app.application, user): @@ -2207,7 +2207,7 @@ class PagureFlaskAppRenewUserApiTokentests(tests.Modeltests): self.assertIn("

Token not found

", output_text) def test_renew_api_token(self): - """ Test the renew_api_token endpoint. """ + """Test the renew_api_token endpoint.""" user = tests.FakeUser(username="pingou") with tests.user_set(self.app.application, user): @@ -2246,10 +2246,10 @@ class PagureFlaskAppRenewUserApiTokentests(tests.Modeltests): class PagureFlaskAppNewProjecttests(tests.Modeltests): - """ Tests creating new project via the flask app controller of pagure """ + """Tests creating new project via the flask app controller of pagure""" def setUp(self): - """ Setup the environment. """ + """Setup the environment.""" super(PagureFlaskAppNewProjecttests, self).setUp() # Before @@ -2671,7 +2671,7 @@ class PagureFlaskAppNewProjecttests(tests.Modeltests): pagure.config.config["ENABLE_NEW_PROJECTS"] = True def test_new_project_mirrored_invalid_url(self): - """ Test the new_project with a mirrored repo but an invalid URL. """ + """Test the new_project with a mirrored repo but an invalid URL.""" user = tests.FakeUser(username="foo") with tests.user_set(self.app.application, user): @@ -2719,7 +2719,7 @@ class PagureFlaskAppNewProjecttests(tests.Modeltests): self.assertIn("Invalid input. ", output_text) def test_new_project_mirrored_valid_url(self): - """ Test the new_project with a mirrored repo with a valid url. """ + """Test the new_project with a mirrored repo with a valid url.""" user = tests.FakeUser(username="foo") with tests.user_set(self.app.application, user): @@ -2790,7 +2790,7 @@ class PagureFlaskAppNewProjecttests(tests.Modeltests): ) def test_new_project(self): - """ Test the new_project endpoint. """ + """Test the new_project endpoint.""" user = tests.FakeUser() with tests.user_set(self.app.application, user): diff --git a/tests/test_pagure_flask_ui_app_browse.py b/tests/test_pagure_flask_ui_app_browse.py index a81af86..b2026e2 100644 --- a/tests/test_pagure_flask_ui_app_browse.py +++ b/tests/test_pagure_flask_ui_app_browse.py @@ -25,10 +25,10 @@ import tests class PagureFlaskAppBrowsetests(tests.Modeltests): - """ Tests for the browse pages of flask app controller of pagure """ + """Tests for the browse pages of flask app controller of pagure""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskAppBrowsetests, self).setUp() tests.create_projects(self.session) @@ -207,10 +207,10 @@ class PagureFlaskAppBrowsetests(tests.Modeltests): class PagureFlaskAppBrowseGroupAdmintests(tests.Modeltests): - """ Tests for the browse pages of flask app controller of pagure """ + """Tests for the browse pages of flask app controller of pagure""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskAppBrowseGroupAdmintests, self).setUp() tests.create_projects(self.session) @@ -311,10 +311,10 @@ class PagureFlaskAppBrowseGroupAdmintests(tests.Modeltests): class PagureFlaskAppBrowseGroupCommittests(tests.Modeltests): - """ Tests for the browse pages of flask app controller of pagure """ + """Tests for the browse pages of flask app controller of pagure""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskAppBrowseGroupCommittests, self).setUp() tests.create_projects(self.session) @@ -415,10 +415,10 @@ class PagureFlaskAppBrowseGroupCommittests(tests.Modeltests): class PagureFlaskAppBrowseGroupTickettests(tests.Modeltests): - """ Tests for the browse pages of flask app controller of pagure """ + """Tests for the browse pages of flask app controller of pagure""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskAppBrowseGroupTickettests, self).setUp() tests.create_projects(self.session) diff --git a/tests/test_pagure_flask_ui_app_give_project.py b/tests/test_pagure_flask_ui_app_give_project.py index 3c87dfd..4bbdb4c 100644 --- a/tests/test_pagure_flask_ui_app_give_project.py +++ b/tests/test_pagure_flask_ui_app_give_project.py @@ -28,10 +28,10 @@ import tests class PagureFlaskGiveRepotests(tests.SimplePagureTest): - """ Tests for give a project on pagure """ + """Tests for give a project on pagure""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskGiveRepotests, self).setUp() pagure.config.config["VIRUS_SCAN_ATTACHMENTS"] = False @@ -52,14 +52,14 @@ class PagureFlaskGiveRepotests(tests.SimplePagureTest): self.assertEqual(project.user.user, user) def test_give_project_no_project(self): - """ Test the give_project endpoint. """ + """Test the give_project endpoint.""" # No such project output = self.app.post("/test42/give") self.assertEqual(output.status_code, 404) def test_give_project_no_csrf(self): - """ Test the give_project endpoint. """ + """Test the give_project endpoint.""" user = tests.FakeUser() user.username = "pingou" @@ -82,7 +82,7 @@ class PagureFlaskGiveRepotests(tests.SimplePagureTest): self._check_user() def test_give_project_invalid_user(self): - """ Test the give_project endpoint. """ + """Test the give_project endpoint.""" user = tests.FakeUser() user.username = "pingou" @@ -106,7 +106,7 @@ class PagureFlaskGiveRepotests(tests.SimplePagureTest): self._check_user() def test_give_project_no_user(self): - """ Test the give_project endpoint. """ + """Test the give_project endpoint.""" user = tests.FakeUser() user.username = "pingou" @@ -129,7 +129,7 @@ class PagureFlaskGiveRepotests(tests.SimplePagureTest): self._check_user() def test_give_project_not_owner(self): - """ Test the give_project endpoint. """ + """Test the give_project endpoint.""" user = tests.FakeUser() user.username = "foo" @@ -154,7 +154,7 @@ class PagureFlaskGiveRepotests(tests.SimplePagureTest): self._check_user() def test_give_project_not_admin(self): - """ Test the give_project endpoint. """ + """Test the give_project endpoint.""" user = tests.FakeUser() user.username = "foo" @@ -179,7 +179,7 @@ class PagureFlaskGiveRepotests(tests.SimplePagureTest): self._check_user() def test_give_project_not_owner_but_is_admin(self): - """ Test the give_project endpoint. """ + """Test the give_project endpoint.""" project = pagure.lib.query.get_authorized_project( self.session, project_name="test" ) @@ -250,7 +250,7 @@ class PagureFlaskGiveRepotests(tests.SimplePagureTest): @patch.dict("pagure.config.config", {"PAGURE_ADMIN_USERS": "foo"}) @patch("pagure.lib.git.generate_gitolite_acls", MagicMock()) def test_give_project(self): - """ Test the give_project endpoint. """ + """Test the give_project endpoint.""" user = tests.FakeUser() user.username = "pingou" @@ -327,7 +327,7 @@ class PagureFlaskGiveRepotests(tests.SimplePagureTest): @patch.dict("pagure.config.config", {"PAGURE_ADMIN_USERS": "foo"}) @patch("pagure.lib.git.generate_gitolite_acls", MagicMock()) def test_give_project_not_in_required_group(self): - """ Test the give_project endpoint. """ + """Test the give_project endpoint.""" user = tests.FakeUser() user.username = "pingou" @@ -357,7 +357,7 @@ class PagureFlaskGiveRepotests(tests.SimplePagureTest): @patch.dict("pagure.config.config", {"PAGURE_ADMIN_USERS": "foo"}) @patch("pagure.lib.git.generate_gitolite_acls", MagicMock()) def test_give_project_in_required_group(self): - """ Test the give_project endpoint. """ + """Test the give_project endpoint.""" # Create the packager group msg = pagure.lib.query.add_group( diff --git a/tests/test_pagure_flask_ui_app_index.py b/tests/test_pagure_flask_ui_app_index.py index 706c682..7ba08d7 100644 --- a/tests/test_pagure_flask_ui_app_index.py +++ b/tests/test_pagure_flask_ui_app_index.py @@ -30,10 +30,10 @@ import tests class PagureFlaskAppIndextests(tests.Modeltests): - """ Tests for the index page of flask app controller of pagure """ + """Tests for the index page of flask app controller of pagure""" def test_index_logged_out(self): - """ Test the index endpoint when logged out. """ + """Test the index endpoint when logged out.""" output = self.app.get("/") self.assertEqual(output.status_code, 200) diff --git a/tests/test_pagure_flask_ui_app_userdash.py b/tests/test_pagure_flask_ui_app_userdash.py index 7604dc5..1bcd4bd 100644 --- a/tests/test_pagure_flask_ui_app_userdash.py +++ b/tests/test_pagure_flask_ui_app_userdash.py @@ -30,7 +30,7 @@ import tests class PagureFlaskAppUserdashTests(tests.Modeltests): - """ Tests for the index page of flask app controller of pagure """ + """Tests for the index page of flask app controller of pagure""" def test_index_commit_access_while_admin(self): """Test the index endpoint filter for commit access only when user @@ -344,7 +344,7 @@ class PagureFlaskAppUserdashTests(tests.Modeltests): @patch.dict("pagure.config.config", {"PRIVATE_PROJECTS": True}) def test_index_logged_in_private_project(self): - """ Test the index endpoint when logged in with a private project. """ + """Test the index endpoint when logged in with a private project.""" tests.create_projects(self.session) # Add a 3rd project with a long description diff --git a/tests/test_pagure_flask_ui_archives.py b/tests/test_pagure_flask_ui_archives.py index 8e82e56..aeac5f1 100644 --- a/tests/test_pagure_flask_ui_archives.py +++ b/tests/test_pagure_flask_ui_archives.py @@ -29,10 +29,10 @@ from tests.test_pagure_lib_git_get_tags_objects import add_repo_tag class PagureFlaskUiArchivesTest(tests.Modeltests): - """ Tests checking the archiving mechanism. """ + """Tests checking the archiving mechanism.""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskUiArchivesTest, self).setUp() tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -56,7 +56,7 @@ class PagureFlaskUiArchivesTest(tests.Modeltests): os.mkdir(self.archive_path) def test_project_no_conf(self): - """ Test getting the archive when pagure isn't configured. """ + """Test getting the archive when pagure isn't configured.""" output = self.app.get( "/somenamespace/test3/archive/tag1/test3-tag1.zip", follow_redirects=True, @@ -72,7 +72,7 @@ class PagureFlaskUiArchivesTest(tests.Modeltests): self.assertEqual(os.listdir(self.archive_path), []) def test_project_invalid_conf(self): - """ Test getting the archive when pagure is wrongly configured. """ + """Test getting the archive when pagure is wrongly configured.""" with mock.patch.dict( "pagure.config.config", {"ARCHIVE_FOLDER": os.path.join(self.path, "invalid")}, @@ -91,7 +91,7 @@ class PagureFlaskUiArchivesTest(tests.Modeltests): self.assertEqual(os.listdir(self.archive_path), []) def test_project_invalid_format(self): - """ Test getting the archive when the format provided is invalid. """ + """Test getting the archive when the format provided is invalid.""" with mock.patch.dict( "pagure.config.config", {"ARCHIVE_FOLDER": os.path.join(self.path, "archives")}, @@ -106,7 +106,7 @@ class PagureFlaskUiArchivesTest(tests.Modeltests): self.assertEqual(os.listdir(self.archive_path), []) def test_project_no_commit(self): - """ Test getting the archive of an empty project. """ + """Test getting the archive of an empty project.""" with mock.patch.dict( "pagure.config.config", {"ARCHIVE_FOLDER": os.path.join(self.path, "archives")}, @@ -142,7 +142,7 @@ class PagureFlaskUiArchivesTest(tests.Modeltests): self.assertEqual(os.listdir(self.archive_path), []) def test_project_no_tag(self): - """ Test getting the archive of an empty project. """ + """Test getting the archive of an empty project.""" with mock.patch.dict( "pagure.config.config", {"ARCHIVE_FOLDER": os.path.join(self.path, "archives")}, @@ -159,7 +159,7 @@ class PagureFlaskUiArchivesTest(tests.Modeltests): self.assertEqual(os.listdir(self.archive_path), []) def test_project_w_tag_zip(self): - """ Test getting the archive from a tag. """ + """Test getting the archive from a tag.""" with mock.patch.dict( "pagure.config.config", {"ARCHIVE_FOLDER": os.path.join(self.path, "archives")}, @@ -201,7 +201,7 @@ class PagureFlaskUiArchivesTest(tests.Modeltests): ) def test_project_w_tag_tar(self): - """ Test getting the archive from a tag. """ + """Test getting the archive from a tag.""" with mock.patch.dict( "pagure.config.config", {"ARCHIVE_FOLDER": os.path.join(self.path, "archives")}, @@ -243,7 +243,7 @@ class PagureFlaskUiArchivesTest(tests.Modeltests): ) def test_project_w_tag_tar_gz(self): - """ Test getting the archive from a tag. """ + """Test getting the archive from a tag.""" with mock.patch.dict( "pagure.config.config", {"ARCHIVE_FOLDER": os.path.join(self.path, "archives")}, @@ -285,7 +285,7 @@ class PagureFlaskUiArchivesTest(tests.Modeltests): ) def test_project_w_commit_tar_gz(self): - """ Test getting the archive from a commit. """ + """Test getting the archive from a commit.""" repopath = os.path.join(self.path, "repos", "test.git") repo = pygit2.Repository(repopath) commit = repo.head.target.hex diff --git a/tests/test_pagure_flask_ui_boards.py b/tests/test_pagure_flask_ui_boards.py index 5bbfdad..367e808 100644 --- a/tests/test_pagure_flask_ui_boards.py +++ b/tests/test_pagure_flask_ui_boards.py @@ -79,7 +79,7 @@ def set_up_board(self): class PagureFlaskUiBoardstests(tests.SimplePagureTest): - """ Tests for flask UI Boards controller of pagure """ + """Tests for flask UI Boards controller of pagure""" maxDiff = None @@ -188,7 +188,7 @@ class PagureFlaskUiBoardstests(tests.SimplePagureTest): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_update_issue_add_tags_check_board_not_tagged(self): - """ Test the update_issue endpoint. """ + """Test the update_issue endpoint.""" # Before update, list tags repo = pagure.lib.query.get_authorized_project(self.session, "test") @@ -244,7 +244,7 @@ class PagureFlaskUiBoardstests(tests.SimplePagureTest): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_update_issue_add_tags_check_board(self): - """ Test the update_issue endpoint. """ + """Test the update_issue endpoint.""" # Before update, list tags repo = pagure.lib.query.get_authorized_project(self.session, "test") @@ -300,7 +300,7 @@ class PagureFlaskUiBoardstests(tests.SimplePagureTest): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_update_issue_add_tags_check_board_remove_tag_check_board(self): - """ Test the update_issue endpoint. """ + """Test the update_issue endpoint.""" # Before update, list tags repo = pagure.lib.query.get_authorized_project(self.session, "test") diff --git a/tests/test_pagure_flask_ui_clone.py b/tests/test_pagure_flask_ui_clone.py index 79354fe..a16e48d 100644 --- a/tests/test_pagure_flask_ui_clone.py +++ b/tests/test_pagure_flask_ui_clone.py @@ -32,7 +32,7 @@ import tests class PagureFlaskAppClonetests(tests.Modeltests): - """ Tests for the clone bridging. """ + """Tests for the clone bridging.""" def setUp(self): super(PagureFlaskAppClonetests, self).setUp() @@ -48,7 +48,7 @@ class PagureFlaskAppClonetests(tests.Modeltests): @patch.dict("pagure.config.config", {"ALLOW_HTTP_PULL_PUSH": False}) def test_http_clone_disabled(self): - """ Test that the HTTP clone endpoint gets correctly closed. """ + """Test that the HTTP clone endpoint gets correctly closed.""" output = self.app.get( "/clonetest.git/info/refs?service=git-upload-pack" ) @@ -57,14 +57,14 @@ class PagureFlaskAppClonetests(tests.Modeltests): @patch.dict("pagure.config.config", {"ALLOW_HTTP_PULL_PUSH": True}) def test_http_clone_invalid_service(self): - """ Test that the HTTP endpoint refuses invalid services. """ + """Test that the HTTP endpoint refuses invalid services.""" output = self.app.get("/clonetest.git/info/refs?service=myservice") self.assertEqual(output.status_code, 400) self.assertIn("Unknown service", output.get_data(as_text=True)) @patch.dict("pagure.config.config", {"ALLOW_HTTP_PULL_PUSH": True}) def test_http_clone_invalid_project(self): - """ Test that the HTTP endpoint refuses invalid projects. """ + """Test that the HTTP endpoint refuses invalid projects.""" output = self.app.get( "/nosuchrepo.git/info/refs?service=git-upload-pack" ) @@ -73,7 +73,7 @@ class PagureFlaskAppClonetests(tests.Modeltests): @patch.dict("pagure.config.config", {"ALLOW_HTTP_PULL_PUSH": True}) def test_http_clone_dumb(self): - """ Test that the HTTP endpoint refuses dumb service request. """ + """Test that the HTTP endpoint refuses dumb service request.""" output = self.app.get("/clonetest.git/info/refs") self.assertEqual(output.status_code, 400) self.assertIn("Please switch", output.get_data(as_text=True)) @@ -87,7 +87,7 @@ class PagureFlaskAppClonetests(tests.Modeltests): }, ) def test_http_push_disabled(self): - """ Test that the HTTP push gets refused. """ + """Test that the HTTP push gets refused.""" output = self.app.get( "/clonetest.git/info/refs?service=git-receive-pack" ) @@ -106,7 +106,7 @@ class PagureFlaskAppClonetests(tests.Modeltests): }, ) def test_http_push_unauthed(self): - """ Test that the HTTP push gets refused unauthed. """ + """Test that the HTTP push gets refused unauthed.""" output = self.app.get( "/clonetest.git/info/refs?service=git-receive-pack" ) @@ -115,7 +115,7 @@ class PagureFlaskAppClonetests(tests.Modeltests): @patch.dict("pagure.config.config", {"ALLOW_HTTP_PULL_PUSH": True}) def test_http_clone_private_project_unauthed(self): - """ Test that the HTTP endpoint enforced project.private. """ + """Test that the HTTP endpoint enforced project.private.""" project = pagure.lib.query._get_project(self.session, "clonetest") project.private = True self.session.add(project) @@ -136,7 +136,7 @@ class PagureFlaskAppClonetests(tests.Modeltests): }, ) def test_http_clone(self): - """ Test that HTTP cloning gives reasonable output. """ + """Test that HTTP cloning gives reasonable output.""" # Unfortunately, actually testing a git clone would need the app to # run on a TCP port, which the test environment doesn't do. @@ -165,7 +165,7 @@ class PagureFlaskAppClonetests(tests.Modeltests): }, ) def test_http_clone_private(self): - """ Test that HTTP cloning gives reasonable output with project.private. """ + """Test that HTTP cloning gives reasonable output with project.private.""" # Unfortunately, actually testing a git clone would need the app to # run on a TCP port, which the test environment doesn't do. project = pagure.lib.query._get_project(self.session, "clonetest") @@ -197,7 +197,7 @@ class PagureFlaskAppClonetests(tests.Modeltests): }, ) def test_http_push(self): - """ Test that the HTTP push gets accepted. """ + """Test that the HTTP push gets accepted.""" output = self.app.get( "/clonetest.git/info/refs?service=git-receive-pack", environ_overrides={"REMOTE_USER": "pingou"}, @@ -216,7 +216,7 @@ class PagureFlaskAppClonetests(tests.Modeltests): }, ) def test_http_push_api_token(self): - """ Test that the HTTP push gets accepted. """ + """Test that the HTTP push gets accepted.""" headers = { "Authorization": b"Basic %s" @@ -240,7 +240,7 @@ class PagureFlaskAppClonetests(tests.Modeltests): }, ) def test_http_push_projectless_api_token(self): - """ Test that the HTTP push gets accepted. """ + """Test that the HTTP push gets accepted.""" tests.create_tokens(self.session, project_id=None, suffix="2") tests.create_tokens_acl( self.session, token_id="aaabbbcccddd2", acl_name="commit" @@ -268,7 +268,7 @@ class PagureFlaskAppClonetests(tests.Modeltests): }, ) def test_http_push__invalid_project_for_api_token(self): - """ Test that the HTTP push gets accepted. """ + """Test that the HTTP push gets accepted.""" headers = { "Authorization": b"Basic %s" @@ -290,7 +290,7 @@ class PagureFlaskAppClonetests(tests.Modeltests): }, ) def test_http_push_api_token_invalid_user(self): - """ Test that the HTTP push gets accepted. """ + """Test that the HTTP push gets accepted.""" headers = { "Authorization": b"Basic %s" @@ -312,7 +312,7 @@ class PagureFlaskAppClonetests(tests.Modeltests): }, ) def test_http_push_invalid_api_token(self): - """ Test that the HTTP push gets accepted. """ + """Test that the HTTP push gets accepted.""" headers = { "Authorization": b"Basic %s" @@ -334,7 +334,7 @@ class PagureFlaskAppClonetests(tests.Modeltests): }, ) def test_http_push_invalid_acl_on_token(self): - """ Test that the HTTP push gets accepted. """ + """Test that the HTTP push gets accepted.""" tests.create_tokens(self.session, suffix="2") tests.create_tokens_acl( self.session, token_id="aaabbbcccddd2", acl_name="commit_flag" @@ -361,7 +361,7 @@ class PagureFlaskAppClonetests(tests.Modeltests): }, ) def test_http_push_local_auth(self): - """ Test that the HTTP push gets accepted. """ + """Test that the HTTP push gets accepted.""" headers = { "Authorization": b"Basic %s" % base64.b64encode(b"pingou:foo") @@ -385,7 +385,7 @@ class PagureFlaskAppClonetests(tests.Modeltests): }, ) def test_http_push_local_auth_invalid_username(self): - """ Test that the HTTP push gets accepted. """ + """Test that the HTTP push gets accepted.""" headers = { "Authorization": b"Basic %s" % base64.b64encode(b"invalid:foo") diff --git a/tests/test_pagure_flask_ui_fork.py b/tests/test_pagure_flask_ui_fork.py index bf03850..a63f691 100644 --- a/tests/test_pagure_flask_ui_fork.py +++ b/tests/test_pagure_flask_ui_fork.py @@ -229,10 +229,10 @@ def set_up_git_repo( class PagureFlaskForktests(tests.Modeltests): - """ Tests for flask fork controller of pagure """ + """Tests for flask fork controller of pagure""" def test_request_pull_reference(self): - """ Test if there is a reference created for a new PR. """ + """Test if there is a reference created for a new PR.""" tests.create_projects(self.session) tests.create_projects_git( @@ -259,7 +259,7 @@ class PagureFlaskForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_request_pull(self, send_email): - """ Test the request_pull endpoint. """ + """Test the request_pull endpoint.""" send_email.return_value = True tests.create_projects(self.session) @@ -334,7 +334,7 @@ class PagureFlaskForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_request_pull_delete_branch_button_no_auth(self, send_email): - """ Test the request_pull endpoint. """ + """Test the request_pull endpoint.""" send_email.return_value = True tests.create_projects(self.session) @@ -371,7 +371,7 @@ class PagureFlaskForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_request_pull_delete_branch_button(self, send_email): - """ Test the request_pull endpoint. """ + """Test the request_pull endpoint.""" send_email.return_value = True tests.create_projects(self.session) @@ -412,7 +412,7 @@ class PagureFlaskForktests(tests.Modeltests): def test_request_pull_delete_branch_button_no_project_from( self, send_email ): - """ Test the request_pull endpoint. """ + """Test the request_pull endpoint.""" send_email.return_value = True tests.create_projects(self.session) @@ -456,7 +456,7 @@ class PagureFlaskForktests(tests.Modeltests): def test_request_pull_delete_branch_button_no_project_from_no_acl( self, send_email ): - """ Test the request_pull endpoint. """ + """Test the request_pull endpoint.""" send_email.return_value = True tests.create_projects(self.session) @@ -498,7 +498,7 @@ class PagureFlaskForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_task_update_request_pull(self, send_email): - """ Test the task update_pull_request endpoint. """ + """Test the task update_pull_request endpoint.""" send_email.return_value = True tests.create_projects(self.session) @@ -588,7 +588,7 @@ class PagureFlaskForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_request_pull_ci_dropdown(self, send_email): - """ Test presence of the "Rerun CI" dropdown with various settings. """ + """Test presence of the "Rerun CI" dropdown with various settings.""" send_email.return_value = True tests.create_projects(self.session) @@ -698,7 +698,7 @@ class PagureFlaskForktests(tests.Modeltests): {"TRIGGER_CI": {"CI1": {"name": "CI1", "description": "CI1!"}}}, ) def test_request_pull_ci_rerun(self, send_email): - """ Test rerunning CI using button from the "Rerun CI" dropdown. """ + """Test rerunning CI using button from the "Rerun CI" dropdown.""" send_email.return_value = True tests.create_projects(self.session) @@ -763,7 +763,7 @@ class PagureFlaskForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_merge_request_pull_FF(self, send_email): - """ Test the merge_request_pull endpoint with a FF PR. """ + """Test the merge_request_pull endpoint with a FF PR.""" send_email.return_value = True self.test_request_pull() @@ -964,7 +964,7 @@ class PagureFlaskForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_merge_request_pull_merge(self, send_email): - """ Test the merge_request_pull endpoint with a merge PR. """ + """Test the merge_request_pull endpoint with a merge PR.""" send_email.return_value = True tests.create_projects(self.session) @@ -1007,7 +1007,7 @@ class PagureFlaskForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_merge_request_pull_merge_with_comment(self, send_email): - """ Test the merge_request_pull endpoint with a merge PR. """ + """Test the merge_request_pull endpoint with a merge PR.""" send_email.return_value = True tests.create_projects(self.session) @@ -1067,7 +1067,7 @@ class PagureFlaskForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_merge_request_pull_merge_with_delete_branch(self, send_email): - """ Test the merge_request_pull endpoint with a merge PR and delete source branch. """ + """Test the merge_request_pull endpoint with a merge PR and delete source branch.""" send_email.return_value = True tests.create_projects(self.session) @@ -1110,7 +1110,7 @@ class PagureFlaskForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_merge_request_pull_conflicts(self, send_email): - """ Test the merge_request_pull endpoint with a conflicting PR. """ + """Test the merge_request_pull endpoint with a conflicting PR.""" send_email.return_value = True tests.create_projects(self.session) @@ -1154,7 +1154,7 @@ class PagureFlaskForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_merge_request_pull_conflicts_with_delete_branch(self, send_email): - """ Test the merge_request_pull endpoint with a conflicting PR and request deletion of branch. """ + """Test the merge_request_pull endpoint with a conflicting PR and request deletion of branch.""" send_email.return_value = True tests.create_projects(self.session) @@ -1201,7 +1201,7 @@ class PagureFlaskForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_merge_request_pull_nochange(self, send_email): - """ Test the merge_request_pull endpoint. """ + """Test the merge_request_pull endpoint.""" send_email.return_value = True tests.create_projects(self.session) @@ -1244,7 +1244,7 @@ class PagureFlaskForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_request_pull_close(self, send_email): - """ Test the request_pull endpoint with a closed PR. """ + """Test the request_pull endpoint with a closed PR.""" send_email.return_value = True self.test_merge_request_pull_FF() @@ -1259,7 +1259,7 @@ class PagureFlaskForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_request_pull_disabled(self, send_email): - """ Test the request_pull endpoint with PR disabled. """ + """Test the request_pull endpoint with PR disabled.""" send_email.return_value = True tests.create_projects(self.session) @@ -1284,7 +1284,7 @@ class PagureFlaskForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") @patch("pagure.lib.git.update_pull_ref") def test_request_pull_empty_repo(self, send_email, update_pull_ref): - """ Test the request_pull endpoint against an empty repo. """ + """Test the request_pull endpoint against an empty repo.""" # Mock update_pull_ref or the repo won't be empty anymore # (the PR will have been pushed to refs/pull) send_email.return_value = True @@ -1375,7 +1375,7 @@ class PagureFlaskForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_request_pull_empty_fork(self, send_email): - """ Test the request_pull endpoint from an empty fork. """ + """Test the request_pull endpoint from an empty fork.""" send_email.return_value = True tests.create_projects(self.session) @@ -1610,7 +1610,7 @@ class PagureFlaskForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_request_pulls(self, send_email): - """ Test the request_pulls endpoint. """ + """Test the request_pulls endpoint.""" send_email.return_value = True # No such project @@ -1876,7 +1876,7 @@ class PagureFlaskForktests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_request_pull_patch(self, send_email): - """ Test the request_pull_patch endpoint. """ + """Test the request_pull_patch endpoint.""" send_email.return_value = True output = self.app.get("/test/pull-request/1.patch") @@ -1956,7 +1956,7 @@ index 9f44358..2a552bb 100644 @patch("pagure.lib.notify.send_email") def test_request_pull_diff(self, send_email): - """ Test the request_pull_patch endpoint. """ + """Test the request_pull_patch endpoint.""" send_email.return_value = True output = self.app.get("/test/pull-request/1.diff") @@ -2017,7 +2017,7 @@ index 9f44358..2a552bb 100644 @patch("pagure.lib.notify.send_email") def test_request_pull_patch_close(self, send_email): - """ Test the request_pull_patch endpoint with a closed PR. """ + """Test the request_pull_patch endpoint with a closed PR.""" send_email.return_value = True self.test_merge_request_pull_FF() @@ -2063,7 +2063,7 @@ index 9f44358..2a552bb 100644 @patch("pagure.lib.notify.send_email") @patch("pagure.lib.git.update_pull_ref") def test_request_pull_patch_empty_repo(self, send_email, update_pull_ref): - """ Test the request_pull_patch endpoint against an empty repo. """ + """Test the request_pull_patch endpoint against an empty repo.""" # Mock update_pull_ref or the repo won't be empty anymore # (the PR will have been pushed to refs/pull) send_email.return_value = True @@ -2178,7 +2178,7 @@ index 0000000..2a552bb @patch("pagure.lib.notify.send_email") def test_request_pull_patch_empty_fork(self, send_email): - """ Test the request_pull_patch endpoint from an empty fork. """ + """Test the request_pull_patch endpoint from an empty fork.""" send_email.return_value = True tests.create_projects(self.session) @@ -2243,7 +2243,7 @@ index 0000000..2a552bb @patch("pagure.lib.notify.send_email") def test_close_request_pull(self, send_email): - """ Test the close_request_pull endpoint. """ + """Test the close_request_pull endpoint.""" send_email.return_value = True tests.create_projects(self.session) @@ -2342,7 +2342,7 @@ index 0000000..2a552bb ) @patch("pagure.lib.notify.send_email") def test_reopen_request_pull(self, send_email): - """ Test the reopen_request_pull endpoint. """ + """Test the reopen_request_pull endpoint.""" send_email.return_value = True tests.create_projects(self.session) @@ -4871,7 +4871,7 @@ index 0000000..2a552bb ) @patch("pagure.lib.notify.send_email") def test_fork_project(self, send_email): - """ Test the fork_project endpoint. """ + """Test the fork_project endpoint.""" send_email.return_value = True tests.create_projects(self.session) @@ -5052,7 +5052,7 @@ index 0000000..2a552bb @patch("pagure.lib.notify.send_email") def test_new_request_pull_branch_space(self, send_email): - """ Test the new_request_pull endpoint. """ + """Test the new_request_pull endpoint.""" send_email.return_value = True self.test_fork_project() @@ -5086,7 +5086,7 @@ index 0000000..2a552bb ) @patch("pagure.lib.notify.send_email") def test_new_request_pull(self, send_email): - """ Test the new_request_pull endpoint. """ + """Test the new_request_pull endpoint.""" send_email.return_value = True self.test_fork_project() @@ -5352,7 +5352,7 @@ More information @patch("pagure.lib.notify.send_email") def test_new_request_pull_filename_unicode(self, send_email): - """ Test the new_request_pull endpoint. """ + """Test the new_request_pull endpoint.""" send_email.return_value = True # Create the main project in the DB @@ -5552,7 +5552,7 @@ More information @patch("pagure.lib.notify.send_email") def test_new_request_pull_req_sign_off_view(self, send_email): - """ Test the new_request_pull endpoint. """ + """Test the new_request_pull endpoint.""" send_email.return_value = True self.test_fork_project() @@ -5610,7 +5610,7 @@ More information @patch("pagure.lib.notify.send_email") def test_new_request_pull_req_sign_off_submit(self, send_email): - """ Test the new_request_pull endpoint. """ + """Test the new_request_pull endpoint.""" send_email.return_value = True self.test_fork_project() @@ -5699,7 +5699,7 @@ More information @patch("pagure.lib.notify.send_email") def test_request_pull_commit_start_stop(self, send_email): - """ Test the the commit start and stop of brand new PR. """ + """Test the the commit start and stop of brand new PR.""" send_email.return_value = True self.test_fork_project() @@ -5766,7 +5766,7 @@ More information @patch("pagure.lib.notify.send_email") def test_new_request_pull_from_fork_branch(self, send_email): - """ Test creating a fork to fork PR. """ + """Test creating a fork to fork PR.""" send_email.return_value = True # Create main repo with some content @@ -5852,7 +5852,7 @@ More information @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_new_request_pull_from_fork_fixing_ticket(self): - """ Test creating a fork to fork PR fixing a ticket. """ + """Test creating a fork to fork PR fixing a ticket.""" # Create main repo with some content tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -5982,7 +5982,7 @@ More information @patch("pagure.lib.notify.send_email") def test_new_request_pull_fork_to_fork_pr_disabled(self, send_email): - """ Test creating a fork to fork PR. """ + """Test creating a fork to fork PR.""" send_email.return_value = True self.test_fork_project() @@ -6047,7 +6047,7 @@ More information @patch("pagure.lib.notify.send_email") def test_new_request_pull_fork_to_fork(self, send_email): - """ Test creating a fork to fork PR. """ + """Test creating a fork to fork PR.""" send_email.return_value = True self.test_fork_project() @@ -6162,7 +6162,7 @@ More information @patch("pagure.lib.notify.send_email") def test_new_request_pull_fork_to_other_fork(self, send_email): - """ Test creating a PR from fork to a fork of the same family. """ + """Test creating a PR from fork to a fork of the same family.""" send_email.return_value = True self.test_fork_project() @@ -6387,7 +6387,7 @@ More information @patch("pagure.lib.notify.send_email") def test_new_request_pull_empty_repo(self, send_email): - """ Test the new_request_pull endpoint against an empty repo. """ + """Test the new_request_pull endpoint against an empty repo.""" send_email.return_value = True self.test_fork_project() @@ -6442,7 +6442,7 @@ More information @patch("pagure.lib.notify.send_email") def test_new_request_pull_empty_fork(self, send_email): - """ Test the new_request_pull endpoint against an empty repo. """ + """Test the new_request_pull endpoint against an empty repo.""" send_email.return_value = True self.test_fork_project() @@ -6485,7 +6485,7 @@ More information ) @patch("pagure.lib.notify.send_email") def test_pull_request_add_comment(self, send_email): - """ Test the pull_request_add_comment endpoint. """ + """Test the pull_request_add_comment endpoint.""" send_email.return_value = True self.test_request_pull() @@ -6687,7 +6687,7 @@ More information @patch("pagure.lib.notify.send_email") def test_pull_request_drop_comment(self, send_email): - """ Test the pull_request_drop_comment endpoint. """ + """Test the pull_request_drop_comment endpoint.""" send_email.return_value = True self.test_pull_request_add_comment() @@ -6789,7 +6789,7 @@ More information ) @patch("pagure.lib.notify.send_email") def test_pull_request_edit_comment(self, send_email): - """ Test the pull request edit comment endpoint """ + """Test the pull request edit comment endpoint""" send_email.return_value = True self.test_request_pull() @@ -7304,7 +7304,7 @@ More information @patch("pagure.lib.notify.send_email") def test_fork_edit_file(self, send_email): - """ Test the fork_edit file endpoint. """ + """Test the fork_edit file endpoint.""" send_email.return_value = True @@ -7474,7 +7474,7 @@ More information @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_fork_edit_file_namespace(self): - """ Test the fork_edit file endpoint on a namespaced project. """ + """Test the fork_edit file endpoint on a namespaced project.""" tests.create_projects(self.session) for folder in ["docs", "tickets", "requests", "repos"]: @@ -7631,7 +7631,7 @@ More information @patch("pagure.lib.notify.send_email") def test_fork_without_main_repo(self, send_email): - """ Test the fork without the main repo. """ + """Test the fork without the main repo.""" send_email.return_value = True tests.create_projects(self.session) @@ -7736,7 +7736,7 @@ More information @patch("pagure.lib.notify.send_email") def test_add_reaction(self, send_email): - """ Test the request_pull endpoint. """ + """Test the request_pull endpoint.""" send_email.return_value = True self._set_up_for_reaction_test() @@ -7768,7 +7768,7 @@ More information @patch("pagure.lib.notify.send_email") def test_add_reaction_unauthenticated(self, send_email): - """ Test the request_pull endpoint. """ + """Test the request_pull endpoint.""" send_email.return_value = True self._set_up_for_reaction_test() @@ -7796,7 +7796,7 @@ class TestTicketAccessEditPRMetadata(tests.Modeltests): meta-data of a PR""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(TestTicketAccessEditPRMetadata, self).setUp() tests.create_projects(self.session) tests.create_projects_git( @@ -7869,7 +7869,7 @@ class TestTicketAccessEditPRMetadata(tests.Modeltests): ) def test_admin_can_edit_metadata_ui(self): - """ Test that admin users can edit the metadata in the UI. """ + """Test that admin users can edit the metadata in the UI.""" user = tests.FakeUser(username="pingou") with tests.user_set(self.app.application, user): diff --git a/tests/test_pagure_flask_ui_groups.py b/tests/test_pagure_flask_ui_groups.py index cf4deb8..3531a40 100644 --- a/tests/test_pagure_flask_ui_groups.py +++ b/tests/test_pagure_flask_ui_groups.py @@ -29,10 +29,10 @@ import tests class PagureFlaskGroupstests(tests.Modeltests): - """ Tests for flask groups controller of pagure """ + """Tests for flask groups controller of pagure""" def test_group_lists(self): - """ Test the group_lists endpoint. """ + """Test the group_lists endpoint.""" output = self.app.get("/groups") self.assertIn( '

\n' @@ -41,7 +41,7 @@ class PagureFlaskGroupstests(tests.Modeltests): ) def test_add_group(self): - """ Test the add_group endpoint. """ + """Test the add_group endpoint.""" output = self.app.get("/group/add") self.assertEqual(output.status_code, 302) @@ -167,7 +167,7 @@ class PagureFlaskGroupstests(tests.Modeltests): "pagure.config.config", {"FEDORA_MESSAGING_NOTIFICATIONS": True} ) def test_edit_group(self): - """ Test the edit_group endpoint. """ + """Test the edit_group endpoint.""" output = self.app.get("/group/test_group/edit") self.assertEqual(output.status_code, 302) @@ -311,7 +311,7 @@ class PagureFlaskGroupstests(tests.Modeltests): ) def test_give_group(self): - """ Test the give_group endpoint. """ + """Test the give_group endpoint.""" output = self.app.post("/group/test_group/give") self.assertEqual(output.status_code, 302) @@ -393,7 +393,7 @@ class PagureFlaskGroupstests(tests.Modeltests): ) def test_group_delete(self): - """ Test the group_delete endpoint. """ + """Test the group_delete endpoint.""" output = self.app.post("/group/foo/delete") self.assertEqual(output.status_code, 302) @@ -487,7 +487,7 @@ class PagureFlaskGroupstests(tests.Modeltests): ) def test_view_group(self): - """ Test the view_group endpoint. """ + """Test the view_group endpoint.""" output = self.app.get("/group/foo") self.assertEqual(output.status_code, 404) @@ -571,7 +571,7 @@ class PagureFlaskGroupstests(tests.Modeltests): ) def test_group_user_delete(self): - """ Test the group_user_delete endpoint. """ + """Test the group_user_delete endpoint.""" output = self.app.post("/group/foo/bar/delete") self.assertEqual(output.status_code, 302) diff --git a/tests/test_pagure_flask_ui_issue_pr_link.py b/tests/test_pagure_flask_ui_issue_pr_link.py index 9016681..5379771 100644 --- a/tests/test_pagure_flask_ui_issue_pr_link.py +++ b/tests/test_pagure_flask_ui_issue_pr_link.py @@ -34,12 +34,12 @@ from pagure.lib.repo import PagureRepo class PagureFlaskPrIssueLinkTest(tests.Modeltests): - """ Tests pagure when linking PRs to tickets """ + """Tests pagure when linking PRs to tickets""" maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskPrIssueLinkTest, self).setUp() tests.create_projects(self.session) diff --git a/tests/test_pagure_flask_ui_issues.py b/tests/test_pagure_flask_ui_issues.py index 1c0df62..0af9975 100644 --- a/tests/test_pagure_flask_ui_issues.py +++ b/tests/test_pagure_flask_ui_issues.py @@ -42,7 +42,7 @@ import tests class PagureFlaskIssuestests(tests.Modeltests): - """ Tests for flask issues controller of pagure """ + """Tests for flask issues controller of pagure""" @patch.dict( "pagure.config.config", {"ENABLE_TICKETS_NAMESPACE": ["foobar"]} @@ -50,7 +50,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_new_issue_wrong_namespace(self): - """ Test the new_issue endpoint. """ + """Test the new_issue endpoint.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -101,7 +101,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_new_issue(self, p_send_email, p_ugt): - """ Test the new_issue endpoint. """ + """Test the new_issue endpoint.""" p_send_email.return_value = True p_ugt.return_value = True @@ -204,7 +204,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_new_issue_customized(self): - """ Test the new_issue endpoint. """ + """Test the new_issue endpoint.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) tests.create_projects_git( @@ -233,7 +233,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_new_issue_w_file(self, p_send_email, p_ugt): - """ Test the new_issue endpoint with a file. """ + """Test the new_issue endpoint with a file.""" p_send_email.return_value = True p_ugt.return_value = True @@ -292,7 +292,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_new_issue_w_file_no_issue_tracker(self, p_send_email, p_ugt): - """ Test the new_issue endpoint with a file. """ + """Test the new_issue endpoint with a file.""" p_send_email.return_value = True p_ugt.return_value = True @@ -329,7 +329,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_new_issue_w_file_namespace(self, p_send_email, p_ugt): - """ Test the new_issue endpoint with a file. """ + """Test the new_issue endpoint with a file.""" p_send_email.return_value = True p_ugt.return_value = True @@ -391,7 +391,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_new_issue_w_files(self, p_send_email, p_ugt): - """ Test the new_issue endpoint with two files. """ + """Test the new_issue endpoint with two files.""" p_send_email.return_value = True p_ugt.return_value = True @@ -470,7 +470,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_new_issue_w_files_namespace(self, p_send_email, p_ugt): - """ Test the new_issue endpoint with two files. """ + """Test the new_issue endpoint with two files.""" p_send_email.return_value = True p_ugt.return_value = True @@ -737,7 +737,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_view_issues_wrong_namespace(self): - """ Test the view_issues endpoint. """ + """Test the view_issues endpoint.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -766,7 +766,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_view_issues(self, p_send_email, p_ugt): - """ Test the view_issues endpoint. """ + """Test the view_issues endpoint.""" p_send_email.return_value = True p_ugt.return_value = True @@ -1222,7 +1222,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_search_issues_unicode(self, p_send_email, p_ugt): - """ Test the view_issues endpoint filtering for an unicode char. """ + """Test the view_issues endpoint filtering for an unicode char.""" p_send_email.return_value = True p_ugt.return_value = True @@ -1323,7 +1323,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_view_issue(self, p_send_email, p_ugt): - """ Test the view_issue endpoint. """ + """Test the view_issue endpoint.""" p_send_email.return_value = True p_ugt.return_value = True @@ -1462,7 +1462,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_view_issue_author(self): - """ Test the view_issue endpoint when you're the author. """ + """Test the view_issue endpoint when you're the author.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -1541,7 +1541,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_view_issue_user_ticket(self, p_send_email, p_ugt): - """ Test the view_issue endpoint. """ + """Test the view_issue endpoint.""" p_send_email.return_value = True p_ugt.return_value = True @@ -1618,7 +1618,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_view_issue_custom_field_user_ticket(self, p_send_email, p_ugt): - """ Test the view_issue endpoint. """ + """Test the view_issue endpoint.""" p_send_email.return_value = True p_ugt.return_value = True @@ -1747,7 +1747,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_view_issue_non_ascii_milestone(self, p_send_email, p_ugt): - """ Test the view_issue endpoint with non-ascii milestone. """ + """Test the view_issue endpoint with non-ascii milestone.""" p_send_email.return_value = True p_ugt.return_value = True @@ -1866,7 +1866,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_update_issue_wrong_namespace(self): - """ Test the update_issue endpoint. """ + """Test the update_issue endpoint.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -1942,7 +1942,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_update_issue_add_tags(self, p_send_email, p_ugt): - """ Test the update_issue endpoint. """ + """Test the update_issue endpoint.""" p_send_email.return_value = True p_ugt.return_value = True @@ -2231,7 +2231,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_update_issue(self, p_send_email, p_ugt): - """ Test the update_issue endpoint. """ + """Test the update_issue endpoint.""" p_send_email.return_value = True p_ugt.return_value = True @@ -2567,7 +2567,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_update_issue_drop_comment(self, p_send_email, p_ugt): - """ Test droping comment via the update_issue endpoint. """ + """Test droping comment via the update_issue endpoint.""" p_send_email.return_value = True p_ugt.return_value = True @@ -2778,7 +2778,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_update_issue_depend(self, p_send_email, p_ugt): - """ Test adding dependency via the update_issue endpoint. """ + """Test adding dependency via the update_issue endpoint.""" p_send_email.return_value = True p_ugt.return_value = True @@ -3068,7 +3068,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_update_issue_block(self, p_send_email, p_ugt): - """ Test adding blocked issue via the update_issue endpoint. """ + """Test adding blocked issue via the update_issue endpoint.""" p_send_email.return_value = True p_ugt.return_value = True @@ -3468,7 +3468,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_upload_issue(self, p_send_email, p_ugt): - """ Test the upload_issue endpoint. """ + """Test the upload_issue endpoint.""" p_send_email.return_value = True p_ugt.return_value = True @@ -3565,7 +3565,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_upload_issue_virus(self, p_send_email, p_ugt): - """ Test the upload_issue endpoint. """ + """Test the upload_issue endpoint.""" if not pyclamd: raise SkipTest() p_send_email.return_value = True @@ -3619,7 +3619,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_upload_issue_two_files(self, p_send_email, p_ugt): - """ Test the upload_issue endpoint with two files. """ + """Test the upload_issue endpoint with two files.""" p_send_email.return_value = True p_ugt.return_value = True @@ -3685,7 +3685,7 @@ class PagureFlaskIssuestests(tests.Modeltests): self.assertDictEqual(json_data, exp) def test_view_issue_raw_file_empty(self): - """ Test the view_issue_raw_file endpoint. """ + """Test the view_issue_raw_file endpoint.""" # Create the project and git repos tests.create_projects(self.session) tests.create_projects_git( @@ -3727,7 +3727,7 @@ class PagureFlaskIssuestests(tests.Modeltests): self.assertEqual(output.status_code, 404) def test_view_issue_raw_file(self): - """ Test the view_issue_raw_file endpoint. """ + """Test the view_issue_raw_file endpoint.""" # Create the issue and upload to it self.test_upload_issue() @@ -3769,7 +3769,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_edit_issue(self, p_send_email, p_ugt): - """ Test the edit_issue endpoint. """ + """Test the edit_issue endpoint.""" p_send_email.return_value = True p_ugt.return_value = True @@ -3955,7 +3955,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_edit_issue_no_change(self): - """ Test the edit_issue endpoint. """ + """Test the edit_issue endpoint.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -4012,7 +4012,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_edit_tag_issue_disabled(self): - """ Test the edit_tag endpoint when issues are disabled. """ + """Test the edit_tag endpoint when issues are disabled.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos")) @@ -4083,7 +4083,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_edit_tag(self, p_send_email, p_ugt): - """ Test the edit_tag endpoint. """ + """Test the edit_tag endpoint.""" p_send_email.return_value = True p_ugt.return_value = True @@ -4252,7 +4252,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_remove_tag_issue_disabled(self): - """ Test the remove_tag endpoint. """ + """Test the remove_tag endpoint.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos")) @@ -4355,7 +4355,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_remove_tag(self, p_send_email, p_ugt): - """ Test the remove_tag endpoint. """ + """Test the remove_tag endpoint.""" p_send_email.return_value = True p_ugt.return_value = True @@ -4453,7 +4453,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_delete_issue(self, p_send_email, p_ugt): - """ Test the delete_issue endpoint. """ + """Test the delete_issue endpoint.""" p_send_email.return_value = True p_ugt.return_value = True @@ -4609,7 +4609,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_update_issue_edit_comment(self, p_send_email, p_ugt): - """ Test the issues edit comment endpoint """ + """Test the issues edit comment endpoint""" p_send_email.return_value = True p_ugt.return_value = True @@ -4905,7 +4905,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_update_tags_issue_disabled(self): - """ Test the update_tags endpoint. """ + """Test the update_tags endpoint.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos")) @@ -4974,7 +4974,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_update_tags(self, p_send_email, p_ugt): - """ Test the update_tags endpoint. """ + """Test the update_tags endpoint.""" p_send_email.return_value = True p_ugt.return_value = True @@ -5324,7 +5324,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_update_tags_with_colon(self, p_send_email, p_ugt): - """ Test the update_tags endpoint with a tag containing a colon. """ + """Test the update_tags endpoint with a tag containing a colon.""" p_send_email.return_value = True p_ugt.return_value = True @@ -5392,7 +5392,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_update_tags_with_coma(self, p_send_email, p_ugt): - """ Test the update_tags endpoint with a tag containing a coma. """ + """Test the update_tags endpoint with a tag containing a coma.""" p_send_email.return_value = True p_ugt.return_value = True @@ -5648,7 +5648,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_view_issue_closed(self, p_send_email, p_ugt): - """ Test viewing a closed issue. """ + """Test viewing a closed issue.""" p_send_email.return_value = True p_ugt.return_value = True @@ -5758,7 +5758,7 @@ class PagureFlaskIssuestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_add_reaction(self, p_send_email, p_ugt): - """ Test adding a reaction to an issue comment.""" + """Test adding a reaction to an issue comment.""" p_send_email.return_value = True p_ugt.return_value = True diff --git a/tests/test_pagure_flask_ui_issues_acl_checks.py b/tests/test_pagure_flask_ui_issues_acl_checks.py index f8bc550..4f890ab 100644 --- a/tests/test_pagure_flask_ui_issues_acl_checks.py +++ b/tests/test_pagure_flask_ui_issues_acl_checks.py @@ -37,12 +37,12 @@ import tests class PagureFlaskIssuesACLtests(tests.Modeltests): - """ Tests for flask issues controller of pagure for acls """ + """Tests for flask issues controller of pagure for acls""" @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_view_issue_no_access(self, p_send_email, p_ugt): - """ Test the view_issue endpoint. when a user has no access on repo """ + """Test the view_issue endpoint. when a user has no access on repo""" p_send_email.return_value = True p_ugt.return_value = True @@ -295,7 +295,7 @@ class PagureFlaskIssuesACLtests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_view_issue_ticket_access(self, p_send_email, p_ugt): - """ Test the view_issue endpoint. when a user has ticket access on repo """ + """Test the view_issue endpoint. when a user has ticket access on repo""" p_send_email.return_value = True p_ugt.return_value = True @@ -550,7 +550,7 @@ class PagureFlaskIssuesACLtests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_view_issue_commit_access(self, p_send_email, p_ugt): - """ Test the view_issue endpoint. when a user has commit access on repo """ + """Test the view_issue endpoint. when a user has commit access on repo""" p_send_email.return_value = True p_ugt.return_value = True @@ -804,7 +804,7 @@ class PagureFlaskIssuesACLtests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_view_issue_admin_access(self, p_send_email, p_ugt): - """ Test the view_issue endpoint. when a user has admin access on repo """ + """Test the view_issue endpoint. when a user has admin access on repo""" p_send_email.return_value = True p_ugt.return_value = True diff --git a/tests/test_pagure_flask_ui_issues_open_access.py b/tests/test_pagure_flask_ui_issues_open_access.py index 901b621..4fa6ff7 100644 --- a/tests/test_pagure_flask_ui_issues_open_access.py +++ b/tests/test_pagure_flask_ui_issues_open_access.py @@ -41,10 +41,10 @@ import tests class PagureFlaskIssuesOpenAccesstests(tests.Modeltests): - """ Tests for flask issues controller of pagure """ + """Tests for flask issues controller of pagure""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskIssuesOpenAccesstests, self).setUp() tests.create_projects(self.session) @@ -187,7 +187,7 @@ class PagureFlaskIssuesOpenAccesstests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_view_issue(self): - """ Test the view_issue endpoint. """ + """Test the view_issue endpoint.""" output = self.app.get("/test/issue/1") self.assertEqual(output.status_code, 404) @@ -286,7 +286,7 @@ class PagureFlaskIssuesOpenAccesstests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_view_issue_user_ticket(self): - """ Test the view_issue endpoint. """ + """Test the view_issue endpoint.""" output = self.app.get("/test/issue/1") self.assertEqual(output.status_code, 404) @@ -355,7 +355,7 @@ class PagureFlaskIssuesOpenAccesstests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_view_issue_custom_field_user_ticket(self): - """ Test the view_issue endpoint. """ + """Test the view_issue endpoint.""" output = self.app.get("/test/issue/1") self.assertEqual(output.status_code, 404) @@ -475,7 +475,7 @@ class PagureFlaskIssuesOpenAccesstests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_view_issue_non_ascii_milestone(self): - """ Test the view_issue endpoint with non-ascii milestone. """ + """Test the view_issue endpoint with non-ascii milestone.""" output = self.app.get("/test/issue/1") self.assertEqual(output.status_code, 404) @@ -561,7 +561,7 @@ class PagureFlaskIssuesOpenAccesstests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_update_issue(self): - """ Test the update_issue endpoint. """ + """Test the update_issue endpoint.""" output = self.app.get("/test/issue/1/update") self.assertEqual(output.status_code, 302) @@ -873,7 +873,7 @@ class PagureFlaskIssuesOpenAccesstests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_update_issue_depend(self): - """ Test adding dependency via the update_issue endpoint. """ + """Test adding dependency via the update_issue endpoint.""" # Create issues to play with repo = pagure.lib.query.get_authorized_project(self.session, "test") msg = pagure.lib.query.new_issue( @@ -957,7 +957,7 @@ class PagureFlaskIssuesOpenAccesstests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_update_issue_block(self): - """ Test adding blocked issue via the update_issue endpoint. """ + """Test adding blocked issue via the update_issue endpoint.""" # Create issues to play with repo = pagure.lib.query.get_authorized_project(self.session, "test") msg = pagure.lib.query.new_issue( @@ -1040,7 +1040,7 @@ class PagureFlaskIssuesOpenAccesstests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_update_issue_edit_comment(self): - """ Test the issues edit comment endpoint """ + """Test the issues edit comment endpoint""" # Create issues to play with repo = pagure.lib.query.get_authorized_project(self.session, "test") msg = pagure.lib.query.new_issue( @@ -1276,7 +1276,7 @@ class PagureFlaskIssuesOpenAccesstests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_view_issue_closed(self): - """ Test viewing a closed issue. """ + """Test viewing a closed issue.""" # Create issues to play with repo = pagure.lib.query.get_authorized_project(self.session, "test") msg = pagure.lib.query.new_issue( diff --git a/tests/test_pagure_flask_ui_issues_private.py b/tests/test_pagure_flask_ui_issues_private.py index e548684..a8660b1 100644 --- a/tests/test_pagure_flask_ui_issues_private.py +++ b/tests/test_pagure_flask_ui_issues_private.py @@ -29,7 +29,7 @@ class PagureFlaskIssuesPrivatetests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskIssuesPrivatetests, self).setUp() # Create a 3rd user @@ -73,7 +73,7 @@ class PagureFlaskIssuesPrivatetests(tests.Modeltests): self.assertEqual(msg.title, "Test issue #2") def test_issue_list_anonymous(self): - """ Test the list of issues when user is logged out. """ + """Test the list of issues when user is logged out.""" output = self.app.get("/test/issues") self.assertEqual(output.status_code, 200) @@ -203,7 +203,7 @@ class PagureFlaskIssuesPrivatetests(tests.Modeltests): ) def test_view_issue_anonymous(self): - """ Test accessing a private ticket when user is logged out. """ + """Test accessing a private ticket when user is logged out.""" output = self.app.get("/test/issue/1") self.assertEqual(output.status_code, 404) diff --git a/tests/test_pagure_flask_ui_issues_read_only.py b/tests/test_pagure_flask_ui_issues_read_only.py index a299d1d..b0ad8f3 100644 --- a/tests/test_pagure_flask_ui_issues_read_only.py +++ b/tests/test_pagure_flask_ui_issues_read_only.py @@ -30,7 +30,7 @@ class PagureFlaskIssuesReadOnlytests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskIssuesReadOnlytests, self).setUp() tests.create_projects(self.session) @@ -206,7 +206,7 @@ class PagureFlaskAPIIssuesReadOnlytests(PagureFlaskIssuesReadOnlytests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskAPIIssuesReadOnlytests, self).setUp() def test_api_new_issue(self): @@ -225,7 +225,7 @@ class PagureFlaskAPIIssuesReadOnlytests(PagureFlaskIssuesReadOnlytests): ) def test_api_change_status_issue(self): - """ Test closing a ticket. """ + """Test closing a ticket.""" user = tests.FakeUser(username="pingou") with tests.user_set(self.app.application, user): output = self.app.post("/api/0/test/issue/1/status", data={}) @@ -240,7 +240,7 @@ class PagureFlaskAPIIssuesReadOnlytests(PagureFlaskIssuesReadOnlytests): ) def test_api_change_milestone_issue(self): - """ Test change the milestone of a ticket. """ + """Test change the milestone of a ticket.""" user = tests.FakeUser(username="pingou") with tests.user_set(self.app.application, user): output = self.app.post("/api/0/test/issue/1/milestone", data={}) @@ -255,7 +255,7 @@ class PagureFlaskAPIIssuesReadOnlytests(PagureFlaskIssuesReadOnlytests): ) def test_api_comment_issue(self): - """ Test comment on a ticket. """ + """Test comment on a ticket.""" user = tests.FakeUser(username="pingou") with tests.user_set(self.app.application, user): output = self.app.post("/api/0/test/issue/1/comment", data={}) @@ -270,7 +270,7 @@ class PagureFlaskAPIIssuesReadOnlytests(PagureFlaskIssuesReadOnlytests): ) def test_api_assign_issue(self): - """ Test assigning a ticket. """ + """Test assigning a ticket.""" user = tests.FakeUser(username="pingou") with tests.user_set(self.app.application, user): output = self.app.post("/api/0/test/issue/1/assign", data={}) @@ -285,7 +285,7 @@ class PagureFlaskAPIIssuesReadOnlytests(PagureFlaskIssuesReadOnlytests): ) def test_api_subscribe_issue(self): - """ Test subscribing to a ticket. """ + """Test subscribing to a ticket.""" user = tests.FakeUser(username="pingou") with tests.user_set(self.app.application, user): output = self.app.post("/api/0/test/issue/1/subscribe", data={}) @@ -300,7 +300,7 @@ class PagureFlaskAPIIssuesReadOnlytests(PagureFlaskIssuesReadOnlytests): ) def test_api_update_custom_field(self): - """ Test updating a specific custom fields on a ticket. """ + """Test updating a specific custom fields on a ticket.""" user = tests.FakeUser(username="pingou") with tests.user_set(self.app.application, user): output = self.app.post("/api/0/test/issue/1/custom/foo", data={}) @@ -315,7 +315,7 @@ class PagureFlaskAPIIssuesReadOnlytests(PagureFlaskIssuesReadOnlytests): ) def test_api_update_custom_fields(self): - """ Test updating custom fields on a ticket. """ + """Test updating custom fields on a ticket.""" user = tests.FakeUser(username="pingou") with tests.user_set(self.app.application, user): output = self.app.post("/api/0/test/issue/1/custom", data={}) @@ -337,7 +337,7 @@ class PagureFlaskIssuesAndPRDisabledtests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskIssuesAndPRDisabledtests, self).setUp() tests.create_projects(self.session) diff --git a/tests/test_pagure_flask_ui_issues_templates.py b/tests/test_pagure_flask_ui_issues_templates.py index 37696f9..ff8849c 100644 --- a/tests/test_pagure_flask_ui_issues_templates.py +++ b/tests/test_pagure_flask_ui_issues_templates.py @@ -99,12 +99,12 @@ def create_templates(repopath): class PagureFlaskIssuesTemplatetests(tests.Modeltests): - """ Tests for flask issues controller of pagure """ + """Tests for flask issues controller of pagure""" @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, run before every tests. """ + """Set up the environnment, run before every tests.""" super(PagureFlaskIssuesTemplatetests, self).setUp() pagure.config.config["TICKETS_FOLDER"] = os.path.join( @@ -140,7 +140,7 @@ class PagureFlaskIssuesTemplatetests(tests.Modeltests): self.assertNotIn("Issue Templates", output_text) def test_new_issue_w_template(self): - """ Test the new_issue endpoint when the project has templates. """ + """Test the new_issue endpoint when the project has templates.""" user = tests.FakeUser() with tests.user_set(self.app.application, user): @@ -171,7 +171,7 @@ class PagureFlaskIssuesTemplatetests(tests.Modeltests): ) def test_new_issue_w_specific_template(self): - """ Test the new_issue endpoint when the project has templates. """ + """Test the new_issue endpoint when the project has templates.""" user = tests.FakeUser() with tests.user_set(self.app.application, user): diff --git a/tests/test_pagure_flask_ui_login.py b/tests/test_pagure_flask_ui_login.py index be319c8..db2e900 100644 --- a/tests/test_pagure_flask_ui_login.py +++ b/tests/test_pagure_flask_ui_login.py @@ -37,10 +37,10 @@ import pagure.ui.login class PagureFlaskLogintests(tests.SimplePagureTest): - """ Tests for flask app controller of pagure """ + """Tests for flask app controller of pagure""" def setUp(self): - """ Create the application with PAGURE_AUTH being local. """ + """Create the application with PAGURE_AUTH being local.""" super(PagureFlaskLogintests, self).setUp() app = pagure.flask_app.create_app( @@ -53,7 +53,7 @@ class PagureFlaskLogintests(tests.SimplePagureTest): @patch.dict("pagure.config.config", {"PAGURE_AUTH": "local"}) def test_front_page(self): - """ Test the front page. """ + """Test the front page.""" # First access the front page output = self.app.get("/") self.assertEqual(output.status_code, 200) @@ -64,7 +64,7 @@ class PagureFlaskLogintests(tests.SimplePagureTest): @patch.dict("pagure.config.config", {"PAGURE_AUTH": "local"}) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_new_user(self): - """ Test the new_user endpoint. """ + """Test the new_user endpoint.""" # Check before: items = pagure.lib.query.search_user(self.session) @@ -153,7 +153,7 @@ class PagureFlaskLogintests(tests.SimplePagureTest): @patch.dict("pagure.config.config", {"ALLOW_USER_REGISTRATION": False}) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_new_user_disabled(self): - """ Test the disabling of the new_user endpoint. """ + """Test the disabling of the new_user endpoint.""" # Check before: items = pagure.lib.query.search_user(self.session) @@ -176,7 +176,7 @@ class PagureFlaskLogintests(tests.SimplePagureTest): @patch.dict("pagure.config.config", {"PAGURE_AUTH": "local"}) @patch.dict("pagure.config.config", {"CHECK_SESSION_IP": False}) def test_do_login(self): - """ Test the do_login endpoint. """ + """Test the do_login endpoint.""" output = self.app.get("/login/") self.assertEqual(output.status_code, 200) @@ -419,7 +419,7 @@ class PagureFlaskLogintests(tests.SimplePagureTest): @patch.dict("pagure.config.config", {"PAGURE_AUTH": "local"}) @patch.dict("pagure.config.config", {"CHECK_SESSION_IP": False}) def test_do_login_and_redirect(self): - """ Test the do_login endpoint with a non-default redirect. """ + """Test the do_login endpoint with a non-default redirect.""" # This has all the data needed data = { "username": "foouser", @@ -697,7 +697,7 @@ class PagureFlaskLogintests(tests.SimplePagureTest): self.assertEqual(item.token, None) def test_confirm_user(self): - """ Test the confirm_user endpoint. """ + """Test the confirm_user endpoint.""" output = self.app.get("/confirm/foo", follow_redirects=True) self.assertEqual(output.status_code, 200) @@ -733,7 +733,7 @@ class PagureFlaskLogintests(tests.SimplePagureTest): @patch.dict("pagure.config.config", {"PAGURE_AUTH": "local"}) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_lost_password(self): - """ Test the lost_password endpoint. """ + """Test the lost_password endpoint.""" output = self.app.get("/password/lost") self.assertEqual(output.status_code, 200) @@ -810,7 +810,7 @@ class PagureFlaskLogintests(tests.SimplePagureTest): @patch.dict("pagure.config.config", {"PAGURE_AUTH": "local"}) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_reset_password(self): - """ Test the reset_password endpoint. """ + """Test the reset_password endpoint.""" output = self.app.get("/password/reset/foo", follow_redirects=True) self.assertEqual(output.status_code, 200) @@ -887,7 +887,7 @@ class PagureFlaskLogintests(tests.SimplePagureTest): ) @patch.dict("pagure.config.config", {"PAGURE_AUTH": "local"}) def test_change_password(self): - """ Test the change_password endpoint. """ + """Test the change_password endpoint.""" # Not logged in, redirects output = self.app.get("/password/change", follow_redirects=True) @@ -1034,7 +1034,7 @@ class PagureFlaskLogintests(tests.SimplePagureTest): @patch.dict("pagure.config.config", {"PAGURE_AUTH": "local"}) def test_logout(self): - """ Test the auth_logout endpoint for local login. """ + """Test the auth_logout endpoint for local login.""" output = self.app.get("/logout/", follow_redirects=True) self.assertEqual(output.status_code, 200) @@ -1070,7 +1070,7 @@ class PagureFlaskLogintests(tests.SimplePagureTest): @patch.dict("pagure.config.config", {"PAGURE_AUTH": "local"}) def test_settings_admin_session_timedout(self): - """ Test the admin_session_timedout with settings endpoint. """ + """Test the admin_session_timedout with settings endpoint.""" lifetime = pagure.config.config.get( "ADMIN_SESSION_LIFETIME", datetime.timedelta(minutes=15) ) @@ -1094,7 +1094,7 @@ class PagureFlaskLogintests(tests.SimplePagureTest): @patch("flask.flash") def test_admin_session_timedout(self, flash): - """ Test the call to admin_session_timedout. """ + """Test the call to admin_session_timedout.""" lifetime = pagure.config.config.get( "ADMIN_SESSION_LIFETIME", datetime.timedelta(minutes=15) ) @@ -1116,7 +1116,7 @@ class PagureFlaskLogintests(tests.SimplePagureTest): @patch.dict("pagure.config.config", {"PAGURE_AUTH": "local"}) def test_force_logout(self): - """ Test forcing logout. """ + """Test forcing logout.""" user = tests.FakeUser(username="foo") with tests.user_set(self.app.application, user, keep_get_user=True): # Test that accessing settings works diff --git a/tests/test_pagure_flask_ui_no_master_branch.py b/tests/test_pagure_flask_ui_no_master_branch.py index 3d2e31f..3ba928d 100644 --- a/tests/test_pagure_flask_ui_no_master_branch.py +++ b/tests/test_pagure_flask_ui_no_master_branch.py @@ -33,7 +33,7 @@ class PagureFlaskNoMasterBranchtests(tests.SimplePagureTest): """Tests for flask application when the git repo has no master branch.""" def set_up_git_repo(self): - """ Set up the git repo to play with. """ + """Set up the git repo to play with.""" # Create a git repo to play with gitrepo = os.path.join(self.path, "repos", "test.git") diff --git a/tests/test_pagure_flask_ui_oidc_login.py b/tests/test_pagure_flask_ui_oidc_login.py index f9cf133..4a33e13 100644 --- a/tests/test_pagure_flask_ui_oidc_login.py +++ b/tests/test_pagure_flask_ui_oidc_login.py @@ -44,12 +44,12 @@ CLIENT_SECRETS = { class PagureFlaskOIDCLogintests(tests.SimplePagureTest): - """ Tests for OIDC login in the flask app controller of pagure """ + """Tests for OIDC login in the flask app controller of pagure""" populate_db = False def setUp(self): - """ Create the application with PAGURE_AUTH being local. """ + """Create the application with PAGURE_AUTH being local.""" super(PagureFlaskOIDCLogintests, self).setUp() self.app = pagure.flask_app.create_app( @@ -93,7 +93,7 @@ class PagureFlaskOIDCLogintests(tests.SimplePagureTest): self.config_patcher.stop() def test_fas_user_from_oidc(self): - """ Test the user creation function. """ + """Test the user creation function.""" user_info = self.user_info.copy() flask.g._oidc_userinfo = user_info fas_user_from_oidc() @@ -104,7 +104,7 @@ class PagureFlaskOIDCLogintests(tests.SimplePagureTest): self.assertEqual(flask.g.fas_user.groups, []) def test_fas_user_from_oidc_groups(self): - """ Test the user creation function. """ + """Test the user creation function.""" user_info = self.user_info.copy() user_info["groups"] = ["group1", "group2"] flask.g._oidc_userinfo = user_info @@ -112,7 +112,7 @@ class PagureFlaskOIDCLogintests(tests.SimplePagureTest): self.assertEqual(flask.g.fas_user.groups, ["group1", "group2"]) def test_fas_user_from_oidc_ssh(self): - """ Test the user creation function. """ + """Test the user creation function.""" user_info = self.user_info.copy() user_info["ssh_key"] = "dummy ssh key" flask.g._oidc_userinfo = user_info diff --git a/tests/test_pagure_flask_ui_old_commit.py b/tests/test_pagure_flask_ui_old_commit.py index 906c0b5..a8e8232 100644 --- a/tests/test_pagure_flask_ui_old_commit.py +++ b/tests/test_pagure_flask_ui_old_commit.py @@ -26,10 +26,10 @@ import tests class PagureFlaskRepoOldUrltests(tests.SimplePagureTest): - """ Tests for flask app controller of pagure """ + """Tests for flask app controller of pagure""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskRepoOldUrltests, self).setUp() pagure.config.config["EMAIL_SEND"] = False @@ -39,7 +39,7 @@ class PagureFlaskRepoOldUrltests(tests.SimplePagureTest): @patch.dict("pagure.config.config", {"OLD_VIEW_COMMIT_ENABLED": True}) def test_view_commit_old_with_bogus_url(self): - """ Test the view_commit_old endpoint. """ + """Test the view_commit_old endpoint.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -54,7 +54,7 @@ class PagureFlaskRepoOldUrltests(tests.SimplePagureTest): @patch.dict("pagure.config.config", {"OLD_VIEW_COMMIT_ENABLED": True}) def test_view_commit_old(self): - """ Test the view_commit_old endpoint. """ + """Test the view_commit_old endpoint.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) diff --git a/tests/test_pagure_flask_ui_plugins.py b/tests/test_pagure_flask_ui_plugins.py index 4e21f77..3d7c364 100644 --- a/tests/test_pagure_flask_ui_plugins.py +++ b/tests/test_pagure_flask_ui_plugins.py @@ -25,17 +25,17 @@ import tests class FakeForm(wtforms.Form): - """ Form to configure the mail hook. """ + """Form to configure the mail hook.""" field1 = wtforms.StringField("Title", [pagure.hooks.RequiredIf("active")]) field2 = wtforms.BooleanField("Title2", [wtforms.validators.Optional()]) class PagureFlaskPluginstests(tests.SimplePagureTest): - """ Tests for flask plugins controller of pagure """ + """Tests for flask plugins controller of pagure""" def test_get_plugin_names(self): - """ Test the get_plugin_names function. """ + """Test the get_plugin_names function.""" names = pagure.lib.plugins.get_plugin_names() self.assertEqual( sorted(names), @@ -56,12 +56,12 @@ class PagureFlaskPluginstests(tests.SimplePagureTest): ) def test_get_plugin(self): - """ Test the get_plugin function. """ + """Test the get_plugin function.""" name = pagure.lib.plugins.get_plugin("Mail") self.assertEqual(str(name), "") def test_view_plugin_page(self): - """ Test the view_plugin_page endpoint. """ + """Test the view_plugin_page endpoint.""" # No Git repo output = self.app.get("/foo/settings/Mail") @@ -130,7 +130,7 @@ class PagureFlaskPluginstests(tests.SimplePagureTest): self.assertIn("Hook Mail deactivated", output_text) def test_RequiredIf(self): - """ Test the behavior of the RequiredIf validator. """ + """Test the behavior of the RequiredIf validator.""" form = FakeForm() try: diff --git a/tests/test_pagure_flask_ui_plugins_default_hook.py b/tests/test_pagure_flask_ui_plugins_default_hook.py index e0239f7..e754255 100644 --- a/tests/test_pagure_flask_ui_plugins_default_hook.py +++ b/tests/test_pagure_flask_ui_plugins_default_hook.py @@ -31,10 +31,10 @@ import tests class PagureFlaskPluginDefaultHooktests(tests.Modeltests): - """ Tests for default_hook plugin of pagure """ + """Tests for default_hook plugin of pagure""" def test_plugin_default_active_on_project(self): - """ Test that the default hook is active on random project. """ + """Test that the default hook is active on random project.""" tests.create_projects(self.session) test = pagure.lib.query.search_projects(self.session)[0] diff --git a/tests/test_pagure_flask_ui_plugins_fedmsg.py b/tests/test_pagure_flask_ui_plugins_fedmsg.py index 0df9c16..9f2f1f6 100644 --- a/tests/test_pagure_flask_ui_plugins_fedmsg.py +++ b/tests/test_pagure_flask_ui_plugins_fedmsg.py @@ -25,10 +25,10 @@ import pagure.config class PagureFlaskPluginFedmsgtests(tests.SimplePagureTest): - """ Tests for fedmsg plugin of pagure """ + """Tests for fedmsg plugin of pagure""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskPluginFedmsgtests, self).setUp() tests.create_projects(self.session) @@ -36,12 +36,12 @@ class PagureFlaskPluginFedmsgtests(tests.SimplePagureTest): tests.create_projects_git(os.path.join(self.path, "docs")) def tearDown(self): - """ Tear Down the environment after the tests. """ + """Tear Down the environment after the tests.""" super(PagureFlaskPluginFedmsgtests, self).tearDown() pagure.config.config["DOCS_FOLDER"] = None def test_plugin_fedmsg_defaul_page(self): - """ Test the fedmsg plugin endpoint's default page. """ + """Test the fedmsg plugin endpoint's default page.""" user = tests.FakeUser(username="pingou") with tests.user_set(self.app.application, user): diff --git a/tests/test_pagure_flask_ui_plugins_irc.py b/tests/test_pagure_flask_ui_plugins_irc.py index 2dd2189..326bc22 100644 --- a/tests/test_pagure_flask_ui_plugins_irc.py +++ b/tests/test_pagure_flask_ui_plugins_irc.py @@ -22,10 +22,10 @@ import tests class PagureFlaskPluginIRCtests(tests.SimplePagureTest): - """ Tests for pagure_hook plugin of pagure """ + """Tests for pagure_hook plugin of pagure""" def test_plugin_mail(self): - """ Test the irc plugin on/off endpoint. """ + """Test the irc plugin on/off endpoint.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos")) diff --git a/tests/test_pagure_flask_ui_plugins_mail.py b/tests/test_pagure_flask_ui_plugins_mail.py index 3258d1f..4dfdc40 100644 --- a/tests/test_pagure_flask_ui_plugins_mail.py +++ b/tests/test_pagure_flask_ui_plugins_mail.py @@ -23,10 +23,10 @@ import tests class PagureFlaskPluginMailtests(tests.SimplePagureTest): - """ Tests for flask plugins controller of pagure """ + """Tests for flask plugins controller of pagure""" def test_plugin_mail(self): - """ Test the mail plugin on/off endpoint. """ + """Test the mail plugin on/off endpoint.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos")) diff --git a/tests/test_pagure_flask_ui_plugins_mirror.py b/tests/test_pagure_flask_ui_plugins_mirror.py index 8802d24..d2ffbb4 100644 --- a/tests/test_pagure_flask_ui_plugins_mirror.py +++ b/tests/test_pagure_flask_ui_plugins_mirror.py @@ -25,10 +25,10 @@ import tests class PagureFlaskPluginMirrortests(tests.Modeltests): - """ Tests for mirror plugin of pagure """ + """Tests for mirror plugin of pagure""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskPluginMirrortests, self).setUp() tests.create_projects(self.session) @@ -50,7 +50,7 @@ class PagureFlaskPluginMirrortests(tests.Modeltests): self.assertIsNotNone(pagure.utils.ssh_urlpattern.match(el)) def test_plugin_mirror_no_csrf(self): - """ Test setting up the mirror plugin with no csrf. """ + """Test setting up the mirror plugin with no csrf.""" user = tests.FakeUser(username="pingou") with tests.user_set(self.app.application, user): diff --git a/tests/test_pagure_flask_ui_plugins_noff.py b/tests/test_pagure_flask_ui_plugins_noff.py index 4cbf555..18277d4 100644 --- a/tests/test_pagure_flask_ui_plugins_noff.py +++ b/tests/test_pagure_flask_ui_plugins_noff.py @@ -23,10 +23,10 @@ import tests class PagureFlaskPluginNoFFtests(tests.SimplePagureTest): - """ Tests for Block non fast-forward pushes plugin of pagure """ + """Tests for Block non fast-forward pushes plugin of pagure""" def test_plugin_noff(self): - """ Test the noff plugin on/off endpoint. """ + """Test the noff plugin on/off endpoint.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos")) diff --git a/tests/test_pagure_flask_ui_plugins_pagure_ci.py b/tests/test_pagure_flask_ui_plugins_pagure_ci.py index 08304c0..063bf9b 100644 --- a/tests/test_pagure_flask_ui_plugins_pagure_ci.py +++ b/tests/test_pagure_flask_ui_plugins_pagure_ci.py @@ -17,10 +17,10 @@ import tests class PagureFlaskPluginPagureCItests(tests.SimplePagureTest): - """ Tests for flask plugins controller of pagure """ + """Tests for flask plugins controller of pagure""" def test_plugin_pagure_ci(self): - """ Test the pagure ci plugin on/off endpoint. """ + """Test the pagure ci plugin on/off endpoint.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos")) @@ -260,7 +260,7 @@ class PagureFlaskPluginPagureCItests(tests.SimplePagureTest): ) def test_plugin_pagure_ci_namespaced(self): - """ Test the pagure ci plugin on/off endpoint. """ + """Test the pagure ci plugin on/off endpoint.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos")) @@ -356,7 +356,7 @@ class PagureFlaskPluginPagureCItests(tests.SimplePagureTest): @mock.patch("pagure.lib.tasks_services.trigger_jenkins_build") def test_plugin_pagure_ci_namespaced_auth(self, trigger_jenk): - """ Test the pagure ci plugin on/off endpoint. """ + """Test the pagure ci plugin on/off endpoint.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos")) diff --git a/tests/test_pagure_flask_ui_plugins_pagure_hook.py b/tests/test_pagure_flask_ui_plugins_pagure_hook.py index 342e069..e4ac0df 100644 --- a/tests/test_pagure_flask_ui_plugins_pagure_hook.py +++ b/tests/test_pagure_flask_ui_plugins_pagure_hook.py @@ -25,10 +25,10 @@ import pagure.config class PagureFlaskPluginPagureHooktests(tests.SimplePagureTest): - """ Tests for pagure_hook plugin of pagure """ + """Tests for pagure_hook plugin of pagure""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskPluginPagureHooktests, self).setUp() tests.create_projects(self.session) @@ -36,12 +36,12 @@ class PagureFlaskPluginPagureHooktests(tests.SimplePagureTest): tests.create_projects_git(os.path.join(self.path, "repos", "docs")) def tearDown(self): - """ Tear Down the environment after the tests. """ + """Tear Down the environment after the tests.""" super(PagureFlaskPluginPagureHooktests, self).tearDown() pagure.config.config["DOCS_FOLDER"] = None def test_plugin_mail_page(self): - """ Test the default page of the pagure hook plugin. """ + """Test the default page of the pagure hook plugin.""" user = tests.FakeUser(username="pingou") with tests.user_set(self.app.application, user): @@ -58,7 +58,7 @@ class PagureFlaskPluginPagureHooktests(tests.SimplePagureTest): ) def test_plugin_mail_no_data(self): - """ Test the pagure hook plugin endpoint when no data is sent. """ + """Test the pagure hook plugin endpoint when no data is sent.""" user = tests.FakeUser(username="pingou") with tests.user_set(self.app.application, user): diff --git a/tests/test_pagure_flask_ui_plugins_pagure_no_new_branch.py b/tests/test_pagure_flask_ui_plugins_pagure_no_new_branch.py index 4375f86..3901cde 100644 --- a/tests/test_pagure_flask_ui_plugins_pagure_no_new_branch.py +++ b/tests/test_pagure_flask_ui_plugins_pagure_no_new_branch.py @@ -25,10 +25,10 @@ import pagure.config class PagureFlaskPluginPagureNoNewBranchHooktests(tests.SimplePagureTest): - """ Tests for pagure_no_new_branches plugin of pagure """ + """Tests for pagure_no_new_branches plugin of pagure""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskPluginPagureNoNewBranchHooktests, self).setUp() tests.create_projects(self.session) @@ -40,7 +40,7 @@ class PagureFlaskPluginPagureNoNewBranchHooktests(tests.SimplePagureTest): self.csrf_token = self.get_csrf() def test_plugin_pagure_ticket_no_data(self): - """ Test the pagure_ticket plugin on/off endpoint. """ + """Test the pagure_ticket plugin on/off endpoint.""" user = tests.FakeUser(username="pingou") with tests.user_set(self.app.application, user): @@ -80,7 +80,7 @@ class PagureFlaskPluginPagureNoNewBranchHooktests(tests.SimplePagureTest): ) def test_plugin_pagure_ticket_deactivate(self): - """ Test the pagure_ticket plugin on/off endpoint. """ + """Test the pagure_ticket plugin on/off endpoint.""" user = tests.FakeUser(username="pingou") with tests.user_set(self.app.application, user): data = {"csrf_token": self.csrf_token} @@ -131,7 +131,7 @@ class PagureFlaskPluginPagureNoNewBranchHooktests(tests.SimplePagureTest): ) def test_plugin_pagure_ticket_activate(self): - """ Test the pagure_ticket plugin on/off endpoint. """ + """Test the pagure_ticket plugin on/off endpoint.""" user = tests.FakeUser(username="pingou") with tests.user_set(self.app.application, user): @@ -219,7 +219,7 @@ class PagureFlaskPluginPagureNoNewBranchHooktests(tests.SimplePagureTest): ) def test_plugin_pagure_ticket_activate_w_no_repo(self): - """ Test the pagure_ticket plugin on/off endpoint. """ + """Test the pagure_ticket plugin on/off endpoint.""" shutil.rmtree(os.path.join(self.path, "repos", "test.git")) user = tests.FakeUser(username="pingou") diff --git a/tests/test_pagure_flask_ui_plugins_pagure_request_hook.py b/tests/test_pagure_flask_ui_plugins_pagure_request_hook.py index d3bad06..7316a45 100644 --- a/tests/test_pagure_flask_ui_plugins_pagure_request_hook.py +++ b/tests/test_pagure_flask_ui_plugins_pagure_request_hook.py @@ -23,10 +23,10 @@ import tests class PagureFlaskPluginPagureRequestHooktests(tests.SimplePagureTest): - """ Tests for pagure_hook plugin of pagure """ + """Tests for pagure_hook plugin of pagure""" def test_plugin_pagure_request(self): - """ Test the pagure_request plugin on/off endpoint. """ + """Test the pagure_request plugin on/off endpoint.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos")) diff --git a/tests/test_pagure_flask_ui_plugins_pagure_ticket_hook.py b/tests/test_pagure_flask_ui_plugins_pagure_ticket_hook.py index ac828a7..6ce2dfb 100644 --- a/tests/test_pagure_flask_ui_plugins_pagure_ticket_hook.py +++ b/tests/test_pagure_flask_ui_plugins_pagure_ticket_hook.py @@ -24,10 +24,10 @@ import tests class PagureFlaskPluginPagureTicketHooktests(tests.SimplePagureTest): - """ Tests for pagure_hook plugin of pagure """ + """Tests for pagure_hook plugin of pagure""" def test_plugin_pagure_ticket(self): - """ Test the pagure_ticket plugin on/off endpoint. """ + """Test the pagure_ticket plugin on/off endpoint.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos")) diff --git a/tests/test_pagure_flask_ui_plugins_rtd_hook.py b/tests/test_pagure_flask_ui_plugins_rtd_hook.py index 0da4587..a93de35 100644 --- a/tests/test_pagure_flask_ui_plugins_rtd_hook.py +++ b/tests/test_pagure_flask_ui_plugins_rtd_hook.py @@ -24,10 +24,10 @@ import tests class PagureFlaskPluginRtdHooktests(tests.SimplePagureTest): - """ Tests for rtd_hook plugin of pagure """ + """Tests for rtd_hook plugin of pagure""" def test_plugin_pagure_request(self): - """ Test the pagure_request plugin on/off endpoint. """ + """Test the pagure_request plugin on/off endpoint.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos")) diff --git a/tests/test_pagure_flask_ui_plugins_unsigned.py b/tests/test_pagure_flask_ui_plugins_unsigned.py index c66dfd2..ad50dd9 100644 --- a/tests/test_pagure_flask_ui_plugins_unsigned.py +++ b/tests/test_pagure_flask_ui_plugins_unsigned.py @@ -23,10 +23,10 @@ import tests class PagureFlaskPluginUnsignedtests(tests.SimplePagureTest): - """ Tests for Block pushes with unsigned commit plugin of pagure """ + """Tests for Block pushes with unsigned commit plugin of pagure""" def test_plugin_unsigned(self): - """ Test the noff plugin on/off endpoint. """ + """Test the noff plugin on/off endpoint.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos")) diff --git a/tests/test_pagure_flask_ui_pr_bidi.py b/tests/test_pagure_flask_ui_pr_bidi.py index 6ebdc91..54078b1 100644 --- a/tests/test_pagure_flask_ui_pr_bidi.py +++ b/tests/test_pagure_flask_ui_pr_bidi.py @@ -26,14 +26,14 @@ import tests class PagureFlaskPrBiditests(tests.Modeltests): - """ Tests PR in pagure when the PR has bi-directional characters """ + """Tests PR in pagure when the PR has bi-directional characters""" maxDiff = None @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) @patch("pagure.lib.notify.fedmsg_publish", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskPrBiditests, self).setUp() tests.create_projects(self.session) @@ -76,7 +76,7 @@ class PagureFlaskPrBiditests(tests.Modeltests): tests.clean_pull_requests_path() def test_accessing_pr_no_bidi(self): - """ Test accessing the PR which has no bidi characters. """ + """Test accessing the PR which has no bidi characters.""" project = pagure.lib.query.get_authorized_project(self.session, "test") fork = pagure.lib.query.get_authorized_project( self.session, "test", user="foo" @@ -101,7 +101,7 @@ class PagureFlaskPrBiditests(tests.Modeltests): ) def test_accessing_pr_bidi(self): - """ Test accessing the PR which has no bidi characters. """ + """Test accessing the PR which has no bidi characters.""" project = pagure.lib.query.get_authorized_project(self.session, "test") fork = pagure.lib.query.get_authorized_project( self.session, "test", user="foo" diff --git a/tests/test_pagure_flask_ui_pr_edit.py b/tests/test_pagure_flask_ui_pr_edit.py index 0baa541..123b60a 100644 --- a/tests/test_pagure_flask_ui_pr_edit.py +++ b/tests/test_pagure_flask_ui_pr_edit.py @@ -25,7 +25,7 @@ import pygit2 class PagureFlaskPrEditSimpletests(tests.Modeltests): def test_pr_edit_no_project(self): - """ Test the edit pull request endpoint """ + """Test the edit pull request endpoint""" output = self.app.get("/foo/pull-request/1/edit") self.assertEqual(output.status_code, 404) output_text = output.get_data(as_text=True) @@ -35,7 +35,7 @@ class PagureFlaskPrEditSimpletests(tests.Modeltests): self.assertIn("

Page not found (404)

", output_text) def test_pr_edit_no_git_repo(self): - """ Test the edit pull request endpoint """ + """Test the edit pull request endpoint""" tests.create_projects(self.session) output = self.app.get("/test/pull-request/1/edit") self.assertEqual(output.status_code, 404) @@ -46,14 +46,14 @@ class PagureFlaskPrEditSimpletests(tests.Modeltests): self.assertIn("

No git repo found

", output_text) def test_pr_edit_no_pull_requests_no_login(self): - """ Test the edit pull request endpoint """ + """Test the edit pull request endpoint""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) output = self.app.get("/test/pull-request/1/edit") self.assertEqual(output.status_code, 302) def test_pr_edit_no_pull_requests(self): - """ Test the edit pull request endpoint """ + """Test the edit pull request endpoint""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) user = tests.FakeUser() diff --git a/tests/test_pagure_flask_ui_pr_no_sources.py b/tests/test_pagure_flask_ui_pr_no_sources.py index c8663c9..4ea492f 100644 --- a/tests/test_pagure_flask_ui_pr_no_sources.py +++ b/tests/test_pagure_flask_ui_pr_no_sources.py @@ -31,14 +31,14 @@ from pagure.lib.repo import PagureRepo class PagureFlaskPrNoSourcestests(tests.Modeltests): - """ Tests PR in pagure when the source is gone """ + """Tests PR in pagure when the source is gone""" maxDiff = None @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) @patch("pagure.lib.notify.fedmsg_publish", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskPrNoSourcestests, self).setUp() tests.create_projects(self.session) @@ -91,7 +91,7 @@ class PagureFlaskPrNoSourcestests(tests.Modeltests): tests.clean_pull_requests_path() def test_request_pull_reference(self): - """ Test if there is a reference created for a new PR. """ + """Test if there is a reference created for a new PR.""" project = pagure.lib.query.get_authorized_project(self.session, "test") self.assertEqual(len(project.requests), 1) @@ -104,7 +104,7 @@ class PagureFlaskPrNoSourcestests(tests.Modeltests): ) def test_request_pull_fork_reference(self): - """ Test if there the references created on the fork. """ + """Test if there the references created on the fork.""" project = pagure.lib.query.get_authorized_project( self.session, "test", user="foo" @@ -118,7 +118,7 @@ class PagureFlaskPrNoSourcestests(tests.Modeltests): ) def test_accessing_pr_fork_deleted(self): - """ Test accessing the PR if the fork has been deleted. """ + """Test accessing the PR if the fork has been deleted.""" # Delete fork on disk project = pagure.lib.query.get_authorized_project( @@ -138,7 +138,7 @@ class PagureFlaskPrNoSourcestests(tests.Modeltests): self.assertEqual(output2.status_code, 200) def test_accessing_pr_patch_fork_deleted(self): - """ Test accessing the PR's patch if the fork has been deleted. """ + """Test accessing the PR's patch if the fork has been deleted.""" # Delete fork on disk project = pagure.lib.query.get_authorized_project( diff --git a/tests/test_pagure_flask_ui_priorities.py b/tests/test_pagure_flask_ui_priorities.py index 2969415..4c0f7e8 100644 --- a/tests/test_pagure_flask_ui_priorities.py +++ b/tests/test_pagure_flask_ui_priorities.py @@ -31,12 +31,12 @@ from pagure.lib.repo import PagureRepo class PagureFlaskPrioritiestests(tests.Modeltests): - """ Tests for the behavior of priorities in pagure """ + """Tests for the behavior of priorities in pagure""" @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_ticket_with_no_priority(self, p_send_email, p_ugt): - """ Test creating a ticket without priority. """ + """Test creating a ticket without priority.""" p_send_email.return_value = True p_ugt.return_value = True @@ -90,7 +90,7 @@ class PagureFlaskPrioritiestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_ticket_with_priorities(self, p_send_email, p_ugt): - """ Test creating a ticket with priorities. """ + """Test creating a ticket with priorities.""" p_send_email.return_value = True p_ugt.return_value = True @@ -148,7 +148,7 @@ class PagureFlaskPrioritiestests(tests.Modeltests): self.assertIn('', output_text) def test_update_priorities(self): - """ Test updating priorities of a repo. """ + """Test updating priorities of a repo.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -416,7 +416,7 @@ class PagureFlaskPrioritiestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_reset_priorities(self, p_send_email, p_ugt): - """ Test resetting the priorities of a repo. """ + """Test resetting the priorities of a repo.""" p_send_email.return_value = True p_ugt.return_value = True @@ -549,7 +549,7 @@ class PagureFlaskPrioritiestests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_reset_priorities_None(self, p_send_email, p_ugt): - """ Test resetting the priorities of a repo. """ + """Test resetting the priorities of a repo.""" p_send_email.return_value = True p_ugt.return_value = True @@ -682,7 +682,7 @@ class PagureFlaskPrioritiestests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_set_priority_1_and_back(self): - """ Test setting the priority of a ticket to 1. """ + """Test setting the priority of a ticket to 1.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -850,7 +850,7 @@ class PagureFlaskPrioritiestests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_set_priority_0(self): - """ Test setting the priority of a ticket to 0. """ + """Test setting the priority of a ticket to 0.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -992,7 +992,7 @@ class PagureFlaskPrioritiestests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_set_priority_minus1(self): - """ Test setting the priority of a ticket to -1. """ + """Test setting the priority of a ticket to -1.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -1132,7 +1132,7 @@ class PagureFlaskPrioritiestests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_default_priority(self): - """ Test updating the default priority of a repo. """ + """Test updating the default priority of a repo.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -1439,7 +1439,7 @@ class PagureFlaskPrioritiestests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_default_priority_on_new_ticket(self): - """ Test updating the default priority of a repo. """ + """Test updating the default priority of a repo.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) diff --git a/tests/test_pagure_flask_ui_quick_reply.py b/tests/test_pagure_flask_ui_quick_reply.py index 6831ee8..a2d984f 100644 --- a/tests/test_pagure_flask_ui_quick_reply.py +++ b/tests/test_pagure_flask_ui_quick_reply.py @@ -29,10 +29,10 @@ import tests class PagureFlaskQuickReplytest(tests.Modeltests): - """ Tests for configuring and displaying quick replies. """ + """Tests for configuring and displaying quick replies.""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskQuickReplytest, self).setUp() tests.create_projects(self.session) diff --git a/tests/test_pagure_flask_ui_remote_pr.py b/tests/test_pagure_flask_ui_remote_pr.py index b630da1..c779a06 100644 --- a/tests/test_pagure_flask_ui_remote_pr.py +++ b/tests/test_pagure_flask_ui_remote_pr.py @@ -35,10 +35,10 @@ from pagure.lib.git import _make_signature class PagureRemotePRtests(tests.Modeltests): - """ Tests for remote PRs in pagure """ + """Tests for remote PRs in pagure""" def setUp(self): - """ Set up the environment. """ + """Set up the environment.""" super(PagureRemotePRtests, self).setUp() self.newpath = tempfile.mkdtemp(prefix="pagure-fork-test") @@ -48,7 +48,7 @@ class PagureRemotePRtests(tests.Modeltests): ) def tearDown(self): - """ Clear things up. """ + """Clear things up.""" super(PagureRemotePRtests, self).tearDown() pagure.config.config["REMOTE_GIT_FOLDER"] = self.old_value @@ -158,7 +158,7 @@ class PagureRemotePRtests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_new_remote_pr_unauth(self): - """ Test creating a new remote PR un-authenticated. """ + """Test creating a new remote PR un-authenticated.""" tests.create_projects(self.session) tests.create_projects_git( @@ -181,7 +181,7 @@ class PagureRemotePRtests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_new_remote_pr_auth(self): - """ Test creating a new remote PR authenticated. """ + """Test creating a new remote PR authenticated.""" tests.create_projects(self.session) tests.create_projects_git( @@ -498,7 +498,7 @@ class PagureRemotePRtests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) @patch("pagure.lib.tasks_services.trigger_ci_build") def test_new_remote_pr_ci_off(self, trigger_ci): - """ Test creating a new remote PR when CI is not configured. """ + """Test creating a new remote PR when CI is not configured.""" tests.create_projects(self.session) tests.create_projects_git( @@ -563,7 +563,7 @@ class PagureRemotePRtests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) @patch("pagure.lib.tasks_services.trigger_ci_build") def test_new_remote_pr_ci_on(self, trigger_ci): - """ Test creating a new remote PR when CI is configured. """ + """Test creating a new remote PR when CI is configured.""" tests.create_projects(self.session) tests.create_projects_git( diff --git a/tests/test_pagure_flask_ui_repo.py b/tests/test_pagure_flask_ui_repo.py index f1abd91..9603726 100644 --- a/tests/test_pagure_flask_ui_repo.py +++ b/tests/test_pagure_flask_ui_repo.py @@ -43,10 +43,10 @@ from pagure.utils import __get_file_in_tree as get_file_in_tree class PagureFlaskRepotests(tests.Modeltests): - """ Tests for flask app controller of pagure """ + """Tests for flask app controller of pagure""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskRepotests, self).setUp() pagure.config.config["VIRUS_SCAN_ATTACHMENTS"] = False @@ -109,7 +109,7 @@ class PagureFlaskRepotests(tests.Modeltests): @patch("pagure.decorators.admin_session_timedout") def test_add_deploykey(self, ast): - """ Test the add_deploykey endpoint. """ + """Test the add_deploykey endpoint.""" ast.return_value = False # No git repo @@ -252,7 +252,7 @@ class PagureFlaskRepotests(tests.Modeltests): ) @patch("pagure.decorators.admin_session_timedout") def test_add_user(self, ast): - """ Test the add_user endpoint. """ + """Test the add_user endpoint.""" ast.return_value = False # No git repo @@ -563,7 +563,7 @@ class PagureFlaskRepotests(tests.Modeltests): ) @patch("pagure.decorators.admin_session_timedout") def test_add_group_project(self, ast): - """ Test the add_group_project endpoint. """ + """Test the add_group_project endpoint.""" ast.return_value = False # No Git repo @@ -837,7 +837,7 @@ class PagureFlaskRepotests(tests.Modeltests): @patch("pagure.decorators.admin_session_timedout") def test_remove_deploykey(self, ast): - """ Test the remove_deploykey endpoint. """ + """Test the remove_deploykey endpoint.""" ast.return_value = False # Git repo not found @@ -952,7 +952,7 @@ class PagureFlaskRepotests(tests.Modeltests): ) @patch("pagure.decorators.admin_session_timedout") def test_remove_user(self, ast): - """ Test the remove_user endpoint. """ + """Test the remove_user endpoint.""" ast.return_value = False # Git repo not found @@ -1110,7 +1110,7 @@ class PagureFlaskRepotests(tests.Modeltests): @patch("pagure.decorators.admin_session_timedout") @patch("pagure.lib.notify.log") def test_remove_user_self(self, mock_log, ast): - """ Test the remove_user endpoint when removing themselves. """ + """Test the remove_user endpoint when removing themselves.""" ast.return_value = False tests.create_projects(self.session) @@ -1230,7 +1230,7 @@ class PagureFlaskRepotests(tests.Modeltests): ) @patch("pagure.decorators.admin_session_timedout") def test_remove_group_project(self, ast): - """ Test the remove_group_project endpoint. """ + """Test the remove_group_project endpoint.""" ast.return_value = False # No Git repo @@ -1405,7 +1405,7 @@ class PagureFlaskRepotests(tests.Modeltests): @patch("pagure.decorators.admin_session_timedout") def test_update_project(self, ast): - """ Test the update_project endpoint. """ + """Test the update_project endpoint.""" ast.return_value = True # Git repo not found @@ -1622,7 +1622,7 @@ class PagureFlaskRepotests(tests.Modeltests): ) @patch("pagure.decorators.admin_session_timedout") def test_view_settings(self, ast): - """ Test the view_settings endpoint. """ + """Test the view_settings endpoint.""" ast.return_value = False # No Git repo @@ -1883,7 +1883,7 @@ class PagureFlaskRepotests(tests.Modeltests): @patch("pagure.lib.git.generate_gitolite_acls") @patch("pagure.decorators.admin_session_timedout") def test_view_settings_pr_only(self, ast, gen_acl): - """ Test the view_settings endpoint when turning on PR only. """ + """Test the view_settings endpoint when turning on PR only.""" ast.return_value = False tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos")) @@ -1959,7 +1959,7 @@ class PagureFlaskRepotests(tests.Modeltests): @patch("pagure.decorators.admin_session_timedout") def test_fields_in_view_settings(self, ast): - """ Test the default fields in view_settings endpoint. """ + """Test the default fields in view_settings endpoint.""" ast.return_value = False # No Git repo @@ -2084,7 +2084,7 @@ class PagureFlaskRepotests(tests.Modeltests): ) def test_view_forks(self): - """ Test the view_forks endpoint. """ + """Test the view_forks endpoint.""" output = self.app.get("/foo/forks", follow_redirects=True) self.assertEqual(output.status_code, 404) @@ -2099,7 +2099,7 @@ class PagureFlaskRepotests(tests.Modeltests): @patch.dict("pagure.config.config", {"CASE_SENSITIVE": True}) def test_view_repo_case_sensitive(self): - """ Test the view_repo endpoint. """ + """Test the view_repo endpoint.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -2246,7 +2246,7 @@ class PagureFlaskRepotests(tests.Modeltests): self.assertIn("Cloning over SSH is disabled.", output_text) def test_view_repo(self): - """ Test the view_repo endpoint. """ + """Test the view_repo endpoint.""" output = self.app.get("/foo") # No project registered in the DB @@ -2444,7 +2444,7 @@ class PagureFlaskRepotests(tests.Modeltests): self.perfReset() def test_view_repo_empty(self): - """ Test the view_repo endpoint on a repo w/o master branch. """ + """Test the view_repo endpoint on a repo w/o master branch.""" tests.create_projects(self.session) # Create a git repo to play with @@ -2558,7 +2558,7 @@ class PagureFlaskRepotests(tests.Modeltests): ''' def test_view_commits(self): - """ Test the view_commits endpoint. """ + """Test the view_commits endpoint.""" output = self.app.get("/foo/commits") # No project registered in the DB self.assertEqual(output.status_code, 404) @@ -2666,7 +2666,7 @@ class PagureFlaskRepotests(tests.Modeltests): self.assertIn("Forked from", output_text) def test_view_commits_from_tag(self): - """ Test the view_commits endpoint given a tag. """ + """Test the view_commits endpoint given a tag.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -2697,7 +2697,7 @@ class PagureFlaskRepotests(tests.Modeltests): self.assertEqual(output_text.count(''), 1) def test_view_commits_from_blob(self): - """ Test the view_commits endpoint given a blob. """ + """Test the view_commits endpoint given a blob.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -2719,7 +2719,7 @@ class PagureFlaskRepotests(tests.Modeltests): self.assertIn("Invalid branch/identifier provided", output_text) def test_view_commit_from_tag(self): - """ Test the view_commit endpoint given a tag. """ + """Test the view_commit endpoint given a tag.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -2757,7 +2757,7 @@ class PagureFlaskRepotests(tests.Modeltests): ) def test_compare_commits(self): - """ Test the compare_commits endpoint. """ + """Test the compare_commits endpoint.""" # First two commits comparison def compare_first_two(c1, c2): @@ -2942,7 +2942,7 @@ class PagureFlaskRepotests(tests.Modeltests): compare_with_symlink(c3, c4) def test_view_file(self): - """ Test the view_file endpoint. """ + """Test the view_file endpoint.""" output = self.app.get("/foo/blob/foo/f/sources") # No project registered in the DB self.assertEqual(output.status_code, 404) @@ -3129,7 +3129,7 @@ class PagureFlaskRepotests(tests.Modeltests): MagicMock(side_effect=pagure.exceptions.PagureException), ) def test_view_file_with_wrong_encoding(self): - """ Test the view_file endpoint. """ + """Test the view_file endpoint.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -3153,7 +3153,7 @@ class PagureFlaskRepotests(tests.Modeltests): self.assertEqual("foo\n bar", output_text) def test_view_raw_file(self): - """ Test the view_raw_file endpoint. """ + """Test the view_raw_file endpoint.""" output = self.app.get("/foo/raw/foo/sources") # No project registered in the DB self.assertEqual(output.status_code, 404) @@ -3300,7 +3300,7 @@ class PagureFlaskRepotests(tests.Modeltests): self.assertIn("foo\n bar", output_text) def test_view_commit(self): - """ Test the view_commit endpoint. """ + """Test the view_commit endpoint.""" output = self.app.get("/foo/c/bar") # No project registered in the DB self.assertEqual(output.status_code, 404) @@ -3559,7 +3559,7 @@ class PagureFlaskRepotests(tests.Modeltests): ) def test_view_commit_patch(self): - """ Test the view_commit_patch endpoint. """ + """Test the view_commit_patch endpoint.""" # No project registered in the DB output = self.app.get("/foo/c/bar.patch") @@ -3701,7 +3701,7 @@ index 0000000..fb7093d ) def test_view_commit_diff(self): - """ Test the view_commit_diff endpoint. """ + """Test the view_commit_diff endpoint.""" # No project registered in the DB output = self.app.get("/foo/c/bar.diff") @@ -3755,7 +3755,7 @@ index 0000000..fb7093d ) def test_view_tree(self): - """ Test the view_tree endpoint. """ + """Test the view_tree endpoint.""" output = self.app.get("/foo/tree/") # No project registered in the DB self.assertEqual(output.status_code, 404) @@ -4097,7 +4097,7 @@ index 0000000..fb7093d @patch("pagure.lib.notify.send_email") @patch("pagure.decorators.admin_session_timedout") def test_delete_read_only_repo(self, ast, send_email): - """ Test the delete_repo endpoint when the repo is read_only """ + """Test the delete_repo endpoint when the repo is read_only""" ast.return_value = False send_email.return_value = True @@ -4146,7 +4146,7 @@ index 0000000..fb7093d @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) @patch("pagure.decorators.admin_session_timedout") def test_delete_repo(self, ast): - """ Test the delete_repo endpoint. """ + """Test the delete_repo endpoint.""" ast.return_value = False # No Git repo @@ -4633,7 +4633,7 @@ index 0000000..fb7093d @patch("pagure.lib.notify.send_email") @patch("pagure.decorators.admin_session_timedout") def test_delete_repo_with_users(self, ast, send_email): - """ Test the delete_repo endpoint. """ + """Test the delete_repo endpoint.""" ast.return_value = False send_email.return_value = True @@ -4763,7 +4763,7 @@ index 0000000..fb7093d @patch("pagure.lib.notify.send_email") @patch("pagure.decorators.admin_session_timedout") def test_delete_repo_with_group(self, ast, send_email): - """ Test the delete_repo endpoint. """ + """Test the delete_repo endpoint.""" ast.return_value = False send_email.return_value = True @@ -4905,7 +4905,7 @@ index 0000000..fb7093d @patch("pagure.lib.notify.send_email") @patch("pagure.decorators.admin_session_timedout") def test_delete_repo_with_coloredtag(self, ast, send_email): - """ Test the delete_repo endpoint. """ + """Test the delete_repo endpoint.""" ast.return_value = False send_email.return_value = True @@ -5039,7 +5039,7 @@ index 0000000..fb7093d @patch("pagure.decorators.admin_session_timedout") def test_new_repo_hook_token(self, ast): - """ Test the new_repo_hook_token endpoint. """ + """Test the new_repo_hook_token endpoint.""" ast.return_value = False tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos")) @@ -5101,7 +5101,7 @@ index 0000000..fb7093d self.assertNotEqual(repo.hook_token, "aaabbbccc") def test_view_tags(self): - """ Test the view_tags endpoint. """ + """Test the view_tags endpoint.""" output = self.app.get("/foo/releases") # No project registered in the DB self.assertEqual(output.status_code, 404) @@ -5145,7 +5145,7 @@ index 0000000..fb7093d ) def test_edit_file_no_signed_off(self): - """ Test the edit_file endpoint when signed-off isn't enforced. """ + """Test the edit_file endpoint when signed-off isn't enforced.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -5180,7 +5180,7 @@ index 0000000..fb7093d ) def test_edit_file_signed_off(self): - """ Test the edit_file endpoint when signed-off is enforced. """ + """Test the edit_file endpoint when signed-off is enforced.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -5222,7 +5222,7 @@ index 0000000..fb7093d ) def test_edit_file(self): - """ Test the edit_file endpoint. """ + """Test the edit_file endpoint.""" # No Git repo output = self.app.get("/foo/edit/foo/f/sources") @@ -5438,7 +5438,7 @@ index 0000000..fb7093d self.assertIn("

No content found

", output_text) def test_edit_file_default_email(self): - """ Test the default email shown by the edit_file endpoint. """ + """Test the default email shown by the edit_file endpoint.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -5482,7 +5482,7 @@ index 0000000..fb7093d @patch("pagure.decorators.admin_session_timedout") def test_change_ref_head(self, ast): - """ Test the change_ref_head endpoint. """ + """Test the change_ref_head endpoint.""" ast.return_value = True # No Git repo @@ -5626,7 +5626,7 @@ index 0000000..fb7093d self.assertIn("Default branch updated " "to master", output_text) def test_new_release(self): - """ Test the new_release endpoint. """ + """Test the new_release endpoint.""" # No Git repo output = self.app.post("/foo/upload/") @@ -5723,7 +5723,7 @@ index 0000000..fb7093d self.assertIn("This project has not been tagged.", output_text) def test_new_release_two_files(self): - """ Test the new_release endpoint when uploading two files. """ + """Test the new_release endpoint when uploading two files.""" tests.create_projects(self.session) repo = tests.create_projects_git(os.path.join(self.path, "repos")) @@ -5805,7 +5805,7 @@ index 0000000..fb7093d @patch("pagure.decorators.admin_session_timedout") def test_add_token_all_tokens(self, ast): - """ Test the add_token endpoint. """ + """Test the add_token endpoint.""" ast.return_value = False tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -5824,7 +5824,7 @@ index 0000000..fb7093d @patch.dict("pagure.config.config", {"USER_ACLS": ["create_project"]}) @patch("pagure.decorators.admin_session_timedout") def test_add_token_one_token(self, ast): - """ Test the add_token endpoint. """ + """Test the add_token endpoint.""" ast.return_value = False tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -5841,7 +5841,7 @@ index 0000000..fb7093d @patch("pagure.decorators.admin_session_timedout") def test_add_token(self, ast): - """ Test the add_token endpoint. """ + """Test the add_token endpoint.""" ast.return_value = False # No Git repo @@ -5923,7 +5923,7 @@ index 0000000..fb7093d @patch("pagure.decorators.admin_session_timedout") def test_revoke_api_token(self, ast): - """ Test the revoke_api_token endpoint. """ + """Test the revoke_api_token endpoint.""" ast.return_value = False # No Git repo @@ -6022,7 +6022,7 @@ index 0000000..fb7093d @patch("pagure.decorators.admin_session_timedout") def test_renew_api_token(self, ast): - """ Test the renew_api_token endpoint. """ + """Test the renew_api_token endpoint.""" ast.return_value = False # No Git repo @@ -6126,7 +6126,7 @@ index 0000000..fb7093d ) def test_delete_branch(self): - """ Test the delete_branch endpoint. """ + """Test the delete_branch endpoint.""" # No Git repo output = self.app.post("/foo/b/master/delete") self.assertEqual(output.status_code, 404) @@ -6213,7 +6213,7 @@ index 0000000..fb7093d ) def test_delete_branch_unicode(self): - """ Test the delete_branch endpoint with an unicode branch. """ + """Test the delete_branch endpoint with an unicode branch.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -6248,7 +6248,7 @@ index 0000000..fb7093d self.assertNotIn('
Build is running", output_text) def test_view_commit_success_flag(self): - """ Test the view_commit endpoint with a successful flag. """ + """Test the view_commit endpoint with a successful flag.""" repo = pagure.lib.query.get_authorized_project(self.session, "test") msg = pagure.lib.query.add_commit_flag( @@ -149,7 +149,7 @@ class ViewCommitFlagtests(tests.SimplePagureTest): self.assertIn("Build passed", output_text) def test_view_commit_error_flag(self): - """ Test the view_commit endpoint with a error flag. """ + """Test the view_commit endpoint with a error flag.""" repo = pagure.lib.query.get_authorized_project(self.session, "test") msg = pagure.lib.query.add_commit_flag( @@ -194,7 +194,7 @@ class ViewCommitFlagtests(tests.SimplePagureTest): self.assertIn("Build errored", output_text) def test_view_commit_failure_flag(self): - """ Test the view_commit endpoint with a failure flag. """ + """Test the view_commit endpoint with a failure flag.""" repo = pagure.lib.query.get_authorized_project(self.session, "test") msg = pagure.lib.query.add_commit_flag( @@ -238,7 +238,7 @@ class ViewCommitFlagtests(tests.SimplePagureTest): self.assertIn("Build failed", output_text) def test_view_commit_canceled_flag(self): - """ Test the view_commit endpoint with a canceled flag. """ + """Test the view_commit endpoint with a canceled flag.""" repo = pagure.lib.query.get_authorized_project(self.session, "test") msg = pagure.lib.query.add_commit_flag( @@ -291,7 +291,7 @@ class ViewCommitFlagtests(tests.SimplePagureTest): }, ) def test_view_commit_with_custom_flags(self): - """ Test the view_commit endpoint while having custom flags. """ + """Test the view_commit endpoint while having custom flags.""" repo = pagure.lib.query.get_authorized_project(self.session, "test") msg = pagure.lib.query.add_commit_flag( diff --git a/tests/test_pagure_flask_ui_repo_milestones.py b/tests/test_pagure_flask_ui_repo_milestones.py index 094c295..75bd756 100644 --- a/tests/test_pagure_flask_ui_repo_milestones.py +++ b/tests/test_pagure_flask_ui_repo_milestones.py @@ -25,11 +25,11 @@ import tests class PagureFlaskRepoMilestonestests(tests.Modeltests): - """ Tests for milestones in pagure """ + """Tests for milestones in pagure""" @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskRepoMilestonestests, self).setUp() tests.create_projects(self.session) @@ -52,7 +52,7 @@ class PagureFlaskRepoMilestonestests(tests.Modeltests): MagicMock(return_value=False), ) def test_milestones_settings_empty(self): - """ Test the settings page when no milestones are set. """ + """Test the settings page when no milestones are set.""" repo = pagure.lib.query.get_authorized_project(self.session, "test") self.assertEqual(repo.milestones, {}) @@ -96,7 +96,7 @@ class PagureFlaskRepoMilestonestests(tests.Modeltests): MagicMock(return_value=False), ) def test_setting_retrieving_milestones(self): - """ Test setting and retrieving milestones off a project. """ + """Test setting and retrieving milestones off a project.""" repo = pagure.lib.query.get_authorized_project(self.session, "test") diff --git a/tests/test_pagure_flask_ui_repo_mirrored_from.py b/tests/test_pagure_flask_ui_repo_mirrored_from.py index 541972e..e5861ae 100644 --- a/tests/test_pagure_flask_ui_repo_mirrored_from.py +++ b/tests/test_pagure_flask_ui_repo_mirrored_from.py @@ -38,7 +38,7 @@ class PagureUiRepoMirroredFromTests(tests.Modeltests): maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureUiRepoMirroredFromTests, self).setUp() tests.create_projects(self.session) diff --git a/tests/test_pagure_flask_ui_repo_slash_name.py b/tests/test_pagure_flask_ui_repo_slash_name.py index 6210580..5d505ff 100644 --- a/tests/test_pagure_flask_ui_repo_slash_name.py +++ b/tests/test_pagure_flask_ui_repo_slash_name.py @@ -33,11 +33,11 @@ class PagureFlaskSlashInNametests(tests.SimplePagureTest): """Tests for flask application when the project contains a '/'.""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskSlashInNametests, self).setUp() def set_up_git_repo(self, name="test"): - """ Set up the git repo to play with. """ + """Set up the git repo to play with.""" # Create a git repo to play with gitrepo = os.path.join(self.path, "repos", "%s.git" % name) diff --git a/tests/test_pagure_flask_ui_repo_view_blame.py b/tests/test_pagure_flask_ui_repo_view_blame.py index bcf0ccc..78ebaf2 100644 --- a/tests/test_pagure_flask_ui_repo_view_blame.py +++ b/tests/test_pagure_flask_ui_repo_view_blame.py @@ -24,10 +24,10 @@ from pagure.utils import __get_file_in_tree as get_file_in_tree class PagureFlaskRepoViewBlameFileSimpletests(tests.Modeltests): - """ Tests for view_blame_file endpoint of the flask pagure app """ + """Tests for view_blame_file endpoint of the flask pagure app""" def test_view_blame_file_no_project(self): - """ Test the view_blame_file endpoint """ + """Test the view_blame_file endpoint""" output = self.app.get("/foo/blame/sources") # No project registered in the DB self.assertEqual(output.status_code, 404) @@ -39,7 +39,7 @@ class PagureFlaskRepoViewBlameFileSimpletests(tests.Modeltests): self.assertIn("

Project not found

", output_text) def test_view_blame_file_no_git_repo(self): - """ Test the view_blame_file endpoint """ + """Test the view_blame_file endpoint""" tests.create_projects(self.session) output = self.app.get("/test/blame/sources") @@ -47,7 +47,7 @@ class PagureFlaskRepoViewBlameFileSimpletests(tests.Modeltests): self.assertEqual(output.status_code, 404) def test_view_blame_file_no_git_content(self): - """ Test the view_blame_file endpoint """ + """Test the view_blame_file endpoint""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -63,10 +63,10 @@ class PagureFlaskRepoViewBlameFileSimpletests(tests.Modeltests): class PagureFlaskRepoViewBlameFiletests(tests.Modeltests): - """ Tests for view_blame_file endpoint of the flask pagure app """ + """Tests for view_blame_file endpoint of the flask pagure app""" def setUp(self): - """ Set up the environment, ran before every tests. """ + """Set up the environment, ran before every tests.""" super(PagureFlaskRepoViewBlameFiletests, self).setUp() self.regex = re.compile(r'>(\w+)\n') tests.create_projects(self.session) @@ -89,7 +89,7 @@ class PagureFlaskRepoViewBlameFiletests(tests.Modeltests): ) def test_view_blame_file_default_branch_master(self): - """ Test the view_blame_file endpoint """ + """Test the view_blame_file endpoint""" output = self.app.get("/test/blame/sources") self.assertEqual(output.status_code, 200) output_text = output.get_data(as_text=True) @@ -108,7 +108,7 @@ class PagureFlaskRepoViewBlameFiletests(tests.Modeltests): self.assertEqual(len(data), 2) def test_view_blame_file_default_branch_non_master(self): - """ Test the view_blame_file endpoint """ + """Test the view_blame_file endpoint""" repo = pygit2.Repository(os.path.join(self.path, "repos", "test.git")) reference = repo.lookup_reference("refs/heads/feature").resolve() repo.set_head(reference.name) @@ -130,7 +130,7 @@ class PagureFlaskRepoViewBlameFiletests(tests.Modeltests): self.assertEqual(len(data), 3) def test_view_blame_file_on_commit(self): - """ Test the view_blame_file endpoint """ + """Test the view_blame_file endpoint""" repo_obj = pygit2.Repository( os.path.join(self.path, "repos", "test.git") ) @@ -157,7 +157,7 @@ class PagureFlaskRepoViewBlameFiletests(tests.Modeltests): self.assertEqual(len(data), 1) def test_view_blame_file_on_branch(self): - """ Test the view_blame_file endpoint """ + """Test the view_blame_file endpoint""" output = self.app.get("/test/blame/sources?identifier=feature") self.assertEqual(output.status_code, 200) output_text = output.get_data(as_text=True) @@ -176,7 +176,7 @@ class PagureFlaskRepoViewBlameFiletests(tests.Modeltests): self.assertEqual(len(data), 3) def test_view_blame_file_on_tag(self): - """ Test the view_blame_file endpoint """ + """Test the view_blame_file endpoint""" # set a tag on the head's parent commit repo_obj = pygit2.Repository( os.path.join(self.path, "repos", "test.git") @@ -206,7 +206,7 @@ class PagureFlaskRepoViewBlameFiletests(tests.Modeltests): self.assertEqual(len(data), 1) def test_view_blame_file_on_blob(self): - """ Test the view_blame_file endpoint """ + """Test the view_blame_file endpoint""" # Retrieve the blob of the `sources` file in head repo_obj = pygit2.Repository( os.path.join(self.path, "repos", "test.git") @@ -224,7 +224,7 @@ class PagureFlaskRepoViewBlameFiletests(tests.Modeltests): self.assertIn("Invalid identified provided", output_text) def test_view_blame_file_binary(self): - """ Test the view_blame_file endpoint """ + """Test the view_blame_file endpoint""" # Add binary content tests.add_binary_git_repo( os.path.join(self.path, "repos", "test.git"), "test.jpg" @@ -236,7 +236,7 @@ class PagureFlaskRepoViewBlameFiletests(tests.Modeltests): self.assertIn("

Binary files cannot be blamed

", output_text) def test_view_blame_file_non_ascii_name(self): - """ Test the view_blame_file endpoint """ + """Test the view_blame_file endpoint""" tests.add_commit_git_repo( os.path.join(self.path, "repos", "test.git"), ncommits=1, @@ -261,7 +261,7 @@ class PagureFlaskRepoViewBlameFiletests(tests.Modeltests): ) def test_view_blame_file_fork_of_a_fork(self): - """ Test the view_blame_file endpoint """ + """Test the view_blame_file endpoint""" item = pagure.lib.model.Project( user_id=1, # pingou name="test3", @@ -304,7 +304,7 @@ class PagureFlaskRepoViewBlameFiletests(tests.Modeltests): ) def test_view_blame_file_no_file(self): - """ Test the view_blame_file endpoint """ + """Test the view_blame_file endpoint""" output = self.app.get("/test/blame/foofile") self.assertEqual(output.status_code, 404) output_text = output.get_data(as_text=True) @@ -315,7 +315,7 @@ class PagureFlaskRepoViewBlameFiletests(tests.Modeltests): self.assertIn("

File not found

", output_text) def test_view_blame_file_folder(self): - """ Test the view_blame_file endpoint """ + """Test the view_blame_file endpoint""" tests.add_commit_git_repo( os.path.join(self.path, "repos", "test.git/folder1"), ncommits=1, diff --git a/tests/test_pagure_flask_ui_repo_view_file.py b/tests/test_pagure_flask_ui_repo_view_file.py index f2b8441..3e40c52 100644 --- a/tests/test_pagure_flask_ui_repo_view_file.py +++ b/tests/test_pagure_flask_ui_repo_view_file.py @@ -26,10 +26,10 @@ from pagure.lib.repo import PagureRepo # noqa class LocalBasetests(tests.Modeltests): - """ Tests for view_file endpoint of the flask pagure app """ + """Tests for view_file endpoint of the flask pagure app""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(LocalBasetests, self).setUp() pagure.config.config["VIRUS_SCAN_ATTACHMENTS"] = False @@ -40,16 +40,16 @@ class LocalBasetests(tests.Modeltests): class PagureFlaskRepoViewFileSimpletests(LocalBasetests): - """ Tests for view_file endpoint of the flask pagure app """ + """Tests for view_file endpoint of the flask pagure app""" def test_view_file_no_project(self): - """ Test the view_file when the project is unknown. """ + """Test the view_file when the project is unknown.""" output = self.app.get("/foo/blob/foo/f/sources") # No project registered in the DB self.assertEqual(output.status_code, 404) def test_view_file_no_git(self): - """ Test the view_file when the project has no git repo. """ + """Test the view_file when the project has no git repo.""" tests.create_projects(self.session) output = self.app.get("/test/blob/foo/f/sources") @@ -57,7 +57,7 @@ class PagureFlaskRepoViewFileSimpletests(LocalBasetests): self.assertEqual(output.status_code, 404) def test_view_file_no_git_content(self): - """ Test the view_file when the file doesn't exist. """ + """Test the view_file when the file doesn't exist.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -66,10 +66,10 @@ class PagureFlaskRepoViewFileSimpletests(LocalBasetests): class PagureFlaskRepoViewFiletests(LocalBasetests): - """ Tests for view_file endpoint of the flask pagure app """ + """Tests for view_file endpoint of the flask pagure app""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskRepoViewFiletests, self).setUp() tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -87,7 +87,7 @@ class PagureFlaskRepoViewFiletests(LocalBasetests): ) def test_view_file_invalid_file(self): - """ Test the view_file when the file doesn't exist. """ + """Test the view_file when the file doesn't exist.""" output = self.app.get("/test/blob/master/foofile") self.assertEqual(output.status_code, 404) @@ -97,7 +97,7 @@ class PagureFlaskRepoViewFiletests(LocalBasetests): self.assertEqual(output.status_code, 404) def test_view_file_basic_text(self): - """ Test the view_file with a basic text file. """ + """Test the view_file with a basic text file.""" output = self.app.get("/test/blob/master/f/sources") self.assertEqual(output.status_code, 200) output_text = output.get_data(as_text=True) @@ -108,7 +108,7 @@ class PagureFlaskRepoViewFiletests(LocalBasetests): ) def test_view_file_empty_file(self): - """ Test the view_file with an empty file. """ + """Test the view_file with an empty file.""" # Empty files should also be displayed tests.add_content_to_git( @@ -130,7 +130,7 @@ class PagureFlaskRepoViewFiletests(LocalBasetests): ) def test_view_file_binary_file(self): - """ Test the view_file with a binary file. """ + """Test the view_file with a binary file.""" # View what's supposed to be an image output = self.app.get("/test/blob/master/f/test.jpg") @@ -138,7 +138,7 @@ class PagureFlaskRepoViewFiletests(LocalBasetests): self.assertNotIn(b"Project not found

", output_text) def test_view_history_file_no_git_repo(self): - """ Test the view_history_file endpoint """ + """Test the view_history_file endpoint""" tests.create_projects(self.session) output = self.app.get("/test/history/sources") @@ -45,7 +45,7 @@ class PagureFlaskRepoViewHistoryFileSimpletests(tests.Modeltests): self.assertEqual(output.status_code, 404) def test_view_history_file_no_git_content(self): - """ Test the view_history_file endpoint """ + """Test the view_history_file endpoint""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -61,10 +61,10 @@ class PagureFlaskRepoViewHistoryFileSimpletests(tests.Modeltests): class PagureFlaskRepoViewHistoryFiletests(tests.Modeltests): - """ Tests for view_history_file endpoint of the flask pagure app """ + """Tests for view_history_file endpoint of the flask pagure app""" def setUp(self): - """ Set up the environment, ran before every tests. """ + """Set up the environment, ran before every tests.""" super(PagureFlaskRepoViewHistoryFiletests, self).setUp() self.regex = re.compile(r'
Add a fake image file", output_text) def test_view_history_file_non_ascii_name(self): - """ Test the view_history_file endpoint """ + """Test the view_history_file endpoint""" tests.add_commit_git_repo( os.path.join(self.path, "repos", "test.git"), ncommits=1, @@ -181,7 +181,7 @@ class PagureFlaskRepoViewHistoryFiletests(tests.Modeltests): self.assertIn("Add row 0 to Šource file", output_text) def test_view_history_file_fork_of_a_fork(self): - """ Test the view_history_file endpoint """ + """Test the view_history_file endpoint""" item = pagure.lib.model.Project( user_id=1, # pingou name="test3", @@ -216,14 +216,14 @@ class PagureFlaskRepoViewHistoryFiletests(tests.Modeltests): ) def test_view_history_file_no_file(self): - """ Test the view_history_file endpoint """ + """Test the view_history_file endpoint""" output = self.app.get("/test/history/foofile") self.assertEqual(output.status_code, 400) output_text = output.get_data(as_text=True) self.assertIn("No history could be found for this file", output_text) def test_view_history_file_folder(self): - """ Test the view_history_file endpoint """ + """Test the view_history_file endpoint""" tests.add_commit_git_repo( os.path.join(self.path, "repos", "test.git/folder1"), ncommits=1, @@ -235,7 +235,7 @@ class PagureFlaskRepoViewHistoryFiletests(tests.Modeltests): self.assertIn("No history could be found for this file", output_text) def test_view_history_file_existing_folder(self): - """ Test the view_history_file endpoint """ + """Test the view_history_file endpoint""" tests.add_content_to_git( os.path.join(self.path, "repos", "test.git"), folders="foo/bar" ) diff --git a/tests/test_pagure_flask_ui_roadmap.py b/tests/test_pagure_flask_ui_roadmap.py index 1270e1f..f7eaa3b 100644 --- a/tests/test_pagure_flask_ui_roadmap.py +++ b/tests/test_pagure_flask_ui_roadmap.py @@ -31,12 +31,12 @@ from pagure.lib.repo import PagureRepo class PagureFlaskRoadmaptests(tests.Modeltests): - """ Tests for the pagure's roadmap """ + """Tests for the pagure's roadmap""" @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_ticket_with_no_roadmap(self, p_send_email, p_ugt): - """ Test creating a ticket without roadmap. """ + """Test creating a ticket without roadmap.""" p_send_email.return_value = True p_ugt.return_value = True @@ -86,7 +86,7 @@ class PagureFlaskRoadmaptests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_ticket_with_roadmap(self, p_send_email, p_ugt): - """ Test creating a ticket with roadmap. """ + """Test creating a ticket with roadmap.""" p_send_email.return_value = True p_ugt.return_value = True @@ -157,7 +157,7 @@ class PagureFlaskRoadmaptests(tests.Modeltests): ) def test_update_milestones(self): - """ Test updating milestones of a repo. """ + """Test updating milestones of a repo.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -427,7 +427,7 @@ class PagureFlaskRoadmaptests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_milestones_without_dates(self, p_send_email, p_ugt): - """ Test creating two milestones with no dates. """ + """Test creating two milestones with no dates.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) @@ -480,7 +480,7 @@ class PagureFlaskRoadmaptests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_roadmap_ui(self, p_send_email, p_ugt): - """ Test viewing the roadmap of a repo. """ + """Test viewing the roadmap of a repo.""" p_send_email.return_value = True p_ugt.return_value = True diff --git a/tests/test_pagure_flask_ui_slash_branch_name.py b/tests/test_pagure_flask_ui_slash_branch_name.py index 9272968..169158a 100644 --- a/tests/test_pagure_flask_ui_slash_branch_name.py +++ b/tests/test_pagure_flask_ui_slash_branch_name.py @@ -33,7 +33,7 @@ class PagureFlaskSlashInBranchtests(tests.SimplePagureTest): """Tests for flask application when the branch name contains a '/'.""" def set_up_git_repo(self): - """ Set up the git repo to play with. """ + """Set up the git repo to play with.""" # Create a git repo to play with gitrepo = os.path.join(self.path, "repos", "test.git") diff --git a/tests/test_pagure_flask_ui_star_project.py b/tests/test_pagure_flask_ui_star_project.py index ff4e31b..ae5462c 100644 --- a/tests/test_pagure_flask_ui_star_project.py +++ b/tests/test_pagure_flask_ui_star_project.py @@ -26,14 +26,14 @@ import tests class TestStarProjectUI(tests.SimplePagureTest): def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(TestStarProjectUI, self).setUp() tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) def _check_star_count(self, data, stars=1): - """ Check if the star count is correct or not """ + """Check if the star count is correct or not""" output = self.app.get("/test/", data=data, follow_redirects=True) if stars == 1: self.assertIn( @@ -49,7 +49,7 @@ class TestStarProjectUI(tests.SimplePagureTest): ) def test_star_project_no_project(self): - """ Test the star_project endpoint. """ + """Test the star_project endpoint.""" # No such project output = self.app.post("/test42/star/1") @@ -70,7 +70,7 @@ class TestStarProjectUI(tests.SimplePagureTest): self.assertEqual(output.status_code, 400) def test_star_project_invalid_star(self): - """ Test the star_project endpoint for invalid star """ + """Test the star_project endpoint for invalid star""" user = tests.FakeUser() user.username = "pingou" @@ -84,7 +84,7 @@ class TestStarProjectUI(tests.SimplePagureTest): self._check_star_count(data=data, stars=0) def test_star_project_valid_star(self): - """ Test the star_project endpoint for correct star """ + """Test the star_project endpoint for correct star""" user = tests.FakeUser() user.username = "pingou" @@ -115,7 +115,7 @@ class TestStarProjectUI(tests.SimplePagureTest): self._check_star_count(data=data, stars=0) def test_repo_stargazers(self): - """ Test the repo_stargazers endpoint of pagure.ui.repo """ + """Test the repo_stargazers endpoint of pagure.ui.repo""" # make pingou star the project # first create pingou @@ -174,7 +174,7 @@ class TestStarProjectUI(tests.SimplePagureTest): ) def test_user_stars(self): - """ Test the user_stars endpoint of pagure.ui.app """ + """Test the user_stars endpoint of pagure.ui.app""" # Check pingou's stars before output = self.app.get("/user/pingou/stars/") diff --git a/tests/test_pagure_flask_util.py b/tests/test_pagure_flask_util.py index 95902ab..d193a9f 100644 --- a/tests/test_pagure_flask_util.py +++ b/tests/test_pagure_flask_util.py @@ -25,10 +25,10 @@ import tests class PagureUtilSSHPatterntests(tests.Modeltests): - """ Tests for the ssh_urlpattern in pagure.util """ + """Tests for the ssh_urlpattern in pagure.util""" def test_ssh_pattern_valid(self): - """ Test the ssh_urlpattern with valid patterns. """ + """Test the ssh_urlpattern with valid patterns.""" patterns = [ "ssh://user@host.com/repo.git", "git+ssh://user@host.com/repo.git", @@ -43,7 +43,7 @@ class PagureUtilSSHPatterntests(tests.Modeltests): self.assertIsNotNone(ssh_urlpattern.match(pattern)) def test_ssh_pattern_invalid(self): - """ Test the ssh_urlpattern with invalid patterns. """ + """Test the ssh_urlpattern with invalid patterns.""" patterns = [ "http://user@host.com/repo.git", "git+http://user@host.com/repo.git", diff --git a/tests/test_pagure_hooks_pagure_hook.py b/tests/test_pagure_hooks_pagure_hook.py index be629a1..5123efa 100644 --- a/tests/test_pagure_hooks_pagure_hook.py +++ b/tests/test_pagure_hooks_pagure_hook.py @@ -25,10 +25,10 @@ import tests class PagureHooksPagureHooktests(tests.SimplePagureTest): - """ Tests for pagure.hooks.pagure_hook """ + """Tests for pagure.hooks.pagure_hook""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureHooksPagureHooktests, self).setUp() tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) diff --git a/tests/test_pagure_lib.py b/tests/test_pagure_lib.py index 0cf3be9..3401fa0 100644 --- a/tests/test_pagure_lib.py +++ b/tests/test_pagure_lib.py @@ -406,12 +406,12 @@ class PagureLibtests_search_projects(tests.Modeltests): class PagureLibtests(tests.Modeltests): - """ Tests for pagure.lib """ + """Tests for pagure.lib""" maxDiff = None def test_get_repotypes(self): - """ Test the get_repotypes function of pagure.lib.query. """ + """Test the get_repotypes function of pagure.lib.query.""" with patch.dict( pagure.config.config, {"ENABLE_TICKETS": False, "ENABLE_DOCS": False}, @@ -448,14 +448,14 @@ class PagureLibtests(tests.Modeltests): ) def test_get_next_id(self): - """ Test the get_next_id function of pagure.lib.query. """ + """Test the get_next_id function of pagure.lib.query.""" tests.create_projects(self.session) self.assertEqual(1, pagure.lib.query.get_next_id(self.session, 1)) @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_new_issue(self, p_send_email, p_ugt): - """ Test the new_issue of pagure.lib.query. """ + """Test the new_issue of pagure.lib.query.""" p_send_email.return_value = True p_ugt.return_value = True @@ -548,7 +548,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_edit_issue(self, p_send_email, p_ugt): - """ Test the edit_issue of pagure.lib.query. """ + """Test the edit_issue of pagure.lib.query.""" p_send_email.return_value = True p_ugt.return_value = True @@ -675,7 +675,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_edit_issue_close_status(self, p_send_email, p_ugt): - """ Test the edit_issue of pagure.lib.query. """ + """Test the edit_issue of pagure.lib.query.""" p_send_email.return_value = True p_ugt.return_value = True @@ -865,7 +865,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_add_issue_dependency(self): - """ Test the add_issue_dependency of pagure.lib.query. """ + """Test the add_issue_dependency of pagure.lib.query.""" self.test_new_issue() repo = pagure.lib.query._get_project(self.session, "test") @@ -917,7 +917,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_edit_comment(self, mock_redis): - """ Test the edit_issue of pagure.lib.query. """ + """Test the edit_issue of pagure.lib.query.""" mock_redis.return_value = True self.test_add_issue_comment() @@ -954,7 +954,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_edit_comment_private(self, mock_redis): - """ Test the edit_issue of pagure.lib.query. """ + """Test the edit_issue of pagure.lib.query.""" self.test_add_issue_comment_private() @@ -990,7 +990,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) @patch("pagure.lib.query.REDIS") def test_add_tag_obj(self, mock_redis): - """ Test the add_tag_obj of pagure.lib.query. """ + """Test the add_tag_obj of pagure.lib.query.""" mock_redis.return_value = True self.test_edit_issue() @@ -1037,7 +1037,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_remove_tags(self, p_send_email, p_ugt): - """ Test the remove_tags of pagure.lib.query. """ + """Test the remove_tags of pagure.lib.query.""" p_send_email.return_value = True p_ugt.return_value = True @@ -1063,7 +1063,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_remove_tags_obj(self): - """ Test the remove_tags_obj of pagure.lib.query. """ + """Test the remove_tags_obj of pagure.lib.query.""" self.test_add_tag_obj() repo = pagure.lib.query._get_project(self.session, "test") @@ -1077,7 +1077,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_remove_tags_obj_from_project(self, p_send_email, p_ugt): - """ Test the remove_tags_obj of pagure.lib from a project. """ + """Test the remove_tags_obj of pagure.lib from a project.""" p_send_email.return_value = True p_ugt.return_value = True @@ -1109,7 +1109,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_edit_issue_tags(self, p_send_email, p_ugt): - """ Test the edit_issue_tags of pagure.lib.query. """ + """Test the edit_issue_tags of pagure.lib.query.""" p_send_email.return_value = True p_ugt.return_value = True @@ -1211,7 +1211,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_search_issues(self, p_send_email, p_ugt): - """ Test the search_issues of pagure.lib.query. """ + """Test the search_issues of pagure.lib.query.""" p_send_email.return_value = True p_ugt.return_value = True @@ -1297,7 +1297,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_add_issue_assignee(self): - """ Test the add_issue_assignee of pagure.lib.query. """ + """Test the add_issue_assignee of pagure.lib.query.""" self.test_new_issue() repo = pagure.lib.query._get_project(self.session, "test") @@ -1398,7 +1398,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_add_issue_comment(self): - """ Test the add_issue_comment of pagure.lib.query. """ + """Test the add_issue_comment of pagure.lib.query.""" self.test_new_issue() repo = pagure.lib.query._get_project(self.session, "test") @@ -1437,7 +1437,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_add_issue_comment_private(self): - """ Test the add_issue_comment of pagure.lib.query. """ + """Test the add_issue_comment of pagure.lib.query.""" tests.create_projects(self.session) project = pagure.lib.query._get_project(self.session, "test") @@ -1481,7 +1481,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_add_user_to_project(self, p_send_email): - """ Test the add_user_to_project of pagure.lib.query. """ + """Test the add_user_to_project of pagure.lib.query.""" p_send_email.return_value = True tests.create_projects(self.session) @@ -1538,7 +1538,7 @@ class PagureLibtests(tests.Modeltests): self.assertEqual(repo.committers[0].user, "foo") def test_new_project(self): - """ Test the new_project of pagure.lib.query. """ + """Test the new_project of pagure.lib.query.""" gitfolder = os.path.join(self.path, "repos") docfolder = os.path.join(gitfolder, "docs") ticketfolder = os.path.join(gitfolder, "tickets") @@ -1792,7 +1792,7 @@ class PagureLibtests(tests.Modeltests): ) def test_new_project_user_ns(self): - """ Test the new_project of pagure.lib with user_ns on. """ + """Test the new_project of pagure.lib with user_ns on.""" gitfolder = os.path.join(self.path, "repos") docfolder = os.path.join(gitfolder, "docs") ticketfolder = os.path.join(gitfolder, "tickets") @@ -1875,7 +1875,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.notify.log") def test_update_project_settings(self, mock_log): - """ Test the update_project_settings of pagure.lib.query. """ + """Test the update_project_settings of pagure.lib.query.""" tests.create_projects(self.session) @@ -1973,7 +1973,7 @@ class PagureLibtests(tests.Modeltests): self.assertFalse(repo.settings["pull_requests"]) def test_search_issues_milestones_invalid(self): - """ Test the search_issues of pagure.lib.query. """ + """Test the search_issues of pagure.lib.query.""" self.test_edit_issue() repo = pagure.lib.query._get_project(self.session, "test") @@ -1990,7 +1990,7 @@ class PagureLibtests(tests.Modeltests): self.assertEqual(len(issues), 2) def test_search_issues_custom_search(self): - """ Test the search_issues of pagure.lib.query. """ + """Test the search_issues of pagure.lib.query.""" self.test_edit_issue() repo = pagure.lib.query._get_project(self.session, "test") @@ -2002,7 +2002,7 @@ class PagureLibtests(tests.Modeltests): self.assertEqual(len(issues), 0) def test_search_issues_offset(self): - """ Test the search_issues of pagure.lib.query. """ + """Test the search_issues of pagure.lib.query.""" self.test_edit_issue() repo = pagure.lib.query._get_project(self.session, "test") @@ -2016,7 +2016,7 @@ class PagureLibtests(tests.Modeltests): self.assertEqual([i.id for i in issues], [1]) def test_search_issues_tags(self): - """ Test the search_issues of pagure.lib.query. """ + """Test the search_issues of pagure.lib.query.""" self.test_edit_issue() repo = pagure.lib.query._get_project(self.session, "test") @@ -2065,7 +2065,7 @@ class PagureLibtests(tests.Modeltests): self.assertEqual([tag.tag for tag in issues[0].tags], ["tag2"]) def test_get_tags_of_project(self): - """ Test the get_tags_of_project of pagure.lib.query. """ + """Test the get_tags_of_project of pagure.lib.query.""" self.test_add_tag_obj() repo = pagure.lib.query._get_project(self.session, "test") @@ -2084,7 +2084,7 @@ class PagureLibtests(tests.Modeltests): self.assertEqual([tag.tag for tag in tags], []) def test_get_issue_statuses(self): - """ Test the get_issue_statuses of pagure.lib.query. """ + """Test the get_issue_statuses of pagure.lib.query.""" statuses = pagure.lib.query.get_issue_statuses(self.session) self.assertEqual(sorted(statuses), ["Closed", "Open"]) @@ -2092,7 +2092,7 @@ class PagureLibtests(tests.Modeltests): pagure.config.config, {"ALLOWED_EMAIL_DOMAINS": ["fp.o"]}, clear=True ) def test_set_up_user(self): - """ Test the set_up_user of pagure.lib.query. """ + """Test the set_up_user of pagure.lib.query.""" items = pagure.lib.query.search_user(self.session) self.assertEqual(2, len(items)) @@ -2238,7 +2238,7 @@ class PagureLibtests(tests.Modeltests): ) def avatar_url_from_email(self): - """ Test the avatar_url_from_openid of pagure.lib.query. """ + """Test the avatar_url_from_openid of pagure.lib.query.""" output = pagure.lib.query.avatar_url_from_email( "pingou@fedoraproject.org" ) @@ -2258,7 +2258,7 @@ class PagureLibtests(tests.Modeltests): ) def test_fork_project_with_branch(self): - """ Test the fork_project of pagure.lib.query. """ + """Test the fork_project of pagure.lib.query.""" gitfolder = os.path.join(self.path, "repos") docfolder = os.path.join(gitfolder, "docs") ticketfolder = os.path.join(gitfolder, "tickets") @@ -2338,7 +2338,7 @@ class PagureLibtests(tests.Modeltests): ) def test_fork_project_preserves_tags(self): - """ Test the fork_project of pagure.lib.query pushes tags to the fork. """ + """Test the fork_project of pagure.lib.query pushes tags to the fork.""" gitfolder = os.path.join(self.path, "repos") docfolder = os.path.join(gitfolder, "docs") ticketfolder = os.path.join(gitfolder, "tickets") @@ -2417,7 +2417,7 @@ class PagureLibtests(tests.Modeltests): self.assertEqual(tag.message, "release 1.2.3") def test_fork_project_namespaced(self): - """ Test the fork_project of pagure.lib on a namespaced project. """ + """Test the fork_project of pagure.lib on a namespaced project.""" gitfolder = os.path.join(self.path, "repos") docfolder = os.path.join(gitfolder, "docs") ticketfolder = os.path.join(gitfolder, "tickets") @@ -2502,7 +2502,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_new_pull_request(self, mockemail): - """ test new_pull_request of pagure.lib.query. """ + """test new_pull_request of pagure.lib.query.""" mockemail.return_value = True tests.create_projects(self.session) @@ -2574,7 +2574,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.query.REDIS") @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_add_pull_request_comment(self, mock_redis): - """ Test add_pull_request_comment of pagure.lib.query. """ + """Test add_pull_request_comment of pagure.lib.query.""" mock_redis.return_value = True self.test_new_pull_request() @@ -2606,7 +2606,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) @patch("pagure.lib.query.PAGURE_CI", MagicMock(return_value=True)) def test_add_pull_request_comment_to_re_run_ci(self, mock_redis): - """ Test add_pull_request_comment of pagure.lib.query. """ + """Test add_pull_request_comment of pagure.lib.query.""" mock_redis.return_value = True self.test_new_pull_request() @@ -2646,7 +2646,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_add_pull_request_flag(self, mockemail): - """ Test add_pull_request_flag of pagure.lib.query. """ + """Test add_pull_request_flag of pagure.lib.query.""" mockemail.return_value = True self.test_new_pull_request() @@ -2689,7 +2689,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_search_pull_requests(self): - """ Test search_pull_requests of pagure.lib.query. """ + """Test search_pull_requests of pagure.lib.query.""" self.test_new_pull_request() @@ -2799,7 +2799,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_close_pull_request(self, send_email): - """ Test close_pull_request of pagure.lib.query. """ + """Test close_pull_request of pagure.lib.query.""" send_email.return_value = True self.test_new_pull_request() @@ -2838,7 +2838,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.git.update_git", MagicMock(return_value=True)) @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_remove_issue_dependency(self): - """ Test remove_issue_dependency of pagure.lib.query. """ + """Test remove_issue_dependency of pagure.lib.query.""" self.test_add_issue_dependency() repo = pagure.lib.query._get_project(self.session, "test") @@ -2896,7 +2896,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_get_issue_comment(self, p_send_email, p_ugt): - """ Test the get_issue_comment of pagure.lib.query. """ + """Test the get_issue_comment of pagure.lib.query.""" p_send_email.return_value = True p_ugt.return_value = True @@ -2918,7 +2918,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_get_issue_by_uid(self, p_send_email, p_ugt): - """ Test the get_issue_by_uid of pagure.lib.query. """ + """Test the get_issue_by_uid of pagure.lib.query.""" p_send_email.return_value = True p_ugt.return_value = True @@ -2937,7 +2937,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_update_tags(self, p_send_email, p_ugt): - """ Test the update_tags of pagure.lib.query. """ + """Test the update_tags of pagure.lib.query.""" p_send_email.return_value = True p_ugt.return_value = True @@ -2982,7 +2982,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_update_dependency_issue(self, p_send_email, p_ugt): - """ Test the update_dependency_issue of pagure.lib.query. """ + """Test the update_dependency_issue of pagure.lib.query.""" p_send_email.return_value = True p_ugt.return_value = True @@ -3038,7 +3038,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_update_blocked_issue(self, p_send_email, p_ugt): - """ Test the update_blocked_issue of pagure.lib.query. """ + """Test the update_blocked_issue of pagure.lib.query.""" p_send_email.return_value = True p_ugt.return_value = True @@ -3087,7 +3087,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_add_pull_request_assignee(self, mockemail): - """ Test add_pull_request_assignee of pagure.lib.query. """ + """Test add_pull_request_assignee of pagure.lib.query.""" mockemail.return_value = True self.test_new_pull_request() @@ -3127,7 +3127,7 @@ class PagureLibtests(tests.Modeltests): self.assertEqual(msg, None) def test_search_pending_email(self): - """ Test search_pending_email of pagure.lib.query. """ + """Test search_pending_email of pagure.lib.query.""" self.assertEqual( pagure.lib.query.search_pending_email(self.session), None @@ -3166,7 +3166,7 @@ class PagureLibtests(tests.Modeltests): self.assertEqual(pend.token, "abcdef") def test_generate_hook_token(self): - """ Test generate_hook_token of pagure.lib.query. """ + """Test generate_hook_token of pagure.lib.query.""" tests.create_projects(self.session) @@ -3186,7 +3186,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.notify.send_email") def test_pull_request_score(self, mockemail): - """ Test PullRequest.score of pagure.lib.model. """ + """Test PullRequest.score of pagure.lib.model.""" mockemail.return_value = True self.test_new_pull_request() @@ -3238,7 +3238,7 @@ class PagureLibtests(tests.Modeltests): self.assertEqual(request.score, 2) def test_add_group(self): - """ Test the add_group method of pagure.lib.query. """ + """Test the add_group method of pagure.lib.query.""" groups = pagure.lib.query.search_groups(self.session) self.assertEqual(len(groups), 0) self.assertEqual(groups, []) @@ -3354,7 +3354,7 @@ class PagureLibtests(tests.Modeltests): ) def test_add_user_to_group(self): - """ Test the add_user_to_group method of pagure.lib.query. """ + """Test the add_user_to_group method of pagure.lib.query.""" self.test_add_group() group = pagure.lib.query.search_groups(self.session, group_name="foo") self.assertNotEqual(group, None) @@ -3416,7 +3416,7 @@ class PagureLibtests(tests.Modeltests): ) def test_is_group_member(self): - """ Test the is_group_member method of pagure.lib.query. """ + """Test the is_group_member method of pagure.lib.query.""" self.test_add_group() self.assertFalse( @@ -3436,7 +3436,7 @@ class PagureLibtests(tests.Modeltests): ) def test_get_user_group(self): - """ Test the get_user_group method of pagure.lib.query. """ + """Test the get_user_group method of pagure.lib.query.""" self.test_add_group() @@ -3451,7 +3451,7 @@ class PagureLibtests(tests.Modeltests): self.assertEqual(item, None) def test_get_group_types(self): - """ Test the get_group_types method of pagure.lib.query. """ + """Test the get_group_types method of pagure.lib.query.""" self.test_add_group() @@ -3465,7 +3465,7 @@ class PagureLibtests(tests.Modeltests): self.assertEqual(groups[1].group_type, "user") def test_search_groups(self): - """ Test the search_groups method of pagure.lib.query. """ + """Test the search_groups method of pagure.lib.query.""" self.assertEqual(pagure.lib.query.search_groups(self.session), []) @@ -3520,7 +3520,7 @@ class PagureLibtests(tests.Modeltests): self.assertEqual(groups.group_name, "foo") def test_delete_user_of_group(self): - """ Test the delete_user_of_group method of pagure.lib.query. """ + """Test the delete_user_of_group method of pagure.lib.query.""" self.test_add_user_to_group() groups = pagure.lib.query.search_groups(self.session) @@ -3621,7 +3621,7 @@ class PagureLibtests(tests.Modeltests): self.assertEqual(len(group.users), 1) def test_edit_group_info(self): - """ Test the edit_group_info method of pagure.lib.query. """ + """Test the edit_group_info method of pagure.lib.query.""" self.test_add_group() group = pagure.lib.query.search_groups(self.session, group_name="foo") self.assertNotEqual(group, None) @@ -3686,7 +3686,7 @@ class PagureLibtests(tests.Modeltests): self.assertEqual(msg, "Nothing changed") def test_add_group_to_project(self): - """ Test the add_group_to_project method of pagure.lib.query. """ + """Test the add_group_to_project method of pagure.lib.query.""" tests.create_projects(self.session) self.test_add_group() @@ -3796,7 +3796,7 @@ class PagureLibtests(tests.Modeltests): self.assertEqual(project.committer_groups[0].group_name, "bar") def test_update_watch_status(self): - """ Test the update_watch_status method of pagure.lib.query. """ + """Test the update_watch_status method of pagure.lib.query.""" tests.create_projects(self.session) project = pagure.lib.query._get_project(self.session, "test") @@ -3852,7 +3852,7 @@ class PagureLibtests(tests.Modeltests): self.assertEqual(msg, "Watch status reset") def test_get_watch_level_on_repo_invalid(self): - """ test the get_watch_level_on_repo method of pagure.lib.query. """ + """test the get_watch_level_on_repo method of pagure.lib.query.""" self.assertRaises( RuntimeError, @@ -3865,7 +3865,7 @@ class PagureLibtests(tests.Modeltests): ) def test_get_watch_level_on_repo(self): - """ Test the get_watch_level_on_repo method of pagure.lib.query. """ + """Test the get_watch_level_on_repo method of pagure.lib.query.""" tests.create_projects(self.session) self.test_add_group() @@ -4035,7 +4035,7 @@ class PagureLibtests(tests.Modeltests): self.assertEqual(watch_level, []) def test_user_watch_list(self): - """ test user watch list method of pagure.lib """ + """test user watch list method of pagure.lib""" tests.create_projects(self.session) @@ -4086,7 +4086,7 @@ class PagureLibtests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) @patch("pagure.pfmarkdown._commit_exists", MagicMock(return_value=True)) def test_text2markdown(self): - """ Test the text2markdown method in pagure.lib.query. """ + """Test the text2markdown method in pagure.lib.query.""" pagure.config.config["TESTING"] = True pagure.config.config["SERVER_NAME"] = "localhost.localdomain" @@ -4403,7 +4403,7 @@ class PagureLibtests(tests.Modeltests): self.assertEqual(html, expected[idx]) def test_text2markdown_exception(self): - """ Test the text2markdown method in pagure.lib.query. """ + """Test the text2markdown method in pagure.lib.query.""" text = "test#1 bazinga!" expected_html = "test#1 bazinga!" @@ -4413,7 +4413,7 @@ class PagureLibtests(tests.Modeltests): self.assertEqual(html, expected_html) def test_text2markdown_empty_string(self): - """ Test the text2markdown method in pagure.lib.query. """ + """Test the text2markdown method in pagure.lib.query.""" text = "" expected_html = "" @@ -4422,7 +4422,7 @@ class PagureLibtests(tests.Modeltests): self.assertEqual(html, expected_html) def test_get_access_levels(self): - """ Test the get_access_levels method in pagure.lib """ + """Test the get_access_levels method in pagure.lib""" acls = pagure.lib.query.get_access_levels(self.session) self.assertEqual( @@ -5022,7 +5022,7 @@ class PagureLibtests(tests.Modeltests): self.assertEqual(access_obj.access, "ticket") def test_set_watch_obj(self): - """ Test the set_watch_obj method in pagure.lib """ + """Test the set_watch_obj method in pagure.lib""" # Create the project ns/test item = pagure.lib.model.Project( user_id=1, # pingou @@ -5087,7 +5087,7 @@ class PagureLibtests(tests.Modeltests): self.assertEqual(out, "You are no longer watching this issue") def test_tokenize_search_string(self): - """ Test the tokenize_search_string function. """ + """Test the tokenize_search_string function.""" # These are the tests performed to make sure we tokenize correctly. # This is in the form: input string, custom fields, remaining pattern tests = [ @@ -5111,7 +5111,7 @@ class PagureLibtests(tests.Modeltests): ) def test_save_report(self): - """ Test the save_report function. """ + """Test the save_report function.""" # Create the projects tests.create_projects(self.session) @@ -5153,7 +5153,7 @@ class PagureLibtests(tests.Modeltests): ) def test_text2markdown_table(self): - """ Test the text2markdown function with a markdown table. """ + """Test the text2markdown function with a markdown table.""" try: md_version = markdown.__version__.version_info except AttributeError: @@ -5245,20 +5245,20 @@ foo bar self.assertEqual(html, expected) def test_set_redis(self): - """ Test the set_redis function of pagure.lib.query. """ + """Test the set_redis function of pagure.lib.query.""" self.assertIsNone(pagure.lib.query.REDIS) pagure.lib.query.set_redis("0.0.0.0", 6379, 0) self.assertIsNotNone(pagure.lib.query.REDIS) def test_set_pagure_ci(self): - """ Test the set_pagure_ci function of pagure.lib.query. """ + """Test the set_pagure_ci function of pagure.lib.query.""" # self.assertIn(pagure.lib.query.PAGURE_CI, [None, ['jenkins']]) pagure.lib.query.set_pagure_ci(True) self.assertIsNotNone(pagure.lib.query.PAGURE_CI) self.assertTrue(pagure.lib.query.PAGURE_CI) def test_get_user_invalid_user(self): - """ Test the get_user function of pagure.lib.query. """ + """Test the get_user function of pagure.lib.query.""" self.assertRaises( pagure.exceptions.PagureException, pagure.lib.query.get_user, @@ -5267,25 +5267,25 @@ foo bar ) def test_get_user_username(self): - """ Test the get_user function of pagure.lib.query. """ + """Test the get_user function of pagure.lib.query.""" user = pagure.lib.query.get_user(self.session, "foo") self.assertEqual(user.username, "foo") def test_get_user_email(self): - """ Test the get_user function of pagure.lib.query. """ + """Test the get_user function of pagure.lib.query.""" user = pagure.lib.query.get_user(self.session, "bar@pingou.com") self.assertEqual(user.username, "pingou") def test_is_valid_ssh_key_empty(self): - """ Test the is_valid_ssh_key function of pagure.lib.query. """ + """Test the is_valid_ssh_key function of pagure.lib.query.""" self.assertIsNone(pagure.lib.query.is_valid_ssh_key("")) def test_is_valid_ssh_key_invalid(self): - """ Test the is_valid_ssh_key function of pagure.lib.query. """ + """Test the is_valid_ssh_key function of pagure.lib.query.""" self.assertEqual(pagure.lib.query.is_valid_ssh_key("nonsense"), False) def test_is_valid_ssh_key(self): - """ Test the is_valid_ssh_key function of pagure.lib.query. """ + """Test the is_valid_ssh_key function of pagure.lib.query.""" keyinfo = pagure.lib.query.is_valid_ssh_key( """ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDtgzSO9d1IrKdmyBFUvtAJPLgGOhp0lSySkWRSe+/+3KXYjSnsLnCJQlO5M7JfaXhtTHEow86rh4W9+FoJdzo5iocAwH5xPZ5ttHLy7VHgTzNMUeMgKpjy6bBOdPoGPPG4mo7QCMCRJdWBRDv4OSEMLU5jQAvC272YK2V8L918VQ== root@test""" ) @@ -5446,13 +5446,13 @@ foo bar ) def test_create_user_ssh_keys_on_disk_none(self): - """ Test the create_user_ssh_keys_on_disk function of pagure.lib.query. """ + """Test the create_user_ssh_keys_on_disk function of pagure.lib.query.""" self.assertIsNone( pagure.lib.query.create_user_ssh_keys_on_disk(None, None) ) def test_update_user_settings_invalid_user(self): - """ Test the update_user_settings function of pagure.lib.query. """ + """Test the update_user_settings function of pagure.lib.query.""" self.assertRaises( pagure.exceptions.PagureException, pagure.lib.query.update_user_settings, @@ -5462,7 +5462,7 @@ foo bar ) def test_update_user_settings_no_change(self): - """ Test the update_user_settings function of pagure.lib.query. """ + """Test the update_user_settings function of pagure.lib.query.""" # First update the setting msg = pagure.lib.query.update_user_settings( @@ -5479,7 +5479,7 @@ foo bar self.assertEqual(msg, "Successfully edited your settings") def test_update_user_settings_no_data(self): - """ Test the update_user_settings function of pagure.lib.query. """ + """Test the update_user_settings function of pagure.lib.query.""" msg = pagure.lib.query.update_user_settings( session=self.session, @@ -5489,7 +5489,7 @@ foo bar self.assertEqual(msg, "No settings to change") def test_update_user_settings(self): - """ Test the update_user_settings function of pagure.lib.query. """ + """Test the update_user_settings function of pagure.lib.query.""" msg = pagure.lib.query.update_user_settings( session=self.session, @@ -5572,7 +5572,7 @@ foo bar "pagure.lib.query.is_valid_ssh_key", MagicMock(return_value="foo bar") ) def test_update_user_ssh_valid_key(self): - """ Test the update_user_ssh function of pagure.lib.query. """ + """Test the update_user_ssh function of pagure.lib.query.""" pagure.SESSION = self.session pagure.lib.query.update_user_ssh( @@ -5586,7 +5586,7 @@ foo bar ) def test_add_user_pending_email_existing_email(self): - """ Test the add_user_pending_email function of pagure.lib.query. """ + """Test the add_user_pending_email function of pagure.lib.query.""" user = pagure.lib.query.search_user(self.session, username="pingou") self.assertRaises( @@ -5604,7 +5604,7 @@ foo bar clear=True, ) def test_add_user_pending_email(self): - """ Test the add_user_pending_email function of pagure.lib.query. """ + """Test the add_user_pending_email function of pagure.lib.query.""" user = pagure.lib.query.search_user(self.session, username="pingou") self.assertEqual(len(user.emails), 2) @@ -5631,7 +5631,7 @@ foo bar self.assertEqual(len(user.emails_pending), 1) def test_resend_pending_email_someone_else_email(self): - """ Test the resend_pending_email function of pagure.lib.query. """ + """Test the resend_pending_email function of pagure.lib.query.""" user = pagure.lib.query.search_user(self.session, username="pingou") self.assertRaises( @@ -5643,7 +5643,7 @@ foo bar ) def test_resend_pending_email_email_validated(self): - """ Test the resend_pending_email function of pagure.lib.query. """ + """Test the resend_pending_email function of pagure.lib.query.""" user = pagure.lib.query.search_user(self.session, username="pingou") self.assertRaises( @@ -5655,7 +5655,7 @@ foo bar ) def test_get_acls(self): - """ Test the get_acls function of pagure.lib.query. """ + """Test the get_acls function of pagure.lib.query.""" acls = pagure.lib.query.get_acls(self.session) self.assertEqual( sorted([a.name for a in acls]), @@ -5694,14 +5694,14 @@ foo bar ) def test_get_acls_restrict_one(self): - """ Test the get_acls function of pagure.lib.query. """ + """Test the get_acls function of pagure.lib.query.""" acls = pagure.lib.query.get_acls( self.session, restrict="create_project" ) self.assertEqual([a.name for a in acls], ["create_project"]) def test_get_acls_restrict_two(self): - """ Test the get_acls function of pagure.lib.query. """ + """Test the get_acls function of pagure.lib.query.""" acls = pagure.lib.query.get_acls( self.session, restrict=["create_project", "issue_create"] ) @@ -5710,7 +5710,7 @@ foo bar ) def test_filter_img_src(self): - """ Test the filter_img_src function of pagure.lib.query. """ + """Test the filter_img_src function of pagure.lib.query.""" for name in ("alt", "height", "width", "class"): self.assertTrue(pagure.lib.query.filter_img_src(name, "caption")) @@ -5735,13 +5735,13 @@ foo bar ) def test_clean_input(self): - """ Test the clean_input function of pagure.lib.query. """ + """Test the clean_input function of pagure.lib.query.""" text = 'Click here' output = pagure.lib.query.clean_input(text) self.assertEqual(output, text) def test_could_be_text(self): - """ Test the could_be_text function of pagure.lib.query. """ + """Test the could_be_text function of pagure.lib.query.""" self.assertTrue(pagure.lib.query.could_be_text(b"foo")) self.assertTrue(pagure.lib.query.could_be_text("fâö".encode("utf-8"))) self.assertFalse( @@ -5749,7 +5749,7 @@ foo bar ) def test_set_custom_key_fields_empty(self): - """ Test the set_custom_key_fields function of pagure.lib.query. """ + """Test the set_custom_key_fields function of pagure.lib.query.""" tests.create_projects(self.session) project = pagure.lib.query._get_project(self.session, "test") self.assertIsNotNone(project) @@ -5766,7 +5766,7 @@ foo bar self.assertEqual(msg, "List of custom fields updated") def test_set_custom_key_fields(self): - """ Test the set_custom_key_fields function of pagure.lib.query. """ + """Test the set_custom_key_fields function of pagure.lib.query.""" tests.create_projects(self.session) project = pagure.lib.query._get_project(self.session, "test") self.assertIsNotNone(project) @@ -5809,7 +5809,7 @@ foo bar @patch("pagure.lib.query.REDIS") def test_set_custom_key_value_boolean(self, mock_redis): - """ Test the set_custom_key_value function of pagure.lib.query. """ + """Test the set_custom_key_value function of pagure.lib.query.""" mock_redis.return_value = True tests.create_projects(self.session) @@ -5870,7 +5870,7 @@ foo bar @patch("pagure.lib.query.REDIS") def test_set_custom_key_value_boolean_private_issue(self, mock_redis): - """ Test the set_custom_key_value function of pagure.lib.query. """ + """Test the set_custom_key_value function of pagure.lib.query.""" mock_redis.return_value = True tests.create_projects(self.session) @@ -5933,7 +5933,7 @@ foo bar @patch("pagure.lib.query.REDIS") def test_set_custom_key_value_text(self, mock_redis): - """ Test the set_custom_key_value function of pagure.lib.query. """ + """Test the set_custom_key_value function of pagure.lib.query.""" mock_redis.return_value = True tests.create_projects(self.session) @@ -5992,7 +5992,7 @@ foo bar self.assertEqual(mock_redis.publish.call_count, 2) def test_log_action_invalid(self): - """ Test the log_action function of pagure.lib.query. """ + """Test the log_action function of pagure.lib.query.""" obj = MagicMock obj.isa = "invalid" self.assertRaises( @@ -6005,7 +6005,7 @@ foo bar ) def test_search_token_no_acls(self): - """ Test the search_token function of pagure.lib.query. """ + """Test the search_token function of pagure.lib.query.""" tests.create_projects(self.session) tests.create_tokens(self.session) tests.create_tokens_acl(self.session) @@ -6015,7 +6015,7 @@ foo bar self.assertEqual(out[0].id, "aaabbbcccddd") def test_search_token_single_acls(self): - """ Test the search_token function of pagure.lib.query. """ + """Test the search_token function of pagure.lib.query.""" tests.create_projects(self.session) tests.create_tokens(self.session) tests.create_tokens_acl(self.session) @@ -6025,7 +6025,7 @@ foo bar self.assertEqual(out[0].id, "aaabbbcccddd") def test_search_token_single_acls_user(self): - """ Test the search_token function of pagure.lib.query. """ + """Test the search_token function of pagure.lib.query.""" tests.create_projects(self.session) tests.create_tokens(self.session) tests.create_tokens_acl(self.session) @@ -6042,7 +6042,7 @@ foo bar self.assertEqual(len(out), 0) def test_search_token_single_acls_active(self): - """ Test the search_token function of pagure.lib.query. """ + """Test the search_token function of pagure.lib.query.""" tests.create_projects(self.session) tests.create_tokens(self.session) tests.create_tokens_acl(self.session) @@ -6059,7 +6059,7 @@ foo bar self.assertEqual(len(out), 0) def test_update_read_only_mode(self): - """ Test the update_read_only_mode method of pagure.lib """ + """Test the update_read_only_mode method of pagure.lib""" tests.create_projects(self.session) diff --git a/tests/test_pagure_lib_add_user_to_project.py b/tests/test_pagure_lib_add_user_to_project.py index c5aa1ec..ba3de2b 100644 --- a/tests/test_pagure_lib_add_user_to_project.py +++ b/tests/test_pagure_lib_add_user_to_project.py @@ -25,10 +25,10 @@ import tests class PagureLibAddUserToProjecttests(tests.Modeltests): - """ Tests for pagure.lib.query.add_user_to_project """ + """Tests for pagure.lib.query.add_user_to_project""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureLibAddUserToProjecttests, self).setUp() tests.create_projects(self.session) @@ -63,7 +63,7 @@ class PagureLibAddUserToProjecttests(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_re_add_user_to_project_default(self): - """ Update an existing user but to the same access level. """ + """Update an existing user but to the same access level.""" repo = pagure.lib.query._get_project(self.session, "test") # Try adding the same user with the same access @@ -223,10 +223,10 @@ class PagureLibAddUserToProjecttests(tests.Modeltests): class PagureLibAddUserToProjectWithGrouptests(PagureLibAddUserToProjecttests): - """ Tests for pagure.lib.query.add_user_to_project """ + """Tests for pagure.lib.query.add_user_to_project""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureLibAddUserToProjectWithGrouptests, self).setUp() # Create group diff --git a/tests/test_pagure_lib_drop_issue.py b/tests/test_pagure_lib_drop_issue.py index e60b0a6..056f2a8 100644 --- a/tests/test_pagure_lib_drop_issue.py +++ b/tests/test_pagure_lib_drop_issue.py @@ -27,7 +27,7 @@ import tests class PagureLibDropIssuetests(tests.Modeltests): - """ Tests for pagure.lib.query.drop_issue """ + """Tests for pagure.lib.query.drop_issue""" @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") diff --git a/tests/test_pagure_lib_encoding_utils.py b/tests/test_pagure_lib_encoding_utils.py index cc3ac4b..dad98c9 100644 --- a/tests/test_pagure_lib_encoding_utils.py +++ b/tests/test_pagure_lib_encoding_utils.py @@ -56,14 +56,14 @@ class TestGuessEncoding(unittest.TestCase): self.assertEqual(chardet_result["encoding"], "ISO-8859-2") def test_guess_encoding_no_data(self): - """ Test encoding_utils.guess_encoding() with an empty string """ + """Test encoding_utils.guess_encoding() with an empty string""" result = encoding_utils.guess_encoding("".encode("utf-8")) self.assertEqual(result, "ascii") class TestGuessEncodings(unittest.TestCase): def test_guess_encodings(self): - """ Test the encoding_utils.guess_encodings() method. """ + """Test the encoding_utils.guess_encodings() method.""" data = "Šabata".encode("utf-8") result = encoding_utils.guess_encodings(data) chardet_result = chardet.detect(data) @@ -120,14 +120,14 @@ class TestGuessEncodings(unittest.TestCase): self.assertEqual(chardet_result["encoding"], "ISO-8859-2") def test_guess_encodings_no_data(self): - """ Test encoding_utils.guess_encodings() with an emtpy string """ + """Test encoding_utils.guess_encodings() with an emtpy string""" result = encoding_utils.guess_encodings("".encode("utf-8")) self.assertEqual([encoding.encoding for encoding in result], ["ascii"]) class TestDecode(unittest.TestCase): def test_decode(self): - """ Test encoding_utils.decode() """ + """Test encoding_utils.decode()""" data = ( "This is a little longer text for testing Šabata's encoding. " "With more characters, let's see if it become more clear as to what " diff --git a/tests/test_pagure_lib_git.py b/tests/test_pagure_lib_git.py index 1840a46..57eace9 100644 --- a/tests/test_pagure_lib_git.py +++ b/tests/test_pagure_lib_git.py @@ -33,7 +33,7 @@ from pagure.lib.repo import PagureRepo class PagureLibGittests(tests.Modeltests): - """ Tests for pagure.lib.git """ + """Tests for pagure.lib.git""" maxDiff = None @@ -365,7 +365,7 @@ repo requests/somenamespace/test3 self.assertFalse(os.path.exists(outputconf)) def test_write_gitolite_acls_deploykeys(self): - """ Test write_gitolite_acls function to add deploy keys. """ + """Test write_gitolite_acls function to add deploy keys.""" tests.create_projects(self.session) repo = pagure.lib.query.get_authorized_project(self.session, "test") @@ -1362,7 +1362,7 @@ repo requests/forks/pingou/test3 @patch("pagure.lib.notify.send_email") def test_update_git(self, email_f): - """ Test the update_git of pagure.lib.git. """ + """Test the update_git of pagure.lib.git.""" email_f.return_value = True # Create project @@ -1594,7 +1594,7 @@ index 458821a..77674a8 self.assertEqual(commit_patch, exp) def test_clean_git(self): - """ Test the clean_git method of pagure.lib.git. """ + """Test the clean_git method of pagure.lib.git.""" self.test_update_git() gitpath = os.path.join( @@ -1628,7 +1628,7 @@ index 458821a..77674a8 @patch("pagure.lib.notify.send_email") def test_update_git_requests(self, email_f): - """ Test the update_git of pagure.lib.git for pull-requests. """ + """Test the update_git of pagure.lib.git for pull-requests.""" email_f.return_value = True # Create project @@ -1892,7 +1892,7 @@ index 0000000..60f7480 self.assertEqual(patch, exp) def test_update_ticket_from_git_no_priority(self): - """ Test the update_ticket_from_git method from pagure.lib.git. """ + """Test the update_ticket_from_git method from pagure.lib.git.""" tests.create_projects(self.session) repo = pagure.lib.query.get_authorized_project(self.session, "test") @@ -1997,7 +1997,7 @@ index 0000000..60f7480 @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_update_ticket_from_git_close_ticket(self): - """ Test the update_ticket_from_git method from pagure.lib.git. """ + """Test the update_ticket_from_git method from pagure.lib.git.""" tests.create_projects(self.session) repo = pagure.lib.query.get_authorized_project(self.session, "test") @@ -2081,7 +2081,7 @@ index 0000000..60f7480 ) def test_update_ticket_from_git(self): - """ Test the update_ticket_from_git method from pagure.lib.git. """ + """Test the update_ticket_from_git method from pagure.lib.git.""" tests.create_projects(self.session) repo = pagure.lib.query.get_authorized_project(self.session, "test") @@ -2268,7 +2268,7 @@ index 0000000..60f7480 ) def test_update_request_from_git(self): - """ Test the update_request_from_git method from pagure.lib.git. """ + """Test the update_request_from_git method from pagure.lib.git.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos")) @@ -2667,7 +2667,7 @@ index 0000000..60f7480 ) def test_update_ticket_from_git_with_boards(self): - """ Test the update_ticket_from_git method from pagure.lib.git. """ + """Test the update_ticket_from_git method from pagure.lib.git.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos")) @@ -2801,7 +2801,7 @@ index 0000000..60f7480 self.assertEqual(len(namespaced_repo.boards), 1) def test_update_ticket_from_git_with_boards_twice(self): - """ Test the update_ticket_from_git method from pagure.lib.git. """ + """Test the update_ticket_from_git method from pagure.lib.git.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos")) @@ -2963,7 +2963,7 @@ index 0000000..60f7480 self.assertEqual(len(namespaced_repo.boards), 1) def test_update_request_from_git(self): - """ Test the update_request_from_git method from pagure.lib.git. """ + """Test the update_request_from_git method from pagure.lib.git.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos")) @@ -3086,7 +3086,7 @@ index 0000000..60f7480 self.assertEqual(repo.requests[0].tags_text, ["WIP", "core"]) def test_read_git_lines(self): - """ Test the read_git_lines method of pagure.lib.git. """ + """Test the read_git_lines method of pagure.lib.git.""" self.test_update_git() gitrepo = os.path.join( @@ -3107,7 +3107,7 @@ index 0000000..60f7480 self.assertTrue(output[0].endswith(": Test issue'\n")) def test_get_revs_between(self): - """ Test the get_revs_between method of pagure.lib.git. """ + """Test the get_revs_between method of pagure.lib.git.""" self.test_update_git() @@ -3179,7 +3179,7 @@ index 0000000..60f7480 self.assertEqual(output4, [branch_commit.oid.hex]) def test_get_author(self): - """ Test the get_author method of pagure.lib.git. """ + """Test the get_author method of pagure.lib.git.""" self.test_update_git() @@ -3196,7 +3196,7 @@ index 0000000..60f7480 self.assertEqual(output, "pagure") def get_author_email(self): - """ Test the get_author_email method of pagure.lib.git. """ + """Test the get_author_email method of pagure.lib.git.""" self.test_update_git() @@ -3211,7 +3211,7 @@ index 0000000..60f7480 self.assertEqual(output, "pagure") def test_get_repo_name(self): - """ Test the get_repo_name method of pagure.lib.git. """ + """Test the get_repo_name method of pagure.lib.git.""" def runtest(reponame, *path): gitrepo = os.path.join(self.path, "repos", *path) @@ -3224,7 +3224,7 @@ index 0000000..60f7480 runtest("foo.test", "foo.test.git") def test_get_username(self): - """ Test the get_username method of pagure.lib.git. """ + """Test the get_username method of pagure.lib.git.""" def runtest(username, *path): gitrepo = os.path.join(self.path, "repos", *path) @@ -3239,7 +3239,7 @@ index 0000000..60f7480 runtest("pingou", "forks", "pingou", "bar/foo.test.git") def test_get_repo_namespace(self): - """ Test the get_repo_namespace method of pagure.lib.git. """ + """Test the get_repo_namespace method of pagure.lib.git.""" def runtest(namespace, *path): gitrepo = os.path.join(self.path, "repos", *path) @@ -3257,7 +3257,7 @@ index 0000000..60f7480 runtest("bar", "forks", "user", "bar", "foo.test.git") def test_update_custom_fields_from_json(self): - """ Test the update_custom_fields_from_json method of lib.git """ + """Test the update_custom_fields_from_json method of lib.git""" tests.create_projects(self.session) repo = pagure.lib.query._get_project(self.session, "test") @@ -3526,7 +3526,7 @@ index 0000000..60f7480 @patch("subprocess.Popen") def test_generate_gitolite_acls(self, popen): - """ Test calling generate_gitolite_acls. """ + """Test calling generate_gitolite_acls.""" pagure.SESSION = self.session pagure.lib.git.SESSION = self.session pagure.config.config["GITOLITE_HOME"] = "/tmp" @@ -3611,12 +3611,12 @@ index 0000000..60f7480 class PagureLibGitCommitToPatchtests(tests.Modeltests): - """ Tests for pagure.lib.git """ + """Tests for pagure.lib.git""" maxDiff = None def setUp(self): - """ Set up the environment for the tests. """ + """Set up the environment for the tests.""" super(PagureLibGitCommitToPatchtests, self).setUp() # Create a git repo to play with @@ -3686,7 +3686,7 @@ class PagureLibGitCommitToPatchtests(tests.Modeltests): self.third_commit = repo.revparse_single("HEAD") def test_commit_to_patch_first_commit(self): - """ Test the commit_to_patch function of pagure.lib.git. """ + """Test the commit_to_patch function of pagure.lib.git.""" repo = pygit2.init_repository(self.gitrepo) patch = pagure.lib.git.commit_to_patch(repo, self.first_commit) @@ -3720,7 +3720,7 @@ index 0000000..9f44358 self.assertEqual(patch, exp) def test_commit_to_patch_single_commit(self): - """ Test the commit_to_patch function of pagure.lib.git. """ + """Test the commit_to_patch function of pagure.lib.git.""" repo = pygit2.init_repository(self.gitrepo) patch = pagure.lib.git.commit_to_patch(repo, self.second_commit) @@ -3758,7 +3758,7 @@ index 9f44358..2a552bb 100644 self.assertEqual(patch, exp) def test_commit_to_patch_2_commits(self): - """ Test the commit_to_patch function of pagure.lib.git. """ + """Test the commit_to_patch function of pagure.lib.git.""" repo = pygit2.init_repository(self.gitrepo) patch = pagure.lib.git.commit_to_patch( @@ -3815,7 +3815,7 @@ index 9f44358..2a552bb 100644 self.assertEqual(patch, exp) def test_commit_to_patch_first_commit_diff(self): - """ Test the commit_to_patch function of pagure.lib.git. """ + """Test the commit_to_patch function of pagure.lib.git.""" repo = pygit2.init_repository(self.gitrepo) patch = pagure.lib.git.commit_to_patch( @@ -3843,7 +3843,7 @@ index 0000000..9f44358 self.assertEqual(patch, exp) def test_commit_to_patch_single_commit_diff(self): - """ Test the commit_to_patch function of pagure.lib.git. """ + """Test the commit_to_patch function of pagure.lib.git.""" repo = pygit2.init_repository(self.gitrepo) patch = pagure.lib.git.commit_to_patch( @@ -3874,7 +3874,7 @@ index 9f44358..2a552bb 100644 self.assertEqual(patch, exp) def test_commit_to_patch_two_commits_diff(self): - """ Test the commit_to_patch function of pagure.lib.git. """ + """Test the commit_to_patch function of pagure.lib.git.""" repo = pygit2.init_repository(self.gitrepo) patch = pagure.lib.git.commit_to_patch( @@ -3914,7 +3914,7 @@ index 9f44358..2a552bb 100644 self.assertEqual(patch, exp) def test_commit_to_patch_first_commit_diff_separated(self): - """ Test the commit_to_patch function of pagure.lib.git. """ + """Test the commit_to_patch function of pagure.lib.git.""" repo = pygit2.init_repository(self.gitrepo) patches = pagure.lib.git.commit_to_patch( @@ -3946,7 +3946,7 @@ index 0000000..9f44358 self.assertEqual(output, [exp]) def test_commit_to_patch_single_commit_diff_separated(self): - """ Test the commit_to_patch function of pagure.lib.git. """ + """Test the commit_to_patch function of pagure.lib.git.""" repo = pygit2.init_repository(self.gitrepo) patches = pagure.lib.git.commit_to_patch( @@ -3981,7 +3981,7 @@ index 9f44358..2a552bb 100644 self.assertEqual(output, [exp]) def test_commit_to_patch_two_commits_diff_separated(self): - """ Test the commit_to_patch function of pagure.lib.git. """ + """Test the commit_to_patch function of pagure.lib.git.""" repo = pygit2.init_repository(self.gitrepo) patches = pagure.lib.git.commit_to_patch( @@ -4030,7 +4030,7 @@ index 9f44358..2a552bb 100644 self.assertEqual(output, exp) def test_commit_to_patch_empty_commit(self): - """ Test the commit_to_path function of pagure.lib.git. """ + """Test the commit_to_path function of pagure.lib.git.""" repo = pygit2.init_repository(self.gitrepo) patch = pagure.lib.git.commit_to_patch(repo, self.third_commit) @@ -4038,7 +4038,7 @@ index 9f44358..2a552bb 100644 self.assertEqual(patch, exp) def test_commit_to_patch_empty_commit_diff(self): - """ Test the commit_to_patch function of pagure.lib.git. """ + """Test the commit_to_patch function of pagure.lib.git.""" repo = pygit2.init_repository(self.gitrepo) patch = pagure.lib.git.commit_to_patch( diff --git a/tests/test_pagure_lib_git_auth.py b/tests/test_pagure_lib_git_auth.py index 4a22754..cc1bfa8 100644 --- a/tests/test_pagure_lib_git_auth.py +++ b/tests/test_pagure_lib_git_auth.py @@ -35,7 +35,7 @@ from pagure.lib.repo import PagureRepo class PagureLibGitAuthtests(tests.Modeltests): - """ Tests for pagure.lib.git_auth """ + """Tests for pagure.lib.git_auth""" config_values = {"authbackend": "test_auth"} @@ -233,7 +233,7 @@ class PagureLibGitAuthtests(tests.Modeltests): class PagureLibGitAuthPagureBackendtests(tests.Modeltests): - """ Tests for pagure.lib.git_auth """ + """Tests for pagure.lib.git_auth""" config_values = {"authbackend": "pagure"} diff --git a/tests/test_pagure_lib_git_auth_paguregitauth.py b/tests/test_pagure_lib_git_auth_paguregitauth.py index f7dbf28..1d020e6 100644 --- a/tests/test_pagure_lib_git_auth_paguregitauth.py +++ b/tests/test_pagure_lib_git_auth_paguregitauth.py @@ -29,7 +29,7 @@ from pagure.lib.repo import PagureRepo class PagureLibGitAuthPagureGitAuthtests(tests.Modeltests): - """ Tests for pagure.lib.git_auth PagureGitAuth dynamic ACL """ + """Tests for pagure.lib.git_auth PagureGitAuth dynamic ACL""" config_values = {"authbackend": "pagure"} diff --git a/tests/test_pagure_lib_git_diff_pr.py b/tests/test_pagure_lib_git_diff_pr.py index 3861873..b677338 100644 --- a/tests/test_pagure_lib_git_diff_pr.py +++ b/tests/test_pagure_lib_git_diff_pr.py @@ -33,11 +33,11 @@ from pagure.lib.repo import PagureRepo # noqa class PagureFlaskForkPrtests(tests.Modeltests): - """ Tests for flask fork controller of pagure regarding diffing PRs """ + """Tests for flask fork controller of pagure regarding diffing PRs""" @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureFlaskForkPrtests, self).setUp() # Create the main project in the DB @@ -230,7 +230,7 @@ class PagureFlaskForkPrtests(tests.Modeltests): self.assertEqual(req.title, "test pull-request") def test_get_pr_info(self): - """ Test pagure.ui.fork._get_pr_info """ + """Test pagure.ui.fork._get_pr_info""" gitrepo = os.path.join(self.path, "repos", "test.git") gitrepo2 = os.path.join( @@ -257,7 +257,7 @@ class PagureFlaskForkPrtests(tests.Modeltests): ) def test_get_pr_info_raises(self): - """ Test pagure.ui.fork._get_pr_info """ + """Test pagure.ui.fork._get_pr_info""" gitrepo = os.path.join(self.path, "repos", "test.git") gitrepo2 = os.path.join( @@ -283,7 +283,7 @@ class PagureFlaskForkPrtests(tests.Modeltests): ) def test_diff_pull_request(self): - """ Test pagure.lib.git.diff_pull_request """ + """Test pagure.lib.git.diff_pull_request""" gitrepo = os.path.join(self.path, "repos", "test.git") gitrepo2 = os.path.join( self.path, "repos", "forks", "pingou", "test.git" diff --git a/tests/test_pagure_lib_git_get_tags_objects.py b/tests/test_pagure_lib_git_get_tags_objects.py index f9b3325..555b700 100644 --- a/tests/test_pagure_lib_git_get_tags_objects.py +++ b/tests/test_pagure_lib_git_get_tags_objects.py @@ -27,7 +27,7 @@ import tests def get_tag_name(tags): - """ Return a list of the tag names """ + """Return a list of the tag names""" output = [] for tag in tags: output.append(tag["tagname"]) @@ -35,7 +35,7 @@ def get_tag_name(tags): def add_repo_tag(git_dir, repo, tags, repo_name): - """ Use a list to create multiple tags on a git repo """ + """Use a list to create multiple tags on a git repo""" for tag in reversed(tags): time.sleep(1) tests.add_commit_git_repo( @@ -54,7 +54,7 @@ def add_repo_tag(git_dir, repo, tags, repo_name): class PagureLibGitGetTagstests(tests.Modeltests): def test_get_git_tags_objects(self): - """ Test the get_git_tags_objects method of pagure.lib.git. """ + """Test the get_git_tags_objects method of pagure.lib.git.""" tests.create_projects(self.session) tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) project = pagure.lib.query._get_project(self.session, "test") diff --git a/tests/test_pagure_lib_git_mirror_project.py b/tests/test_pagure_lib_git_mirror_project.py index 4773a6a..90abc01 100644 --- a/tests/test_pagure_lib_git_mirror_project.py +++ b/tests/test_pagure_lib_git_mirror_project.py @@ -33,12 +33,12 @@ from pagure.lib.repo import PagureRepo class PagureLibGitMirrorProjecttests(tests.Modeltests): - """ Tests for pagure.lib.git.mirror_pull_project """ + """Tests for pagure.lib.git.mirror_pull_project""" maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureLibGitMirrorProjecttests, self).setUp() tests.create_projects(self.session) @@ -55,7 +55,7 @@ class PagureLibGitMirrorProjecttests(tests.Modeltests): @patch("subprocess.Popen") @patch("subprocess.check_output") def test_mirror_pull_project(self, ck_out_mock, popen_mock): - """ Test the mirror_pull_project method of pagure.lib.git. """ + """Test the mirror_pull_project method of pagure.lib.git.""" tmp = MagicMock() tmp.communicate.return_value = ("", "") diff --git a/tests/test_pagure_lib_gitolite_config.py b/tests/test_pagure_lib_gitolite_config.py index b95babe..181df88 100644 --- a/tests/test_pagure_lib_gitolite_config.py +++ b/tests/test_pagure_lib_gitolite_config.py @@ -76,12 +76,12 @@ repo requests/somenamespace/test3 class PagureLibGitoliteConfigtests(tests.Modeltests): - """ Tests for pagure.lib.git """ + """Tests for pagure.lib.git""" maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureLibGitoliteConfigtests, self).setUp() tests.create_projects(self.session) @@ -102,7 +102,7 @@ class PagureLibGitoliteConfigtests(tests.Modeltests): stream.write("\n# end of footer\n") def tearDown(self): - """ Tearn down the environnment, ran before every tests. """ + """Tearn down the environnment, ran before every tests.""" super(PagureLibGitoliteConfigtests, self).tearDown() if os.path.exists(self.outputconf): @@ -429,7 +429,7 @@ class PagureLibGitoliteGroupConfigtests(tests.Modeltests): maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureLibGitoliteGroupConfigtests, self).setUp() tests.create_projects(self.session) @@ -472,7 +472,7 @@ class PagureLibGitoliteGroupConfigtests(tests.Modeltests): stream.write("\n# end of footer\n") def tearDown(self): - """ Tearn down the environnment, ran before every tests. """ + """Tearn down the environnment, ran before every tests.""" super(PagureLibGitoliteGroupConfigtests, self).tearDown() if os.path.exists(self.outputconf): @@ -480,7 +480,7 @@ class PagureLibGitoliteGroupConfigtests(tests.Modeltests): self.assertFalse(os.path.exists(self.outputconf)) def test_write_gitolite_project_test_group(self): - """ Test the write_gitolite_acls when updating a single group. """ + """Test the write_gitolite_acls when updating a single group.""" with open(self.outputconf, "w") as stream: pass @@ -534,7 +534,7 @@ repo requests/test self.assertEqual(data, exp) def test_write_gitolite_project_test_all_groups(self): - """ Test the write_gitolite_acls when updating all groups. """ + """Test the write_gitolite_acls when updating all groups.""" with open(self.outputconf, "w") as stream: pass @@ -588,7 +588,7 @@ repo requests/test self.assertEqual(data, exp) def test_write_gitolite_project_all_projects_groups(self): - """ Test the generating the entire gitolite config. """ + """Test the generating the entire gitolite config.""" with open(self.outputconf, "w") as stream: pass @@ -631,7 +631,7 @@ repo requests/test self.assertEqual(data, exp) def test_write_gitolite_project_all_projects_one_group(self): - """ Test the generating the entire gitolite config. """ + """Test the generating the entire gitolite config.""" # Generate the full gitolite config that we will update self.test_write_gitolite_project_all_projects_groups() diff --git a/tests/test_pagure_lib_link.py b/tests/test_pagure_lib_link.py index e36a754..d4907bc 100644 --- a/tests/test_pagure_lib_link.py +++ b/tests/test_pagure_lib_link.py @@ -38,7 +38,7 @@ COMMENTS = [ class PagureLibLinktests(tests.Modeltests): - """ Tests for pagure.lib.link """ + """Tests for pagure.lib.link""" def test_get_relation_relates(self): """Test the get_relation function of pagure.lib.link with relates.""" @@ -198,7 +198,7 @@ class PagureLibLinktests(tests.Modeltests): self.assertEqual(link, []) def test_relates_regex(self): - """ Test the relates regex present in pagure.lib.link. """ + """Test the relates regex present in pagure.lib.link.""" text = "relates to http://localhost.localdomain/fork/pingou/test/issue/1" for index, regex in enumerate(pagure.lib.link.RELATES): if index == 1: @@ -238,7 +238,7 @@ class PagureLibLinktests(tests.Modeltests): self.assertEqual(regex.match(text), None) def test_fixes_regex(self): - """ Test the fixes regex present in pagure.lib.link. """ + """Test the fixes regex present in pagure.lib.link.""" # project/issue matches def project_match(text, groups): diff --git a/tests/test_pagure_lib_login.py b/tests/test_pagure_lib_login.py index 3809d03..ee4ec23 100644 --- a/tests/test_pagure_lib_login.py +++ b/tests/test_pagure_lib_login.py @@ -30,28 +30,28 @@ import tests class PagureLibLogintests(tests.Modeltests): - """ Tests for pagure.lib.login """ + """Tests for pagure.lib.login""" def test_id_generator(self): - """ Test pagure.lib.login.id_generator. """ + """Test pagure.lib.login.id_generator.""" self.assertEqual( pagure.lib.login.id_generator(size=3, chars=["a"]), "aaa" ) def test_get_session_by_visitkey(self): - """ Test pagure.lib.login.get_session_by_visitkey. """ + """Test pagure.lib.login.get_session_by_visitkey.""" session = pagure.lib.login.get_session_by_visitkey(self.session, "foo") self.assertEqual(session, None) def test_generate_hashed_value(self): - """ Test pagure.lib.login.generate_hashed_value. """ + """Test pagure.lib.login.generate_hashed_value.""" password = pagure.lib.login.generate_hashed_value("foo") self.assertTrue(password.startswith("$2$")) self.assertEqual(len(password), 63) def test_check_password(self): - """ Test pagure.lib.login.check_password. """ + """Test pagure.lib.login.check_password.""" # Version 2 password = pagure.lib.login.generate_hashed_value("foo") diff --git a/tests/test_pagure_lib_model.py b/tests/test_pagure_lib_model.py index 6536064..cf27498 100644 --- a/tests/test_pagure_lib_model.py +++ b/tests/test_pagure_lib_model.py @@ -26,10 +26,10 @@ import tests class PagureLibModeltests(tests.Modeltests): - """ Tests for pagure.lib.model """ + """Tests for pagure.lib.model""" def test_user__repr__(self): - """ Test the User.__repr__ function of pagure.lib.model. """ + """Test the User.__repr__ function of pagure.lib.model.""" item = pagure.lib.query.search_user(self.session, email="foo@bar.com") self.assertEqual(str(item), "User: 2 - name foo") self.assertEqual("foo", item.user) @@ -39,7 +39,7 @@ class PagureLibModeltests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_issue__repr__(self, p_send_email, p_ugt): - """ Test the Issue.__repr__ function of pagure.lib.model. """ + """Test the Issue.__repr__ function of pagure.lib.model.""" p_send_email.return_value = True p_ugt.return_value = True @@ -66,7 +66,7 @@ class PagureLibModeltests(tests.Modeltests): @patch("pagure.lib.git.update_git") @patch("pagure.lib.notify.send_email") def test_pullrequest__repr__(self, p_send_email, p_ugt): - """ Test the PullRequest.__repr__ function of pagure.lib.model. """ + """Test the PullRequest.__repr__ function of pagure.lib.model.""" p_send_email.return_value = True p_ugt.return_value = True @@ -117,7 +117,7 @@ class PagureLibModeltests(tests.Modeltests): ) def test_paguregroup__repr__(self): - """ Test the PagureGroup.__repr__ function of pagure.lib.model. """ + """Test the PagureGroup.__repr__ function of pagure.lib.model.""" item = pagure.lib.model.PagureGroup( group_name="admin", display_name="admin group", @@ -130,7 +130,7 @@ class PagureLibModeltests(tests.Modeltests): self.assertEqual(str(item), "Group: 1 - name admin") def test_tagissue__repr__(self): - """ Test the TagIssue.__repr__ function of pagure.lib.model. """ + """Test the TagIssue.__repr__ function of pagure.lib.model.""" self.test_issue__repr__() repo = pagure.lib.query.get_authorized_project(self.session, "test") issues = pagure.lib.query.search_issues(self.session, repo) @@ -146,7 +146,7 @@ class PagureLibModeltests(tests.Modeltests): self.assertEqual(str(item), "TagIssue(issue:1, tag:foo)") def test_tagissuecolor__repr__(self): - """ Test the TagIssue.__repr__ function of pagure.lib.model. """ + """Test the TagIssue.__repr__ function of pagure.lib.model.""" self.test_issue__repr__() repo = pagure.lib.query.get_authorized_project(self.session, "test") issues = pagure.lib.query.search_issues(self.session, repo) @@ -171,7 +171,7 @@ class PagureLibModeltests(tests.Modeltests): ) def test_group_project_ordering(self): - """ Test the ordering of project.groups. """ + """Test the ordering of project.groups.""" # Create three projects item = pagure.lib.model.Project( user_id=1, # pingou diff --git a/tests/test_pagure_lib_model_delete_project.py b/tests/test_pagure_lib_model_delete_project.py index 0b7ca2f..75cc2d2 100644 --- a/tests/test_pagure_lib_model_delete_project.py +++ b/tests/test_pagure_lib_model_delete_project.py @@ -28,10 +28,10 @@ import tests class DeleteProjectTests(tests.Modeltests): - """ Tests for flask issues controller of pagure """ + """Tests for flask issues controller of pagure""" def test_delete_project_with_group(self): - """ Test the model when we delete a project with a group. """ + """Test the model when we delete a project with a group.""" # Create a project item = model.Project( @@ -76,7 +76,7 @@ class DeleteProjectTests(tests.Modeltests): self.assertEqual(self.session.query(model.ProjectGroup).count(), 0) def test_delete_project_with_user(self): - """ Test the model when we delete a project with users. """ + """Test the model when we delete a project with users.""" # Create a project item = model.Project( @@ -112,7 +112,7 @@ class DeleteProjectTests(tests.Modeltests): self.assertEqual(self.session.query(model.User).count(), 2) def test_delete_project_with_coloredtags(self): - """ Test the model when we delete a project with Colored tags. """ + """Test the model when we delete a project with Colored tags.""" # Create a project item = model.Project( diff --git a/tests/test_pagure_lib_notify.py b/tests/test_pagure_lib_notify.py index 63ace5c..2cb74d6 100644 --- a/tests/test_pagure_lib_notify.py +++ b/tests/test_pagure_lib_notify.py @@ -29,12 +29,12 @@ import munch class PagureLibNotifytests(tests.Modeltests): - """ Tests for pagure.lib.notify """ + """Tests for pagure.lib.notify""" maxDiff = None def test_get_emails_for_obj_issue(self): - """ Test the _get_emails_for_obj method from pagure.lib.notify. """ + """Test the _get_emails_for_obj method from pagure.lib.notify.""" # Create the project ns/test item = pagure.lib.model.Project( @@ -100,7 +100,7 @@ class PagureLibNotifytests(tests.Modeltests): self.assertEqual(out, exp) def test_get_emails_for_obj_issue_watching_project(self): - """ Test the _get_emails_for_obj method from pagure.lib.notify. """ + """Test the _get_emails_for_obj method from pagure.lib.notify.""" # Create the project ns/test item = pagure.lib.model.Project( @@ -174,7 +174,7 @@ class PagureLibNotifytests(tests.Modeltests): @patch("pagure.lib.notify.smtplib.SMTP") def test_get_emails_for_obj_pr(self, mock_smtp): - """ Test the _get_emails_for_obj method from pagure.lib.notify. """ + """Test the _get_emails_for_obj method from pagure.lib.notify.""" mock_smtp.return_value = MagicMock() tests.create_projects(self.session) @@ -251,7 +251,7 @@ class PagureLibNotifytests(tests.Modeltests): @patch("pagure.lib.notify.smtplib.SMTP") def test_get_emails_for_obj_pr_watching_project(self, mock_smtp): - """ Test the _get_emails_for_obj method from pagure.lib.notify. """ + """Test the _get_emails_for_obj method from pagure.lib.notify.""" mock_smtp.return_value = MagicMock() tests.create_projects(self.session) @@ -332,7 +332,7 @@ class PagureLibNotifytests(tests.Modeltests): self.assertEqual(out, exp) def test_get_emails_for_obj_private_issue(self): - """ Test the _get_emails_for_obj method from pagure.lib.notify. """ + """Test the _get_emails_for_obj method from pagure.lib.notify.""" # Create the project ns/test item = pagure.lib.model.Project( @@ -413,7 +413,7 @@ class PagureLibNotifytests(tests.Modeltests): ) @patch("pagure.lib.notify.smtplib.SMTP") def test_send_email(self, mock_smtp): - """ Test the send_email method from pagure.lib.notify. """ + """Test the send_email method from pagure.lib.notify.""" mock_smtp.return_value = MagicMock() email = pagure.lib.notify.send_email( diff --git a/tests/test_pagure_lib_notify_email.py b/tests/test_pagure_lib_notify_email.py index 2738e26..28e1db3 100644 --- a/tests/test_pagure_lib_notify_email.py +++ b/tests/test_pagure_lib_notify_email.py @@ -34,7 +34,7 @@ class PagureLibNotifyEmailtests(tests.Modeltests): """ def setUp(self): - """ Override setUp to add more fixtures used for many tests. """ + """Override setUp to add more fixtures used for many tests.""" super(PagureLibNotifyEmailtests, self).setUp() tests.create_projects(self.session) diff --git a/tests/test_pagure_lib_star_project.py b/tests/test_pagure_lib_star_project.py index 8f2b4b6..3123c46 100644 --- a/tests/test_pagure_lib_star_project.py +++ b/tests/test_pagure_lib_star_project.py @@ -24,15 +24,15 @@ import tests class TestStarProjectLib(tests.SimplePagureTest): - """ Test the star project feature of pagure """ + """Test the star project feature of pagure""" def setUp(self): - """ Set up the environnment for running each star project lib tests """ + """Set up the environnment for running each star project lib tests""" super(TestStarProjectLib, self).setUp() tests.create_projects(self.session) def test_update_star_project(self): - """ Test the update_star_project endpoint of pagure.lib """ + """Test the update_star_project endpoint of pagure.lib""" repo_obj = pagure.lib.query._get_project(self.session, "test") # test with invalud Star object, should return None @@ -67,7 +67,7 @@ class TestStarProjectLib(tests.SimplePagureTest): self.assertEqual(len(user_obj.stars), 0) def test_star_project(self): - """ Test the _star_project endpoint of pagure.lib """ + """Test the _star_project endpoint of pagure.lib""" # test with not all arguments present user_obj = pagure.lib.query.get_user(self.session, "pingou") @@ -85,7 +85,7 @@ class TestStarProjectLib(tests.SimplePagureTest): self.assertEqual(len(user_obj.stars), 1) def test_unstar_project(self): - """ Test the _unstar_project endpoint of pagure.lib """ + """Test the _unstar_project endpoint of pagure.lib""" # test with not all arguments present user_obj = pagure.lib.query.get_user(self.session, "pingou") @@ -123,7 +123,7 @@ class TestStarProjectLib(tests.SimplePagureTest): self.assertEqual(len(user_obj.stars), 0) def test_get_stargazer_obj(self): - """ Test the _get_stargazer_obj test of pagure.lib """ + """Test the _get_stargazer_obj test of pagure.lib""" # star the project first repo_obj = pagure.lib.query._get_project(self.session, "test") @@ -161,7 +161,7 @@ class TestStarProjectLib(tests.SimplePagureTest): self.assertEqual(star_obj is None, True) def test_has_starred(self): - """ Test the has_starred endpoint of pagure.lib """ + """Test the has_starred endpoint of pagure.lib""" # star the project repo_obj = pagure.lib.query._get_project(self.session, "test") diff --git a/tests/test_pagure_lib_task_mirror.py b/tests/test_pagure_lib_task_mirror.py index 647dc25..f21df35 100644 --- a/tests/test_pagure_lib_task_mirror.py +++ b/tests/test_pagure_lib_task_mirror.py @@ -35,12 +35,12 @@ import pagure.lib.tasks_mirror class PagureLibTaskMirrortests(tests.Modeltests): - """ Tests for pagure.lib.task_mirror """ + """Tests for pagure.lib.task_mirror""" maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureLibTaskMirrortests, self).setUp() pagure.config.config["REQUESTS_FOLDER"] = None @@ -50,7 +50,7 @@ class PagureLibTaskMirrortests(tests.Modeltests): tests.create_projects(self.session) def test_create_ssh_key(self): - """ Test the _create_ssh_key method. """ + """Test the _create_ssh_key method.""" # before self.assertFalse(os.path.exists(self.sshkeydir)) os.mkdir(self.sshkeydir) @@ -65,7 +65,7 @@ class PagureLibTaskMirrortests(tests.Modeltests): ) def test_setup_mirroring(self): - """ Test the setup_mirroring method. """ + """Test the setup_mirroring method.""" # before self.assertFalse(os.path.exists(self.sshkeydir)) @@ -92,7 +92,7 @@ class PagureLibTaskMirrortests(tests.Modeltests): self.assertTrue(project.mirror_hook.public_key.startswith("ssh-rsa ")) def test_setup_mirroring_ssh_folder_exists_wrong_permissions(self): - """ Test the setup_mirroring method. """ + """Test the setup_mirroring method.""" os.makedirs(self.sshkeydir) @@ -122,7 +122,7 @@ class PagureLibTaskMirrortests(tests.Modeltests): self.assertIsNone(project.mirror_hook.public_key) def test_setup_mirroring_ssh_folder_symlink(self): - """ Test the setup_mirroring method. """ + """Test the setup_mirroring method.""" os.symlink(self.path, self.sshkeydir) @@ -175,7 +175,7 @@ class PagureLibTaskMirrortests(tests.Modeltests): @patch("os.getuid", MagicMock(return_value=450)) def test_setup_mirroring_ssh_folder_owner(self): - """ Test the setup_mirroring method. """ + """Test the setup_mirroring method.""" os.makedirs(self.sshkeydir, mode=0o700) # before @@ -205,12 +205,12 @@ class PagureLibTaskMirrortests(tests.Modeltests): class PagureLibTaskMirrorSetuptests(tests.Modeltests): - """ Tests for pagure.lib.task_mirror """ + """Tests for pagure.lib.task_mirror""" maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureLibTaskMirrorSetuptests, self).setUp() pagure.config.config["REQUESTS_FOLDER"] = None @@ -233,7 +233,7 @@ class PagureLibTaskMirrorSetuptests(tests.Modeltests): ) def test_setup_mirroring_twice(self): - """ Test the setup_mirroring method. """ + """Test the setup_mirroring method.""" # before self.assertEqual( @@ -261,7 +261,7 @@ class PagureLibTaskMirrorSetuptests(tests.Modeltests): self.assertEqual(project.mirror_hook.public_key, before_key) def test_teardown_mirroring(self): - """ Test the teardown_mirroring method. """ + """Test the teardown_mirroring method.""" # before self.assertEqual( @@ -283,7 +283,7 @@ class PagureLibTaskMirrorSetuptests(tests.Modeltests): @patch("pagure.lib.git.read_git_lines") def test_mirror_project(self, rgl): - """ Test the mirror_project method. """ + """Test the mirror_project method.""" rgl.return_value = ("stdout", "stderr") tests.create_projects_git(os.path.join(self.path, "repos"), bare=True) diff --git a/tests/test_pagure_lib_task_services.py b/tests/test_pagure_lib_task_services.py index d2b9a2a..7142fc2 100644 --- a/tests/test_pagure_lib_task_services.py +++ b/tests/test_pagure_lib_task_services.py @@ -34,12 +34,12 @@ import pagure.lib.tasks_services class PagureLibTaskServicestests(tests.Modeltests): - """ Tests for pagure.lib.task_services """ + """Tests for pagure.lib.task_services""" maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureLibTaskServicestests, self).setUp() tests.create_projects(self.session) @@ -63,7 +63,7 @@ class PagureLibTaskServicestests(tests.Modeltests): self.session.commit() def test_webhook_notification_invalid_project(self): - """ Test the webhook_notification method. """ + """Test the webhook_notification method.""" self.assertRaises( RuntimeError, @@ -77,7 +77,7 @@ class PagureLibTaskServicestests(tests.Modeltests): @patch("pagure.lib.tasks_services.call_web_hooks") def test_webhook_notification_no_webhook(self, call_wh): - """ Test the webhook_notification method. """ + """Test the webhook_notification method.""" output = pagure.lib.tasks_services.webhook_notification( topic="topic", @@ -91,7 +91,7 @@ class PagureLibTaskServicestests(tests.Modeltests): @patch("pagure.lib.git.log_commits_to_db") def test_log_commit_send_notifications_invalid_project(self, log): - """ Test the log_commit_send_notifications method. """ + """Test the log_commit_send_notifications method.""" output = pagure.lib.tasks_services.log_commit_send_notifications( name="invalid", commits=[], @@ -107,7 +107,7 @@ class PagureLibTaskServicestests(tests.Modeltests): @patch("pagure.lib.notify.notify_new_commits") @patch("pagure.lib.git.log_commits_to_db") def test_log_commit_send_notifications_valid_project(self, log, notif): - """ Test the log_commit_send_notifications method. """ + """Test the log_commit_send_notifications method.""" output = pagure.lib.tasks_services.log_commit_send_notifications( name="test", commits=["hash1", "hash2"], @@ -127,7 +127,7 @@ class PagureLibTaskServicestests(tests.Modeltests): @patch("pagure.lib.tasks_services.trigger_jenkins_build") def test_trigger_ci_build_invalid_project(self, trigger_jenk): - """ Test the trigger_ci_build method. """ + """Test the trigger_ci_build method.""" output = pagure.lib.tasks_services.trigger_ci_build( project_name="invalid", cause="PR#ID", @@ -140,7 +140,7 @@ class PagureLibTaskServicestests(tests.Modeltests): @patch("pagure.lib.tasks_services.trigger_jenkins_build") def test_trigger_ci_build_not_configured_project(self, trigger_jenk): - """ Test the trigger_ci_build method. """ + """Test the trigger_ci_build method.""" self.assertRaises( pagure.exceptions.PagureException, pagure.lib.tasks_services.trigger_ci_build, @@ -154,7 +154,7 @@ class PagureLibTaskServicestests(tests.Modeltests): @patch("pagure.lib.tasks_services.trigger_jenkins_build") def test_trigger_ci_build_not_configured_project_fork(self, trigger_jenk): - """ Test the trigger_ci_build method. """ + """Test the trigger_ci_build method.""" self.assertRaises( pagure.exceptions.PagureException, pagure.lib.tasks_services.trigger_ci_build, @@ -168,7 +168,7 @@ class PagureLibTaskServicestests(tests.Modeltests): @patch("pagure.lib.query._get_project") def test_load_json_commits_to_db_invalid_data_type(self, get_project): - """ Test the load_json_commits_to_db method. """ + """Test the load_json_commits_to_db method.""" output = pagure.lib.tasks_services.load_json_commits_to_db( name="test", commits=["hash1", "hash2"], @@ -183,7 +183,7 @@ class PagureLibTaskServicestests(tests.Modeltests): @patch("pagure.lib.tasks_services.get_files_to_load") def test_load_json_commits_to_db_invalid_project(self, get_files): - """ Test the load_json_commits_to_db method. """ + """Test the load_json_commits_to_db method.""" output = pagure.lib.tasks_services.load_json_commits_to_db( name="invalid", commits=["hash1", "hash2"], @@ -199,7 +199,7 @@ class PagureLibTaskServicestests(tests.Modeltests): @patch("pagure.lib.git.update_request_from_git") @patch("pagure.lib.git.update_ticket_from_git") def test_load_json_commits_to_db_invalid_path(self, up_issue, up_pr): - """ Test the load_json_commits_to_db method. """ + """Test the load_json_commits_to_db method.""" output = pagure.lib.tasks_services.load_json_commits_to_db( name="test", commits=["hash1", "hash2"], @@ -218,7 +218,7 @@ class PagureLibTaskServicestests(tests.Modeltests): def test_load_json_commits_to_db_invalid_path_one_commit( self, up_issue, up_pr ): - """ Test the load_json_commits_to_db method. """ + """Test the load_json_commits_to_db method.""" output = pagure.lib.tasks_services.load_json_commits_to_db( name="test", commits=["hash1"], @@ -236,7 +236,7 @@ class PagureLibTaskServicestests(tests.Modeltests): @patch("pagure.lib.git.update_request_from_git") @patch("pagure.lib.git.update_ticket_from_git") def test_load_json_commits_to_db_no_agent(self, up_issue, up_pr, send): - """ Test the load_json_commits_to_db method. """ + """Test the load_json_commits_to_db method.""" output = pagure.lib.tasks_services.load_json_commits_to_db( name="test", commits=[], @@ -258,7 +258,7 @@ class PagureLibTaskServicestests(tests.Modeltests): def test_load_json_commits_to_db_no_agent( self, git, up_issue, up_pr, send ): - """ Test the load_json_commits_to_db method. """ + """Test the load_json_commits_to_db method.""" git.side_effect = [["file1"], ["file2"], ["files/image"], ["file1"]] output = pagure.lib.tasks_services.load_json_commits_to_db( @@ -283,7 +283,7 @@ class PagureLibTaskServicestests(tests.Modeltests): def test_load_json_commits_to_db_tickets( self, git, up_issue, up_pr, send, json_loads ): - """ Test the load_json_commits_to_db method. """ + """Test the load_json_commits_to_db method.""" git.side_effect = [["file1"], ["file2"], ["files/image"], ["file1"]] json_loads.return_value = "foobar" @@ -330,7 +330,7 @@ class PagureLibTaskServicestests(tests.Modeltests): def test_load_json_commits_to_db_prs( self, git, up_issue, up_pr, send, json_loads ): - """ Test the load_json_commits_to_db method. """ + """Test the load_json_commits_to_db method.""" git.side_effect = [["file1"], ["file2"], ["files/image"], ["file1"]] json_loads.return_value = "foobar" @@ -388,7 +388,7 @@ class PagureLibTaskServicestests(tests.Modeltests): def test_load_json_commits_to_db_prs_raises_error( self, git, up_issue, up_pr, send, json_loads ): - """ Test the load_json_commits_to_db method. """ + """Test the load_json_commits_to_db method.""" git.side_effect = [["file1"], ["file2"], ["files/image"], ["file1"]] json_loads.return_value = "foobar" up_pr.side_effect = Exception("foo error") @@ -433,12 +433,12 @@ class PagureLibTaskServicestests(tests.Modeltests): class PagureLibTaskServicesWithWebHooktests(tests.Modeltests): - """ Tests for pagure.lib.task_services """ + """Tests for pagure.lib.task_services""" maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureLibTaskServicesWithWebHooktests, self).setUp() pagure.config.config["REQUESTS_FOLDER"] = None @@ -455,7 +455,7 @@ class PagureLibTaskServicesWithWebHooktests(tests.Modeltests): @patch("pagure.lib.tasks_services.call_web_hooks") def test_webhook_notification_no_webhook(self, call_wh): - """ Test the webhook_notification method. """ + """Test the webhook_notification method.""" output = pagure.lib.tasks_services.webhook_notification( topic="topic", @@ -479,7 +479,7 @@ class PagureLibTaskServicesWithWebHooktests(tests.Modeltests): @patch("datetime.datetime") @patch("requests.post") def test_webhook_notification_no_webhook(self, post, dt): - """ Test the webhook_notification method. """ + """Test the webhook_notification method.""" post.return_value = False utcnow = MagicMock() utcnow.year = 2018 @@ -552,12 +552,12 @@ class PagureLibTaskServicesWithWebHooktests(tests.Modeltests): class PagureLibTaskServicesJenkinsCItests(tests.Modeltests): - """ Tests for pagure.lib.task_services """ + """Tests for pagure.lib.task_services""" maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureLibTaskServicesJenkinsCItests, self).setUp() pagure.config.config["REQUESTS_FOLDER"] = None @@ -597,7 +597,7 @@ class PagureLibTaskServicesJenkinsCItests(tests.Modeltests): @patch("pagure.lib.tasks_services.trigger_jenkins_build") def test_trigger_ci_build_invalid_ci(self, trigger_jenk): - """ Test the trigger_ci_build method. """ + """Test the trigger_ci_build method.""" output = pagure.lib.tasks_services.trigger_ci_build( project_name="test", cause="PR#ID", @@ -610,7 +610,7 @@ class PagureLibTaskServicesJenkinsCItests(tests.Modeltests): @patch("pagure.lib.tasks_services.trigger_jenkins_build") def test_trigger_ci_build_invalid_ci_fork(self, trigger_jenk): - """ Test the trigger_ci_build method. """ + """Test the trigger_ci_build method.""" output = pagure.lib.tasks_services.trigger_ci_build( project_name="forks/foo/test", cause="PR#ID", @@ -623,7 +623,7 @@ class PagureLibTaskServicesJenkinsCItests(tests.Modeltests): @patch("pagure.lib.tasks_services.trigger_jenkins_build") def test_trigger_ci_build_valid_project(self, trigger_jenk): - """ Test the trigger_ci_build method. """ + """Test the trigger_ci_build method.""" output = pagure.lib.tasks_services.trigger_ci_build( project_name="test", cause="PR#ID", @@ -646,7 +646,7 @@ class PagureLibTaskServicesJenkinsCItests(tests.Modeltests): @patch("pagure.lib.tasks_services.trigger_jenkins_build") def test_trigger_ci_build_valid_project_fork(self, trigger_jenk): - """ Test the trigger_ci_build method. """ + """Test the trigger_ci_build method.""" output = pagure.lib.tasks_services.trigger_ci_build( project_name="forks/foo/test", cause="PR#ID", @@ -669,12 +669,12 @@ class PagureLibTaskServicesJenkinsCItests(tests.Modeltests): class PagureLibTaskServicesJenkinsCIAuthtests(tests.Modeltests): - """ Tests for pagure.lib.task_services """ + """Tests for pagure.lib.task_services""" maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureLibTaskServicesJenkinsCIAuthtests, self).setUp() pagure.config.config["REQUESTS_FOLDER"] = None @@ -716,7 +716,7 @@ class PagureLibTaskServicesJenkinsCIAuthtests(tests.Modeltests): @patch("pagure.lib.tasks_services.trigger_jenkins_build") def test_trigger_ci_build_invalid_ci(self, trigger_jenk): - """ Test the trigger_ci_build method. """ + """Test the trigger_ci_build method.""" output = pagure.lib.tasks_services.trigger_ci_build( project_name="test", cause="PR#ID", @@ -729,7 +729,7 @@ class PagureLibTaskServicesJenkinsCIAuthtests(tests.Modeltests): @patch("pagure.lib.tasks_services.trigger_jenkins_build") def test_trigger_ci_build_invalid_ci_fork(self, trigger_jenk): - """ Test the trigger_ci_build method. """ + """Test the trigger_ci_build method.""" output = pagure.lib.tasks_services.trigger_ci_build( project_name="forks/foo/test", cause="PR#ID", @@ -742,7 +742,7 @@ class PagureLibTaskServicesJenkinsCIAuthtests(tests.Modeltests): @patch("pagure.lib.tasks_services.trigger_jenkins_build") def test_trigger_ci_build_valid_project(self, trigger_jenk): - """ Test the trigger_ci_build method. """ + """Test the trigger_ci_build method.""" output = pagure.lib.tasks_services.trigger_ci_build( project_name="test", cause="PR#ID", @@ -765,7 +765,7 @@ class PagureLibTaskServicesJenkinsCIAuthtests(tests.Modeltests): @patch("pagure.lib.tasks_services.trigger_jenkins_build") def test_trigger_ci_build_valid_project_fork(self, trigger_jenk): - """ Test the trigger_ci_build method. """ + """Test the trigger_ci_build method.""" output = pagure.lib.tasks_services.trigger_ci_build( project_name="forks/foo/test", cause="PR#ID", @@ -788,12 +788,12 @@ class PagureLibTaskServicesJenkinsCIAuthtests(tests.Modeltests): class PagureLibTaskServicesLoadJsonTickettests(tests.Modeltests): - """ Tests for pagure.lib.task_services """ + """Tests for pagure.lib.task_services""" maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureLibTaskServicesLoadJsonTickettests, self).setUp() tests.create_projects(self.session) @@ -845,7 +845,7 @@ class PagureLibTaskServicesLoadJsonTickettests(tests.Modeltests): @patch("pagure.lib.notify.send_email") @patch("pagure.lib.git.update_request_from_git") def test_loading_issue_json(self, up_pr, send): - """ Test loading the JSON file of a ticket. """ + """Test loading the JSON file of a ticket.""" project = pagure.lib.query.get_authorized_project(self.session, "test") issue = pagure.lib.query.search_issues( self.session, project, issueid=1 diff --git a/tests/test_pagure_lib_watch_list.py b/tests/test_pagure_lib_watch_list.py index 13e1070..593089d 100644 --- a/tests/test_pagure_lib_watch_list.py +++ b/tests/test_pagure_lib_watch_list.py @@ -29,10 +29,10 @@ import tests @mock.patch("pagure.lib.git.update_git", mock.MagicMock(return_value=True)) @mock.patch("pagure.lib.notify.send_email", mock.MagicMock(return_value=True)) class PagureLibGetWatchListtests(tests.Modeltests): - """ Tests for pagure.lib.query.get_watch_list """ + """Tests for pagure.lib.query.get_watch_list""" def test_get_watch_list_invalid_object(self): - """ Test get_watch_list when given an invalid object """ + """Test get_watch_list when given an invalid object""" # Create a project ns/test item = pagure.lib.model.Project( user_id=1, # pingou diff --git a/tests/test_pagure_merge_pr_no_fork.py b/tests/test_pagure_merge_pr_no_fork.py index 8ab13e3..51970d1 100644 --- a/tests/test_pagure_merge_pr_no_fork.py +++ b/tests/test_pagure_merge_pr_no_fork.py @@ -28,12 +28,12 @@ import tests class PagureMergePrNoForkTest(tests.Modeltests): - """ Tests merging a PR in pagure when the fork no longer exists """ + """Tests merging a PR in pagure when the fork no longer exists""" maxDiff = None def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureMergePrNoForkTest, self).setUp() tests.create_projects(self.session) @@ -94,7 +94,7 @@ class PagureMergePrNoForkTest(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_api_pull_request_diffstats(self): - """ Test the api_pull_request_merge method of the flask api. """ + """Test the api_pull_request_merge method of the flask api.""" # Check the PR stats in the API output = self.app.get("/api/0/test/pull-request/1/diffstats") @@ -116,7 +116,7 @@ class PagureMergePrNoForkTest(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_api_pull_request_diffstats_no_fork(self): - """ Test the api_pull_request_merge method of the flask api. """ + """Test the api_pull_request_merge method of the flask api.""" pagure.lib.tasks.delete_project( namespace=None, name="test", user="pingou", action_user="pingou" @@ -142,7 +142,7 @@ class PagureMergePrNoForkTest(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_api_pull_request_merge(self): - """ Test the api_pull_request_merge method of the flask api. """ + """Test the api_pull_request_merge method of the flask api.""" headers = {"Authorization": "token aaabbbcccddd"} @@ -156,7 +156,7 @@ class PagureMergePrNoForkTest(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_api_pull_request_merge_no_fork(self): - """ Test the api_pull_request_merge method of the flask api. """ + """Test the api_pull_request_merge method of the flask api.""" pagure.lib.tasks.delete_project( namespace=None, name="test", user="pingou", action_user="pingou" @@ -174,7 +174,7 @@ class PagureMergePrNoForkTest(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_ui_pull_request_merge(self): - """ Test the api_pull_request_merge method of the flask UI. """ + """Test the api_pull_request_merge method of the flask UI.""" user = tests.FakeUser(username="pingou") with tests.user_set(self.app.application, user): @@ -197,7 +197,7 @@ class PagureMergePrNoForkTest(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_ui_pull_request_merge_no_fork(self): - """ Test the api_pull_request_merge method of the flask UI. """ + """Test the api_pull_request_merge method of the flask UI.""" pagure.lib.tasks.delete_project( namespace=None, name="test", user="pingou", action_user="pingou" @@ -226,7 +226,7 @@ class PagureMergePrNoForkTest(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_internal_merge_status(self): - """ Test the api_pull_request_merge method of the flask UI. """ + """Test the api_pull_request_merge method of the flask UI.""" self.session = pagure.lib.query.create_session(self.dbpath) project = pagure.lib.query.get_authorized_project(self.session, "test") @@ -254,7 +254,7 @@ class PagureMergePrNoForkTest(tests.Modeltests): @patch("pagure.lib.notify.send_email", MagicMock(return_value=True)) def test_internal_merge_status_no_fork(self): - """ Test the api_pull_request_merge method of the flask UI. """ + """Test the api_pull_request_merge method of the flask UI.""" pagure.lib.tasks.delete_project( namespace=None, name="test", user="pingou", action_user="pingou" diff --git a/tests/test_pagure_repospanner.py b/tests/test_pagure_repospanner.py index 9189710..b2ef3a1 100644 --- a/tests/test_pagure_repospanner.py +++ b/tests/test_pagure_repospanner.py @@ -101,14 +101,14 @@ hooks: class PagureRepoSpannerTests(tests.Modeltests): - """ Tests for repoSpanner integration of pagure """ + """Tests for repoSpanner integration of pagure""" repospanner_binary = None repospanner_runlog = None repospanner_proc = None def run_cacmd(self, logfile, *args): - """ Run a repoSpanner CA command. """ + """Run a repoSpanner CA command.""" subprocess.check_call( [ self.repospanner_binary, @@ -124,7 +124,7 @@ class PagureRepoSpannerTests(tests.Modeltests): ) def setUp(self): - """ set up the environment. """ + """set up the environment.""" possible_paths = ["./repospanner", "/usr/bin/repospanner"] for option in possible_paths: @@ -303,7 +303,7 @@ class PagureRepoSpannerTests(tests.Modeltests): pagure.config.config["REPOSPANNER_REGIONS"]["default"]["hook"] = hookid def tearDown(self): - """ Tear down the repoSpanner instance. """ + """Tear down the repoSpanner instance.""" if self.repospanner_proc: # Tear down self.repospanner_proc.terminate() @@ -340,7 +340,7 @@ class PagureRepoSpannerTestsNewRepoDefault(PagureRepoSpannerTests): @print_repospanner_log @patch("pagure.ui.app.admin_session_timedout") def test_new_project(self, ast): - """ Test creating a new repo by default on repoSpanner works. """ + """Test creating a new repo by default on repoSpanner works.""" ast.return_value = False user = tests.FakeUser(username="foo") @@ -418,7 +418,7 @@ class PagureRepoSpannerTestsNewRepoDefault(PagureRepoSpannerTests): }, ) def test_http_pull(self): - """ Test that the HTTP pull endpoint works for repoSpanner. """ + """Test that the HTTP pull endpoint works for repoSpanner.""" tests.create_projects(self.session) tests.create_tokens(self.session) tests.create_tokens_acl(self.session) @@ -461,7 +461,7 @@ class PagureRepoSpannerTestsNewRepoDefault(PagureRepoSpannerTests): }, ) def test_http_push(self): - """ Test that the HTTP push endpoint works for repoSpanner. """ + """Test that the HTTP push endpoint works for repoSpanner.""" tests.create_projects(self.session) tests.create_tokens(self.session) tests.create_tokens_acl(self.session) @@ -490,7 +490,7 @@ class PagureRepoSpannerTestsNewRepoDefault(PagureRepoSpannerTests): @print_repospanner_log @patch("pagure.ui.app.admin_session_timedout") def test_hooks(self, ast): - """ Test hook setting and running works. """ + """Test hook setting and running works.""" ast.return_value = False pagure.cli.admin.session = self.session @@ -599,7 +599,7 @@ class PagureRepoSpannerTestsNewRepoDefault(PagureRepoSpannerTests): ) @patch("pagure.ui.app.admin_session_timedout") def test_adopt_project(self, ast): - """ Test adopting a project in repoSpanner works. """ + """Test adopting a project in repoSpanner works.""" ast.return_value = False user = tests.FakeUser(username="foo") diff --git a/tests/test_pagure_send_notification.py b/tests/test_pagure_send_notification.py index f0de5b7..c6d8fac 100644 --- a/tests/test_pagure_send_notification.py +++ b/tests/test_pagure_send_notification.py @@ -24,10 +24,10 @@ import tests class PagureHooksDefault(tests.SimplePagureTest): - """ Tests for pagure.hooks.default """ + """Tests for pagure.hooks.default""" def setUp(self): - """ Set up the environnment, ran before every tests. """ + """Set up the environnment, ran before every tests.""" super(PagureHooksDefault, self).setUp() tests.create_projects(self.session) self.projects = tests.create_projects_git( diff --git a/tests/test_pagure_utils.py b/tests/test_pagure_utils.py index dd33fde..e39b694 100644 --- a/tests/test_pagure_utils.py +++ b/tests/test_pagure_utils.py @@ -30,10 +30,10 @@ import tests class PagureUtilsTests(tests.SimplePagureTest): - """ Tests for pagure.utils """ + """Tests for pagure.utils""" def setUp(self): - """ Set up the environnment, run before every tests. """ + """Set up the environnment, run before every tests.""" super(PagureUtilsTests, self).setUp() tests.create_projects(self.session) @@ -57,25 +57,25 @@ class PagureUtilsTests(tests.SimplePagureTest): self.session.commit() def test_lookup_deploykey_non_deploykey(self): - """ Test lookup_deploykey with a non-deploykey username. """ + """Test lookup_deploykey with a non-deploykey username.""" project = pagure.lib.query._get_project(self.session, "test") res = pagure.utils.lookup_deploykey(project, "pingou") self.assertEquals(res, None) def test_lookup_deploykey_different_project(self): - """ Test lookup_deploykey with a username for another project. """ + """Test lookup_deploykey with a username for another project.""" project = pagure.lib.query._get_project(self.session, "test2") res = pagure.utils.lookup_deploykey(project, "deploykey_test_1") self.assertEquals(res, None) def test_lookup_deploykey_non_existent_key(self): - """ Test lookup_deploykey with a non-existing deploykey. """ + """Test lookup_deploykey with a non-existing deploykey.""" project = pagure.lib.query._get_project(self.session, "test") res = pagure.utils.lookup_deploykey(project, "deploykey_test_2") self.assertEquals(res, None) def test_lookup_deploykey(self): - """ Test lookup_deploykey with a correct username. """ + """Test lookup_deploykey with a correct username.""" project = pagure.lib.query._get_project(self.session, "test") res = pagure.utils.lookup_deploykey(project, "deploykey_test_1") self.assertNotEquals(res, None) diff --git a/tests/test_style.py b/tests/test_style.py index 50b3907..2be2ae4 100644 --- a/tests/test_style.py +++ b/tests/test_style.py @@ -101,7 +101,7 @@ class TestStyle(unittest.TestCase): "--check", "--diff", "--exclude", - '"/(\.eggs|\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.venv|_build|buck-out|build|dist)/"', + '"/(.eggs|.git|.hg|.mypy_cache|.nox|.tox|.venv|_build|buck-out|build|dist)/"', REPO_PATH, TESTS_PATH, ]