Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions atlassian/bitbucket/server/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def update(self, **kwargs):

:return: True if the update was successful
"""
if self.__can_update == False:
if self.__can_update is False:
raise NotImplementedError("Update not implemented for this object type.")
data = self.put(None, data=kwargs)
if "errors" in data:
Expand All @@ -97,7 +97,7 @@ def delete(self):

:return: True if delete was successful
"""
if self.__can_delete == False:
if self.__can_delete is False:
raise NotImplementedError("Delete not implemented for this object type.")
data = super(BitbucketServerBase, self).delete(None)
if "errors" in data:
Expand Down
2 changes: 1 addition & 1 deletion examples/jira/jira_issue_update_epic_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def main():
epic_link_custom_field_id = "customfield_1404" # Epic Link Custom Field
target_epic_issue_key = "ARA-1314"
for issue_key in update_issues:
issue_data = jira.update_issue_field(issue_key, fields={epic_link_custom_field_id: target_epic_issue_key})
jira.update_issue_field(issue_key, fields={epic_link_custom_field_id: target_epic_issue_key})
print(f"updated for {issue_key}")
print("done")

Expand Down
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
# setup.cfg or other tool-specific files.
# https://github.com/carlosperate/awesome-pyproject

[tool.flake8]
max-line-length = 120
exclude = '.tox,docs'

[tool.black]
line-length = 120
include = '(atlassian|examples|tests)\/.*(\.py|GET|POST)'
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mock
-r requirements.txt
flake9
flake8
pytest
pylint
tox
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
[pep8]
max-line-length = 120

[flake8]
max-line-length = 120
ignore = E203,E501
exclude = .tox,docs

[mypy]
ignore_missing_imports = True

Expand Down
6 changes: 3 additions & 3 deletions tests/mockup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import json
import os

from unittest.mock import Mock, MagicMock
from unittest.mock import Mock

from requests import Session, Response

Expand Down Expand Up @@ -47,8 +47,8 @@ def request_mookup(*args, **kwargs):
cur_dict = elem if item is None else elem.get(item, {})
if "links" in cur_dict:
for link in cur_dict["links"].values():
for l in link if type(link) is list else [link]:
l["href"] = "{}/{}".format(SERVER, l["href"])
for ld in link if type(link) is list else [link]:
ld["href"] = "{}/{}".format(SERVER, ld["href"])
if "next" in data:
data["next"] = "{}/{}".format(SERVER, data["next"])

Expand Down
8 changes: 3 additions & 5 deletions tests/test_bitbucket_cloud.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# coding: utf8
import os
import requests
import pytest
import sys

Expand Down Expand Up @@ -62,7 +60,7 @@ def test_get_pipeline_step_log_1(self):
result = BITBUCKET.get_pipeline_step_log(
"TestWorkspace1", "testrepository1", "{PipelineUuid}", "{PipelineStep1Uuid}"
)
assert result == None, "Result of step1 [get_pipeline_step_log(...)]"
assert result is None, "Result of step1 [get_pipeline_step_log(...)]"

@pytest.mark.skipif(sys.version_info < (3, 4), reason="requires python3.4")
def test_get_pipeline_step_log_2(self):
Expand Down Expand Up @@ -129,9 +127,9 @@ def test_get_default_reviewers(self):
@pytest.mark.skipif(sys.version_info < (3, 4), reason="requires python3.4")
def test_is_default_reviewer(self):
result = BITBUCKET.is_default_reviewer("TestWorkspace1", "testrepository1", "DefaultReviewerNo")
assert result == False, "Result of [is_default_reviewer(...)]"
assert result is False, "Result of [is_default_reviewer(...)]"
result = BITBUCKET.is_default_reviewer("TestWorkspace1", "testrepository1", "DefaultReviewer1")
assert result == True, "Result of [is_default_reviewer(...)]"
assert result is True, "Result of [is_default_reviewer(...)]"

@pytest.mark.skipif(sys.version_info < (3, 4), reason="requires python3.4")
def test_delete_default_reviewer(self):
Expand Down
26 changes: 12 additions & 14 deletions tests/test_bitbucket_server.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# coding: utf8
import os
import requests
import pytest
import sys

Expand Down Expand Up @@ -38,7 +36,7 @@ def test_global_permissions(self):

group = BITBUCKET.groups.get("group_a")
assert group.name == "group_a", "Get a group"
assert group.delete() == True, "Delete a group"
assert group.delete() is True, "Delete a group"

result = list(BITBUCKET.users.each())
assert [x.permission for x in result] == [
Expand Down Expand Up @@ -78,7 +76,7 @@ def test_global_permissions(self):

user = BITBUCKET.users.get("jcitizen1")
assert user.name == "jcitizen1", "Get a user"
assert user.delete() == True, "Delete a user"
assert user.delete() is True, "Delete a user"

@pytest.mark.skipif(sys.version_info < (3, 4), reason="requires python3.4")
def test_projects(self):
Expand All @@ -102,9 +100,9 @@ def test_projects(self):
project.description = "New description."
assert project.description == "New description.", "Update the project description"

assert project.public == True, "The project public flag"
assert project.public is True, "The project public flag"
project.public = False
assert project.public == False, "Update the project public flag"
assert project.public is False, "Update the project public flag"

assert project.key == "PRJ", "The project key"
project.key = "NEWKEY"
Expand All @@ -127,7 +125,7 @@ def test_project_permissions(self):

group = project.groups.get("group_a")
assert group.name == "group_a", "Get a group"
assert group.delete() == True, "Delete a group"
assert group.delete() is True, "Delete a group"

result = list(project.users.each())
assert [x.permission for x in result] == ["ADMIN", "WRITE", "READ"], "Each permission of project user"
Expand Down Expand Up @@ -159,7 +157,7 @@ def test_project_permissions(self):

user = project.users.get("jcitizen1")
assert user.name == "jcitizen1", "Get a user"
assert user.delete() == True, "Delete a user"
assert user.delete() is True, "Delete a user"

@pytest.mark.skipif(sys.version_info < (3, 4), reason="requires python3.4")
def test_repositories(self):
Expand Down Expand Up @@ -189,13 +187,13 @@ def test_repositories(self):
repo.description = "New description."
assert repo.description == "New description.", "Update the repo description"

assert repo.public == True, "The repo public flag"
assert repo.public is True, "The repo public flag"
repo.public = False
assert repo.public == False, "Update the repo public flag"
assert repo.public is False, "Update the repo public flag"

assert repo.forkable == True, "The repo forkable flag"
assert repo.forkable is True, "The repo forkable flag"
repo.forkable = False
assert repo.forkable == False, "Update the repo forkable flag"
assert repo.forkable is False, "Update the repo forkable flag"

assert repo.contributing() == "Test contributing.md", "The contributing.md"
assert repo.contributing(at="CommitId") == "Test contributing.md at CommitId", "The contributing.md at CommitId"
Expand Down Expand Up @@ -239,7 +237,7 @@ def test_repository_permissions(self):

group = repo.groups.get("group_a")
assert group.name == "group_a", "Get a group"
assert group.delete() == True, "Delete a group"
assert group.delete() is True, "Delete a group"

result = list(repo.users.each())
assert [x.permission for x in result] == ["ADMIN", "WRITE", "READ"], "Each permission of repo user"
Expand Down Expand Up @@ -267,4 +265,4 @@ def test_repository_permissions(self):

user = repo.users.get("jcitizen1")
assert user.name == "jcitizen1", "Get a user"
assert user.delete() == True, "Delete a user"
assert user.delete() is True, "Delete a user"
15 changes: 7 additions & 8 deletions tests/test_servicedesk.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# coding: utf8
import os
import pytest
import sys

Expand Down Expand Up @@ -54,31 +53,31 @@ def test_create_organization(self):
@pytest.mark.skipif(sys.version_info < (3, 4), reason="requires python3.4")
def test_add_organization(self):
result = SERVICEDESK.add_organization("{serviceDeskId}", "{organizationId}")
assert result == None, "Result of [add_organization(...)]"
assert result is None, "Result of [add_organization(...)]"

@pytest.mark.skipif(sys.version_info < (3, 4), reason="requires python3.4")
def test_remove_organization(self):
result = SERVICEDESK.remove_organization("{serviceDeskId}", "{organizationId}")
assert result == None, "Result of [remove_organization(...)]"
assert result is None, "Result of [remove_organization(...)]"

@pytest.mark.skipif(sys.version_info < (3, 4), reason="requires python3.4")
def test_delete_organization(self):
result = SERVICEDESK.delete_organization("{organizationId}")
assert result == None, "Result of [delete_organization(...)]"
assert result is None, "Result of [delete_organization(...)]"

@pytest.mark.skipif(sys.version_info < (3, 4), reason="requires python3.4")
def test_add_users_to_organization(self):
result = SERVICEDESK.add_users_to_organization(
"{organizationId}", account_list=["{accountId1}", "{accountId2}"]
)
assert result == None, "Result of [add_users_to_organization(...)]"
assert result is None, "Result of [add_users_to_organization(...)]"

@pytest.mark.skipif(sys.version_info < (3, 4), reason="requires python3.4")
def test_remove_users_from_organization(self):
result = SERVICEDESK.remove_users_from_organization(
"{organizationId}", account_list=["{accountId1}", "{accountId2}"]
)
assert result == None, "Result of [remove_users_from_organization(...)]"
assert result is None, "Result of [remove_users_from_organization(...)]"

@pytest.mark.skipif(sys.version_info < (3, 4), reason="requires python3.4")
def test_get_customers(self):
Expand All @@ -88,9 +87,9 @@ def test_get_customers(self):
@pytest.mark.skipif(sys.version_info < (3, 4), reason="requires python3.4")
def test_add_customers(self):
result = SERVICEDESK.add_customers("{serviceDeskId}", list_of_accountids=["{accountId1}", "{accountId2}"])
assert result == None, "Result of [remove_users_from_organization(...)]"
assert result is None, "Result of [remove_users_from_organization(...)]"

@pytest.mark.skipif(sys.version_info < (3, 4), reason="requires python3.4")
def test_remove_customers(self):
result = SERVICEDESK.remove_customers("{serviceDeskId}", list_of_accountids=["{accountId1}", "{accountId2}"])
assert result == None, "Result of [remove_users_from_organization(...)]"
assert result is None, "Result of [remove_users_from_organization(...)]"
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ deps = pytest
commands = pytest -v
extras = kerberos

[testenv:flake9]
[testenv:flake8]
basepython = python3
skip_install = true
deps = flake9 # flake9 is a fork of flake8 which supports pyproject.toml files
deps = flake8
commands = flake8

[testenv:pylint]
Expand Down