From 18fd04d63c6d2622a24516049cd029e13cfb070c Mon Sep 17 00:00:00 2001 From: ibuler Date: Fri, 8 Dec 2017 10:15:27 +0800 Subject: [PATCH] =?UTF-8?q?[Stash]=20Test=20case=20=E9=80=9A=E4=B8=8D?= =?UTF-8?q?=E8=BF=87=EF=BC=8Cimport=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/models.py | 2 + apps/assets/models/__init__.py | 5 +- apps/assets/models/asset.py | 6 +- apps/assets/models/group.py | 2 +- .../templates/assets/admin_user_detail.html | 2 +- .../assets/templates/assets/asset_update.html | 2 +- .../assets/templates/assets/cluster_list.html | 30 +++--- apps/assets/views/asset.py | 13 +-- apps/locale/zh/LC_MESSAGES/django.po | 2 +- .../{test_inventory.py => test_inventory.bak} | 0 .../{test_runner.py => test_runner.bak} | 0 apps/ops/models.py | 5 +- apps/ops/test_utils.py | 34 +++++++ apps/ops/utils.py | 48 +++++++--- apps/perms/models.py | 7 +- apps/users/models/authentication.py | 2 +- apps/users/models/user.py | 2 +- apps/users/models/utils.py | 3 +- apps/users/tests/base.py | 24 ----- apps/users/tests/test_models.py | 95 ------------------- apps/users/tests/test_views.py | 66 ------------- 21 files changed, 113 insertions(+), 237 deletions(-) create mode 100644 apps/assets/models.py rename apps/ops/ansible/{test_inventory.py => test_inventory.bak} (100%) rename apps/ops/ansible/{test_runner.py => test_runner.bak} (100%) create mode 100644 apps/ops/test_utils.py delete mode 100644 apps/users/tests/base.py delete mode 100644 apps/users/tests/test_models.py delete mode 100644 apps/users/tests/test_views.py diff --git a/apps/assets/models.py b/apps/assets/models.py new file mode 100644 index 000000000..ec51c5a2b --- /dev/null +++ b/apps/assets/models.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +# diff --git a/apps/assets/models/__init__.py b/apps/assets/models/__init__.py index 52c68903e..939a1307b 100644 --- a/apps/assets/models/__init__.py +++ b/apps/assets/models/__init__.py @@ -1,9 +1,10 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# +# +print("Import assets model") +from .user import AdminUser, SystemUser from .cluster import * -from .user import * from .group import * from .asset import * from .utils import * diff --git a/apps/assets/models/asset.py b/apps/assets/models/asset.py index cbb1bd59b..00c5b8582 100644 --- a/apps/assets/models/asset.py +++ b/apps/assets/models/asset.py @@ -2,15 +2,15 @@ # -*- coding: utf-8 -*- # -from __future__ import unicode_literals - import uuid from django.db import models import logging from django.utils.translation import ugettext_lazy as _ -from . import Cluster, AssetGroup, AdminUser, SystemUser +from .cluster import Cluster +from .group import AssetGroup +from .user import AdminUser, SystemUser __all__ = ['Asset'] logger = logging.getLogger(__name__) diff --git a/apps/assets/models/group.py b/apps/assets/models/group.py index a90d48f86..49f25e51f 100644 --- a/apps/assets/models/group.py +++ b/apps/assets/models/group.py @@ -10,7 +10,7 @@ from django.db import models import logging from django.utils.translation import ugettext_lazy as _ -from . import SystemUser +from .user import SystemUser __all__ = ['AssetGroup'] logger = logging.getLogger(__name__) diff --git a/apps/assets/templates/assets/admin_user_detail.html b/apps/assets/templates/assets/admin_user_detail.html index 41b930581..7e5e5970d 100644 --- a/apps/assets/templates/assets/admin_user_detail.html +++ b/apps/assets/templates/assets/admin_user_detail.html @@ -321,7 +321,7 @@ $(document).ready(function () { var body = {}; var success = function() { swal('Deleted!', "[ "+name+"]"+" has been deleted ", "success"); - window.location.href="{% url 'assets:idc-list' %}"; + window.location.href="{% url 'assets:cluster-list' %}"; }; var fail = function() { swal("Failed", "Delete"+"[ "+name+" ]"+"failed", "error"); diff --git a/apps/assets/templates/assets/asset_update.html b/apps/assets/templates/assets/asset_update.html index 3853ee15d..7710fff41 100644 --- a/apps/assets/templates/assets/asset_update.html +++ b/apps/assets/templates/assets/asset_update.html @@ -25,7 +25,7 @@

{% trans 'Group' %}

- {% bootstrap_field form.idc layout="horizontal" %} + {% bootstrap_field form.cluster layout="horizontal" %} {% bootstrap_field form.groups layout="horizontal" %}
diff --git a/apps/assets/templates/assets/cluster_list.html b/apps/assets/templates/assets/cluster_list.html index 0d492a703..a91748cc3 100644 --- a/apps/assets/templates/assets/cluster_list.html +++ b/apps/assets/templates/assets/cluster_list.html @@ -7,15 +7,15 @@ {% block table_search %}{% endblock %} {% block table_container %}
- {% trans "Create Cluster" %} + {% trans "Create Cluster" %}
- +
- + @@ -44,19 +44,19 @@
{% trans 'Name' %}{% trans 'Name' %} {% trans 'Asset num' %} {% trans 'Contact' %} {% trans 'Phone' %}