Support tox4, update style to match Black 23.1a1
This aligns code with https://github.com/psf/black/pull/3302 Depends-On: https://review.opendev.org/866943 Change-Id: Icfbca2fab8adeb677b980d01f797f194f580838e
This commit is contained in:
parent
a84d0da632
commit
6b1856b4eb
@ -6,7 +6,6 @@ import jsonfield.fields
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("api", "0001_initial"),
|
||||
]
|
||||
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("actions", "0001_initial"),
|
||||
]
|
||||
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("actions", "0002_action_auto_approve"),
|
||||
]
|
||||
|
@ -6,7 +6,6 @@ import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("tasks", "0001_initial"),
|
||||
("actions", "0003_auto_20190610_0205"),
|
||||
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("actions", "0004_auto_20190610_0209"),
|
||||
]
|
||||
|
@ -100,7 +100,6 @@ def _build_default_email_group(group_name):
|
||||
|
||||
|
||||
class SendAdditionalEmailAction(BaseAction):
|
||||
|
||||
serializer = serializers.SendAdditionalEmailSerializer
|
||||
|
||||
config_group = groups.DynamicNameConfigGroup(
|
||||
|
@ -294,7 +294,6 @@ class UpdateProjectQuotasAction(BaseAction, QuotaMixin):
|
||||
)
|
||||
|
||||
def _get_email(self):
|
||||
|
||||
if CONF.identity.username_is_email:
|
||||
return self.action.task.keystone_user["username"]
|
||||
else:
|
||||
|
@ -322,7 +322,6 @@ class EditUserRolesAction(UserIdAction, ProjectMixin, UserMixin):
|
||||
return True
|
||||
|
||||
def _validate_role_permissions(self):
|
||||
|
||||
id_manager = user_store.IdentityManager()
|
||||
|
||||
current_user_roles = id_manager.get_roles(
|
||||
|
@ -7,7 +7,6 @@ import adjutant.api.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = []
|
||||
|
||||
operations = [
|
||||
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("api", "0001_initial"),
|
||||
]
|
||||
|
@ -5,7 +5,6 @@ import jsonfield.fields
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("api", "0002_auto_20160815_2249"),
|
||||
]
|
||||
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("api", "0003_task_approved_by"),
|
||||
]
|
||||
|
@ -5,7 +5,6 @@ from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
atomic = False
|
||||
|
||||
dependencies = [
|
||||
|
@ -6,7 +6,6 @@ import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("tasks", "0001_initial"),
|
||||
("actions", "0003_auto_20190610_0205"),
|
||||
|
@ -6,7 +6,6 @@ import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("tasks", "0001_initial"),
|
||||
("actions", "0003_auto_20190610_0205"),
|
||||
|
@ -5,7 +5,6 @@ from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("api", "0005_auto_20190610_0209"),
|
||||
("tasks", "0001_initial"),
|
||||
|
@ -29,7 +29,6 @@ from adjutant.config import CONF
|
||||
|
||||
|
||||
class UserList(tasks.InviteUser):
|
||||
|
||||
url = r"^openstack/users/?$"
|
||||
|
||||
config_group = groups.DynamicNameConfigGroup(
|
||||
@ -176,7 +175,6 @@ class UserList(tasks.InviteUser):
|
||||
|
||||
|
||||
class UserDetail(BaseDelegateAPI):
|
||||
|
||||
url = r"^openstack/users/(?P<user_id>\w+)/?$"
|
||||
|
||||
config_group = groups.DynamicNameConfigGroup(
|
||||
@ -263,7 +261,6 @@ class UserDetail(BaseDelegateAPI):
|
||||
|
||||
|
||||
class UserRoles(BaseDelegateAPI):
|
||||
|
||||
url = r"^openstack/users/(?P<user_id>\w+)/roles/?$"
|
||||
|
||||
config_group = groups.DynamicNameConfigGroup(
|
||||
@ -338,7 +335,6 @@ class UserRoles(BaseDelegateAPI):
|
||||
|
||||
|
||||
class RoleList(BaseDelegateAPI):
|
||||
|
||||
url = r"^openstack/roles/?$"
|
||||
|
||||
@utils.mod_or_admin
|
||||
@ -490,7 +486,6 @@ class UpdateProjectQuotas(BaseDelegateAPI):
|
||||
|
||||
@utils.mod_or_admin
|
||||
def post(self, request):
|
||||
|
||||
request.data["project_id"] = request.keystone_user["project_id"]
|
||||
self.project_id = request.keystone_user["project_id"]
|
||||
|
||||
|
@ -29,7 +29,6 @@ from adjutant.api.v1.base import BaseDelegateAPI
|
||||
|
||||
|
||||
class CreateProjectAndUser(BaseDelegateAPI):
|
||||
|
||||
url = r"^actions/CreateProjectAndUser/?$"
|
||||
|
||||
config_group = groups.DynamicNameConfigGroup(
|
||||
@ -84,7 +83,6 @@ class CreateProjectAndUser(BaseDelegateAPI):
|
||||
|
||||
|
||||
class InviteUser(BaseDelegateAPI):
|
||||
|
||||
url = r"^actions/InviteUser/?$"
|
||||
|
||||
task_type = "invite_user_to_project"
|
||||
@ -118,7 +116,6 @@ class InviteUser(BaseDelegateAPI):
|
||||
|
||||
|
||||
class ResetPassword(BaseDelegateAPI):
|
||||
|
||||
url = r"^actions/ResetPassword/?$"
|
||||
|
||||
task_type = "reset_user_password"
|
||||
@ -164,7 +161,6 @@ class ResetPassword(BaseDelegateAPI):
|
||||
|
||||
|
||||
class EditUser(BaseDelegateAPI):
|
||||
|
||||
url = r"^actions/EditUser/?$"
|
||||
|
||||
task_type = "edit_user_roles"
|
||||
@ -186,7 +182,6 @@ class EditUser(BaseDelegateAPI):
|
||||
|
||||
|
||||
class UpdateEmail(BaseDelegateAPI):
|
||||
|
||||
url = r"^actions/UpdateEmail/?$"
|
||||
|
||||
task_type = "update_user_email"
|
||||
|
@ -860,7 +860,6 @@ class DelegateAPITests(AdjutantAPITestCase):
|
||||
self.assertEqual(len(mail.outbox), 3)
|
||||
|
||||
def test_update_email_task_invalid_email(self):
|
||||
|
||||
user = fake_clients.FakeUser(
|
||||
name="test@example.com", password="123", email="test@example.com"
|
||||
)
|
||||
@ -897,7 +896,6 @@ class DelegateAPITests(AdjutantAPITestCase):
|
||||
},
|
||||
)
|
||||
def test_update_email_pre_existing_user_with_email(self):
|
||||
|
||||
user = fake_clients.FakeUser(
|
||||
name="test@example.com", password="123", email="test@example.com"
|
||||
)
|
||||
@ -940,7 +938,6 @@ class DelegateAPITests(AdjutantAPITestCase):
|
||||
},
|
||||
)
|
||||
def test_update_email_user_with_email_username_not_email(self):
|
||||
|
||||
user = fake_clients.FakeUser(
|
||||
name="test", password="123", email="test@example.com"
|
||||
)
|
||||
@ -1006,7 +1003,6 @@ class DelegateAPITests(AdjutantAPITestCase):
|
||||
},
|
||||
)
|
||||
def test_update_email_task_username_not_email(self):
|
||||
|
||||
user = fake_clients.FakeUser(
|
||||
name="test_user", password="123", email="test@example.com"
|
||||
)
|
||||
|
@ -48,7 +48,6 @@ class SingleVersionView(APIView):
|
||||
"""
|
||||
|
||||
def get(self, request):
|
||||
|
||||
version = _VERSIONS.get(self.version, {}).copy()
|
||||
if not version:
|
||||
return Response({"error": "Not Found"}, status=404)
|
||||
|
@ -42,7 +42,6 @@ def get_auth_session():
|
||||
"""Returns a global auth session to be shared by all clients"""
|
||||
global client_auth_session
|
||||
if not client_auth_session:
|
||||
|
||||
auth = v3.Password(
|
||||
username=CONF.identity.auth.username,
|
||||
password=CONF.identity.auth.password,
|
||||
|
@ -217,7 +217,6 @@ class FakeManager(object):
|
||||
|
||||
for assignment in identity_cache["role_assignments"]:
|
||||
if assignment.scope["project"]["id"] == project.id:
|
||||
|
||||
user = users.get(assignment.user["id"])
|
||||
if not user:
|
||||
user = self.get_user(assignment.user["id"])
|
||||
@ -315,7 +314,6 @@ class FakeManager(object):
|
||||
assignment.user["id"] == user.id
|
||||
and assignment.scope["project"]["id"] == project.id
|
||||
):
|
||||
|
||||
if (
|
||||
assignment.scope.get("OS-INHERIT:inherited_to") and not inherited
|
||||
) or (
|
||||
@ -735,13 +733,11 @@ class FakeOctaviaClient(object):
|
||||
|
||||
class FakeTroveClient(object):
|
||||
class FakeTroveQuotaManager(object):
|
||||
|
||||
FakeTroveResource = namedtuple(
|
||||
"FakeTroveResource", ["resource", "in_use", "reserved", "limit"]
|
||||
)
|
||||
|
||||
def __init__(self, region):
|
||||
|
||||
global trove_cache
|
||||
self.region = region
|
||||
if region not in trove_cache:
|
||||
|
@ -143,7 +143,6 @@ class IdentityManager(object): # pragma: no cover
|
||||
def create_user(
|
||||
self, name, password, email, created_on, domain=None, default_project=None
|
||||
):
|
||||
|
||||
user = self.ks_client.users.create(
|
||||
name=name,
|
||||
password=password,
|
||||
|
@ -8,7 +8,6 @@ import jsonfield.fields
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("api", "0005_auto_20190610_0209"),
|
||||
]
|
||||
|
@ -6,7 +6,6 @@ import jsonfield.fields
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("tasks", "0001_initial"),
|
||||
]
|
||||
|
@ -28,7 +28,6 @@ from adjutant import exceptions
|
||||
|
||||
|
||||
def make_task_config(task_class):
|
||||
|
||||
config_group = groups.DynamicNameConfigGroup()
|
||||
config_group.register_child_config(
|
||||
fields.BoolConfig(
|
||||
@ -245,7 +244,6 @@ class BaseTask(object):
|
||||
return hashlib.sha256(str(hashable_list).encode("utf-8")).hexdigest()
|
||||
|
||||
def _handle_duplicates(self, hash_key):
|
||||
|
||||
duplicate_tasks = Task.objects.filter(
|
||||
hash_key=hash_key, completed=0, cancelled=0
|
||||
)
|
||||
@ -468,7 +466,6 @@ class BaseTask(object):
|
||||
token.delete()
|
||||
|
||||
def submit(self, token_data=None, keystone_user=None):
|
||||
|
||||
self.confirm_state(approved=True, completed=False, cancelled=False)
|
||||
|
||||
required_fields = set()
|
||||
|
3
tox.ini
3
tox.ini
@ -1,6 +1,5 @@
|
||||
[tox]
|
||||
envlist = py3,pep8,black_check,cover_report
|
||||
skipsdist = True
|
||||
minversion = 3.1.1
|
||||
ignore_basepython_conflict = True
|
||||
|
||||
@ -15,7 +14,7 @@ commands =
|
||||
find adjutant -type f -name "*.pyc" -delete
|
||||
adjutant-api test {posargs}
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
whitelist_externals =
|
||||
allowlist_externals =
|
||||
find
|
||||
|
||||
[testenv:pep8]
|
||||
|
Loading…
Reference in New Issue
Block a user