Pep8 more fixes 07/24307/1
authorEdan Binshtok <eb578m@intl.att.com>
Sun, 19 Nov 2017 09:42:55 +0000 (11:42 +0200)
committerEdan Binshtok <eb578m@intl.att.com>
Sun, 19 Nov 2017 09:43:15 +0000 (11:43 +0200)
Update base files to pass pep8 strict standarts.

Issue-ID: VVP-25
Change-Id: If9ef80abf7fbc33ea181dfc2eb73c27ddd6ddc3e
Signed-off-by: Edan Binshtok <eb578m@intl.att.com>
253 files changed:
django/engagementmanager/__init__.py
django/engagementmanager/admin.py
django/engagementmanager/apps.py
django/engagementmanager/bus/__init__.py
django/engagementmanager/bus/handlers/__init__.py
django/engagementmanager/bus/handlers/activity_event_handler.py
django/engagementmanager/bus/handlers/check_news_and_announcements_handler.py
django/engagementmanager/bus/handlers/daily_notify_inactive_engagements.py
django/engagementmanager/bus/handlers/daily_notify_inactive_engagements_handler.py
django/engagementmanager/bus/handlers/daily_resend_notifications_handler.py
django/engagementmanager/bus/handlers/digest_email_notification_handler.py
django/engagementmanager/bus/handlers/image_pushed_handler.py [new file with mode: 0644]
django/engagementmanager/bus/handlers/new_notification_handler.py
django/engagementmanager/bus/handlers/service_bus_base_handler.py
django/engagementmanager/bus/messages/__init__.py
django/engagementmanager/bus/messages/activity_event_message.py
django/engagementmanager/bus/messages/daily_scheduled_message.py
django/engagementmanager/bus/messages/hourly_scheduled_message.py
django/engagementmanager/bus/messages/new_notification_message.py
django/engagementmanager/bus/messages/service_bus_base_message.py
django/engagementmanager/cms_client/__init__.py
django/engagementmanager/cms_client/api.py
django/engagementmanager/decorator/__init__.py
django/engagementmanager/decorator/auth.py
django/engagementmanager/decorator/class_decorator.py
django/engagementmanager/decorator/log_func_entry.py
django/engagementmanager/decorator/retry.py
django/engagementmanager/git/__init__.py
django/engagementmanager/git/git_manager.py
django/engagementmanager/http_client.py
django/engagementmanager/mail.py
django/engagementmanager/management/__init__.py
django/engagementmanager/management/commands/__init__.py
django/engagementmanager/management/commands/clean_gitlab_content.py
django/engagementmanager/management/commands/clean_jenkins_jobs.py
django/engagementmanager/management/commands/clean_vvp_db.py
django/engagementmanager/management/commands/clean_vvp_system.py
django/engagementmanager/management/commands/initial_populate_db.py
django/engagementmanager/management/commands/populate_all_gitlab_repo_and_user_and_jenkins.py
django/engagementmanager/management/commands/render_rgwa_credentials.py
django/engagementmanager/migrations/0001_initial.py
django/engagementmanager/migrations/0001_squashed_initial.py
django/engagementmanager/migrations/0002_auto_20160704_1028.py
django/engagementmanager/migrations/0003_auto_20160713_0929.py
django/engagementmanager/migrations/0004_auto_20160720_2143.py
django/engagementmanager/migrations/0005_auto_20160815_1248.py
django/engagementmanager/migrations/0006_auto_20160825_0644.py
django/engagementmanager/migrations/0007_auto_20160922_0421.py
django/engagementmanager/migrations/0008_auto_20161009_1210.py
django/engagementmanager/migrations/0009_auto_20161018_0740.py
django/engagementmanager/migrations/0010_auto_20161025_0838.py
django/engagementmanager/migrations/0011_auto_20161109_0811.py
django/engagementmanager/migrations/0012_auto_20161109_0822.py
django/engagementmanager/migrations/0013_auto_20161128_1159.py
django/engagementmanager/migrations/0014_auto_20161129_1145.py
django/engagementmanager/migrations/0015_engagementstatus.py
django/engagementmanager/migrations/0016_auto_20161208_0842.py
django/engagementmanager/migrations/0017_auto_20161215_1535.py
django/engagementmanager/migrations/0018_set_old_notif_true.py
django/engagementmanager/migrations/0019_auto_20170104_1715.py
django/engagementmanager/migrations/0020_add_indexes_20170108.py
django/engagementmanager/migrations/0021_generate_excel_overview_sheet_procedure_20170110.py
django/engagementmanager/migrations/0022_auto_20170118_1520.py
django/engagementmanager/migrations/0023_auto_20170123_1445.py
django/engagementmanager/migrations/0024_auto_20170227_1224.py
django/engagementmanager/migrations/0025_change_nextsteps_to_new_state.py
django/engagementmanager/migrations/0026_add_slack_handle_to_ice_user_profile.py
django/engagementmanager/migrations/0027_add_version_to_vf.py
django/engagementmanager/migrations/0028_auto_20170425_1310.py
django/engagementmanager/migrations/0029_auto_20170504_0749.py
django/engagementmanager/migrations/0030_engagement_archived_time.py
django/engagementmanager/migrations/0031_auto_20170620_1312.py
django/engagementmanager/migrations/0032_auto_20170702_1435.py
django/engagementmanager/migrations/0033_auto_20170704_0635.py
django/engagementmanager/migrations/0034_engagement_is_with_files.py
django/engagementmanager/migrations/0035_rgwa_fields.py
django/engagementmanager/migrations/0036_auto_20170906_0935.py
django/engagementmanager/migrations/__init__.py
django/engagementmanager/models.py
django/engagementmanager/nextsteps.py
django/engagementmanager/notifications.py
django/engagementmanager/rest/__init__.py
django/engagementmanager/rest/activation.py
django/engagementmanager/rest/activity.py
django/engagementmanager/rest/checklist.py
django/engagementmanager/rest/checklist_audit_log.py
django/engagementmanager/rest/checklist_decision.py
django/engagementmanager/rest/checklist_set_state.py
django/engagementmanager/rest/cms/__init__.py
django/engagementmanager/rest/cms/pages.py
django/engagementmanager/rest/cms/posts.py
django/engagementmanager/rest/csrf_exempt_session_authentication.py
django/engagementmanager/rest/data_loader.py
django/engagementmanager/rest/deployment_target.py
django/engagementmanager/rest/deployment_target_site.py
django/engagementmanager/rest/ecomp.py
django/engagementmanager/rest/engagement.py
django/engagementmanager/rest/feedback.py
django/engagementmanager/rest/invite.py
django/engagementmanager/rest/login.py
django/engagementmanager/rest/nextsteps.py
django/engagementmanager/rest/notification.py
django/engagementmanager/rest/parsers.py
django/engagementmanager/rest/signup.py
django/engagementmanager/rest/user.py
django/engagementmanager/rest/validation_details.py
django/engagementmanager/rest/vendor.py
django/engagementmanager/rest/vf.py
django/engagementmanager/rest/vfc.py
django/engagementmanager/rest/vvp_api_view.py
django/engagementmanager/scheduled_jobs.py
django/engagementmanager/serializers.py
django/engagementmanager/service/__init__.py
django/engagementmanager/service/activities_service.py
django/engagementmanager/service/authorization_service.py
django/engagementmanager/service/base_service.py
django/engagementmanager/service/bus_service.py
django/engagementmanager/service/checklist_audit_log_service.py
django/engagementmanager/service/checklist_decision_service.py
django/engagementmanager/service/checklist_service.py
django/engagementmanager/service/checklist_state_service.py
django/engagementmanager/service/cms/__init__.py
django/engagementmanager/service/cms/base_cms.py
django/engagementmanager/service/cms/pages_service.py
django/engagementmanager/service/cms/posts_service.py
django/engagementmanager/service/deploment_target_service.py
django/engagementmanager/service/ecomp_service.py
django/engagementmanager/service/engagement_service.py
django/engagementmanager/service/invite_service.py
django/engagementmanager/service/logging_service.py
django/engagementmanager/service/login_service.py
django/engagementmanager/service/nextstep_service.py
django/engagementmanager/service/user_service.py
django/engagementmanager/service/vf_service.py
django/engagementmanager/service/vfc_service.py
django/engagementmanager/slack_client/__init__.py
django/engagementmanager/slack_client/api.py
django/engagementmanager/templatetags/__init__.py
django/engagementmanager/templatetags/vvptags.py
django/engagementmanager/tests/__init__.py
django/engagementmanager/tests/test_access_credentials.py
django/engagementmanager/tests/test_activation.py
django/engagementmanager/tests/test_activities.py
django/engagementmanager/tests/test_add_contact.py
django/engagementmanager/tests/test_add_feedback.py
django/engagementmanager/tests/test_add_next_step_to_checklist.py
django/engagementmanager/tests/test_audit_log_and_decision_api.py
django/engagementmanager/tests/test_auth_service.py
django/engagementmanager/tests/test_base_entity.py
django/engagementmanager/tests/test_base_transaction_entity.py
django/engagementmanager/tests/test_checklist.py
django/engagementmanager/tests/test_checklist_template.py
django/engagementmanager/tests/test_cms_documentation_search.py
django/engagementmanager/tests/test_cms_pages.py
django/engagementmanager/tests/test_cms_posts.py
django/engagementmanager/tests/test_deployment_target_sites.py
django/engagementmanager/tests/test_digest_email_notifications.py
django/engagementmanager/tests/test_eng_progress.py
django/engagementmanager/tests/test_eng_status.py
django/engagementmanager/tests/test_engagement_admin_operations.py
django/engagementmanager/tests/test_engagement_export.py
django/engagementmanager/tests/test_expanded_eng.py
django/engagementmanager/tests/test_import_engagement_xls.py
django/engagementmanager/tests/test_invite_members.py
django/engagementmanager/tests/test_next_steps.py
django/engagementmanager/tests/test_next_steps_api.py
django/engagementmanager/tests/test_notify_inactive_engagements.py
django/engagementmanager/tests/test_pull_notifications.py
django/engagementmanager/tests/test_rados_gateway.py
django/engagementmanager/tests/test_remove_user_from_eng_team.py
django/engagementmanager/tests/test_request_data_manager.py
django/engagementmanager/tests/test_resend_activation_email.py
django/engagementmanager/tests/test_reset_password.py
django/engagementmanager/tests/test_rgwa_client.py
django/engagementmanager/tests/test_set_checklist_state.py
django/engagementmanager/tests/test_set_eng_stage.py
django/engagementmanager/tests/test_update_password.py
django/engagementmanager/tests/test_update_user_account.py
django/engagementmanager/tests/test_vfc.py
django/engagementmanager/tests/vvpEntitiesCreator.py
django/engagementmanager/urls.py
django/engagementmanager/utils/__init__.py
django/engagementmanager/utils/activities_data.py
django/engagementmanager/utils/authentication.py
django/engagementmanager/utils/choice_enum.py
django/engagementmanager/utils/constants.py
django/engagementmanager/utils/cryptography.py
django/engagementmanager/utils/dates.py
django/engagementmanager/utils/exception_handler.py
django/engagementmanager/utils/exception_message_factory.py
django/engagementmanager/utils/request_data_mgr.py
django/engagementmanager/utils/validator.py
django/engagementmanager/utils/vvp_exceptions.py
django/engagementmanager/views_helper.py
django/engagementmanager/vm_integration/__init__.py
django/engagementmanager/vm_integration/em_api.py
django/engagementmanager/vm_integration/vm_client.py
django/manage.py
django/mocks/__init__.py
django/mocks/gitlab_mock/__init__.py
django/mocks/gitlab_mock/rest/__init__.py
django/mocks/gitlab_mock/rest/gitlab_files_respons_rest.py
django/mocks/gitlab_mock/services/__init__.py
django/mocks/gitlab_mock/services/gitlab_files_service.py
django/mocks/jenkins_mock/__init__.py
django/mocks/jenkins_mock/rest/__init__.py
django/mocks/jenkins_mock/rest/jenkins_tests_validation_rest.py
django/mocks/jenkins_mock/services/__init__.py
django/mocks/jenkins_mock/services/jenkins_tests_validation_service.py
django/requirements.txt
django/rgwa_mock/__init__.py
django/rgwa_mock/services/__init__.py
django/rgwa_mock/services/rgwa_keys_service.py
django/tools/__init__.py
django/tox.ini
django/validationmanager/__init__.py
django/validationmanager/admin.py
django/validationmanager/apps.py
django/validationmanager/em_integration/__init__.py
django/validationmanager/em_integration/em_client.py
django/validationmanager/em_integration/vm_api.py
django/validationmanager/git/__init__.py
django/validationmanager/git/gitlab_client.py
django/validationmanager/jenkins/__init__.py
django/validationmanager/jenkins/jenkins_client.py
django/validationmanager/migrations/0001_initial.py
django/validationmanager/migrations/0002_auto_20161019_2056.py
django/validationmanager/migrations/0003_auto_20170423_0531.py
django/validationmanager/migrations/__init__.py
django/validationmanager/models.py
django/validationmanager/rados/__init__.py
django/validationmanager/rados/rgwa_client.py
django/validationmanager/rados/rgwa_client_factory.py
django/validationmanager/rest/__init__.py
django/validationmanager/rest/git_webhook_endpoint.py
django/validationmanager/rest/http_response_custom.py
django/validationmanager/rest/jenkins_webhook_endpoint.py
django/validationmanager/tasks.py [new file with mode: 0644]
django/validationmanager/templates/imagescanner_job_config.xml [new file with mode: 0644]
django/validationmanager/tests/__init__.py
django/validationmanager/tests/testFinishedSignal.py
django/validationmanager/tests/test_git_push.py
django/validationmanager/tests/test_rgwa_client_factory.py
django/validationmanager/urls.py
django/validationmanager/utils/__init__.py
django/validationmanager/utils/clients.py
django/validationmanager/utils/constants.py
django/validationmanager/utils/keyawaredefaultdict.py
django/vvp/__init__.py
django/vvp/settings/tox_settings.py
django/vvp/urls.py
django/vvp/wsgi.py
tox.ini

index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 38a63f8..28d1675 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -44,8 +44,14 @@ from engagementmanager import models
 @admin.register(models.Activity)
 class ActivityModelAdmin(admin.ModelAdmin):
 
-    list_display = ["engagement_manual_id", "vf_name", "description",
-                    "activity_type", "activity_owner", "create_time", "is_notification"]
+    list_display = [
+        "engagement_manual_id",
+        "vf_name",
+        "description",
+        "activity_type",
+        "activity_owner",
+        "create_time",
+        "is_notification"]
     list_filter = ["activity_type", "is_notification"]
 
     def engagement_manual_id(self, obj):
@@ -69,8 +75,19 @@ class ActivityModelAdmin(admin.ModelAdmin):
 @admin.register(models.Checklist)
 class ChecklistModelAdmin(admin.ModelAdmin):
 
-    list_display = ["name", "state", "engagement_manual_id", "vf_name", "validation_cycle",
-                    "weight", "template", "owner", "creator", "associated_files", "create_time", "update_time"]
+    list_display = [
+        "name",
+        "state",
+        "engagement_manual_id",
+        "vf_name",
+        "validation_cycle",
+        "weight",
+        "template",
+        "owner",
+        "creator",
+        "associated_files",
+        "create_time",
+        "update_time"]
     list_filter = ["template", "state"]
     search_fields = ["name", "associated_files"]
 
@@ -84,7 +101,8 @@ class ChecklistModelAdmin(admin.ModelAdmin):
 @admin.register(models.ChecklistAuditLog)
 class ChecklistAuditLogModelAdmin(admin.ModelAdmin):
 
-    list_display = ["description", "creator", "checklist", "create_time", "update_time"]
+    list_display = ["description", "creator",
+                    "checklist", "create_time", "update_time"]
     list_filter = ["category"]
     search_fields = ["description"]
 
@@ -92,7 +110,8 @@ class ChecklistAuditLogModelAdmin(admin.ModelAdmin):
 @admin.register(models.ChecklistDecision)
 class ChecklistDecisionModelAdmin(admin.ModelAdmin):
 
-    list_display = ["checklist", "lineitem", "review_value", "peer_review_value", "create_time", "update_time"]
+    list_display = ["checklist", "lineitem", "review_value",
+                    "peer_review_value", "create_time", "update_time"]
     list_filter = ["template"]
     search_fields = ["name"]
 
@@ -100,7 +119,8 @@ class ChecklistDecisionModelAdmin(admin.ModelAdmin):
 @admin.register(models.ChecklistLineItem)
 class ChecklistLineItemModelAdmin(admin.ModelAdmin):
 
-    list_display = ["name", "weight", "template", "section", "create_time", "update_time"]
+    list_display = ["name", "weight", "template",
+                    "section", "create_time", "update_time"]
     list_filter = ["template", "section"]
     search_fields = ["name"]
 
@@ -108,14 +128,16 @@ class ChecklistLineItemModelAdmin(admin.ModelAdmin):
 @admin.register(models.ChecklistSection)
 class ChecklistSectionModelAdmin(admin.ModelAdmin):
 
-    list_display = ["name", "weight", "template", "parent_section", "create_time", "update_time"]
+    list_display = ["name", "weight", "template",
+                    "parent_section", "create_time", "update_time"]
     list_filter = ["template"]
 
 
 @admin.register(models.ChecklistTemplate)
 class ChecklistTemplateModelAdmin(admin.ModelAdmin):
 
-    list_display = ["name", "category", "version", "create_time", "update_time"]
+    list_display = ["name", "category",
+                    "version", "create_time", "update_time"]
     list_filter = ["category", "version"]
     search_fields = ["name"]
     search_fields = ["name"]
@@ -137,8 +159,16 @@ class DeploymentTargetSiteModelAdmin(admin.ModelAdmin):
 @admin.register(models.Engagement)
 class EngagementModelAdmin(admin.ModelAdmin):
 
-    list_display = ["engagement_manual_id", "vf_name", "deployment_target_name", "ecomp_release", "progress", "target_completion_date",
-                    "target_lab_entry_date", "engagement_stage", "create_time"]
+    list_display = [
+        "engagement_manual_id",
+        "vf_name",
+        "deployment_target_name",
+        "ecomp_release",
+        "progress",
+        "target_completion_date",
+        "target_lab_entry_date",
+        "engagement_stage",
+        "create_time"]
     list_editable = ["progress", "target_completion_date", "engagement_stage"]
     list_filter = ["engagement_stage"]
     search_fields = ["engagement_stage", "engagement_manual_id"]
@@ -165,7 +195,8 @@ class EngagementModelAdmin(admin.ModelAdmin):
 @admin.register(models.EngagementStatus)
 class EngagementStatusModelAdmin(admin.ModelAdmin):
 
-    list_display = ["engagement_manual_id", "vf_name", "description", "creator_full_name", "create_time", "update_time"]
+    list_display = ["engagement_manual_id", "vf_name", "description",
+                    "creator_full_name", "create_time", "update_time"]
     list_filter = ["creator"]
     search_fields = ["description"]
 
@@ -189,8 +220,16 @@ class ECOMPReleaseModelAdmin(admin.ModelAdmin):
 @admin.register(models.IceUserProfile)
 class IceUserProfileModelAdmin(admin.ModelAdmin):
 
-    list_display = ["full_name", "email", "phone_number", "company_name", "role_name", "is_service_provider_contact", "has_ssh_key",
-                    "create_time", "role"]
+    list_display = [
+        "full_name",
+        "email",
+        "phone_number",
+        "company_name",
+        "role_name",
+        "is_service_provider_contact",
+        "has_ssh_key",
+        "create_time",
+        "role"]
     list_editable = ["phone_number", "is_service_provider_contact", "role"]
     list_filter = ["is_service_provider_contact", "role", "company"]
     search_fields = ["full_name", "email", "phone_number"]
@@ -216,16 +255,24 @@ class IceUserProfileModelAdmin(admin.ModelAdmin):
 @admin.register(models.Invitation)
 class InvitationModelAdmin(admin.ModelAdmin):
 
-    list_display = ["email", "engagement_manual_id", "vf_name",
-                    "invited_by_user", "accepted", "create_time", "invitation_token"]
+    list_display = [
+        "email",
+        "engagement_manual_id",
+        "vf_name",
+        "invited_by_user",
+        "accepted",
+        "create_time",
+        "invitation_token"]
     list_filter = ["accepted"]
     search_fields = ["email", "invitation_token"]
 
     def invited_by_user(self, obj):
-        return models.IceUserProfile.objects.get(uuid=obj.invited_by_user_uuid).full_name
+        return models.IceUserProfile.objects.get(
+            uuid=obj.invited_by_user_uuid).full_name
 
     def engagement_manual_id(self, obj):
-        return models.Engagement.objects.get(uuid=obj.engagement_uuid).engagement_manual_id
+        return models.Engagement.objects.get(
+            uuid=obj.engagement_uuid).engagement_manual_id
 
     def vf_name(self, obj):
         e = models.Engagement.objects.get(uuid=obj.engagement_uuid)
@@ -235,8 +282,20 @@ class InvitationModelAdmin(admin.ModelAdmin):
 @admin.register(models.NextStep)
 class NextStepModelAdmin(admin.ModelAdmin):
 
-    list_display = ["engagement_manual_id", "vf_name", "description", "files", "due_date", "last_updater_full_name", "last_update_time",
-                    "last_update_type", "creator_full_name", "create_time", "state", "next_step_type", "owner_full_name"]
+    list_display = [
+        "engagement_manual_id",
+        "vf_name",
+        "description",
+        "files",
+        "due_date",
+        "last_updater_full_name",
+        "last_update_time",
+        "last_update_type",
+        "creator_full_name",
+        "create_time",
+        "state",
+        "next_step_type",
+        "owner_full_name"]
     list_filter = ["next_step_type", "state"]
     search_fields = ["description", "files"]
 
@@ -284,8 +343,14 @@ class NextStepModelAdmin(admin.ModelAdmin):
 @admin.register(models.Notification)
 class NotificationModelAdmin(admin.ModelAdmin):
 
-    list_display = ["activity_description", "activity_type", "engagement_manual_id",
-                    "vf_name", "is_sent", "is_read", "activity_create_time"]
+    list_display = [
+        "activity_description",
+        "activity_type",
+        "engagement_manual_id",
+        "vf_name",
+        "is_sent",
+        "is_read",
+        "activity_create_time"]
     list_filter = ["is_sent", "is_read"]
 
     def activity_description(self, obj):
@@ -305,7 +370,8 @@ class NotificationModelAdmin(admin.ModelAdmin):
 
     def vf_name(self, obj):
         if obj.activity.engagement:
-            return models.VF.objects.get(engagement=obj.activity.engagement).name
+            return models.VF.objects.get(
+                engagement=obj.activity.engagement).name
         else:
             return ""
 
@@ -313,7 +379,8 @@ class NotificationModelAdmin(admin.ModelAdmin):
 @admin.register(models.RecentEngagement)
 class RecentEngagementModelAdmin(admin.ModelAdmin):
 
-    list_display = ["engagement_manual_id", "vf_name", "ice_user", "action_type", "last_update"]
+    list_display = ["engagement_manual_id", "vf_name",
+                    "ice_user", "action_type", "last_update"]
     list_filter = ["action_type"]
 
     def vf_name(self, obj):
@@ -343,9 +410,19 @@ class VendorModelAdmin(admin.ModelAdmin):
 @admin.register(models.VF)
 class VFModelAdmin(admin.ModelAdmin):
 
-    list_display = ["name", "deployment_target", "ecomp_release", "progress", "target_completion_date",
-                    "target_lab_entry_date", "is_service_provider_internal", "git_repo_url", "engagement_stage", "engagement_manual_id"]
-    list_filter = ["deployment_target", "ecomp_release", "is_service_provider_internal", "vendor"]
+    list_display = [
+        "name",
+        "deployment_target",
+        "ecomp_release",
+        "progress",
+        "target_completion_date",
+        "target_lab_entry_date",
+        "is_service_provider_internal",
+        "git_repo_url",
+        "engagement_stage",
+        "engagement_manual_id"]
+    list_filter = ["deployment_target", "ecomp_release",
+                   "is_service_provider_internal", "vendor"]
     list_editable = ["is_service_provider_internal"]
     search_fields = ["name", "git_repo_url"]
 
@@ -365,7 +442,8 @@ class VFModelAdmin(admin.ModelAdmin):
 @admin.register(models.VFC)
 class VFCModelAdmin(admin.ModelAdmin):
 
-    list_display = ["name", "external_ref_id", "ice_mandated", "vf_name", "company_name", "engagement_manual_id"]
+    list_display = ["name", "external_ref_id", "ice_mandated",
+                    "vf_name", "company_name", "engagement_manual_id"]
     list_filter = ["ice_mandated", "company"]
     list_editable = ["external_ref_id", "ice_mandated"]
     search_fields = ["name", "external_ref_id"]
index e4a967d..950fe20 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -41,6 +41,8 @@ from django.conf import settings
 from engagementmanager.scheduled_jobs import ScheduledJobs
 from engagementmanager.service.logging_service import LoggingServiceFactory
 
+logger = LoggingServiceFactory.get_logger()
+
 cms_client = None
 bus_service = None
 
@@ -52,12 +54,13 @@ class EngagementmanagerConfig(AppConfig):
     def ready(self):
         # This otherwise unused import causes the signal receivers
         # to register themselves at the appropriate time. Do not remove.
+        # We use logger.debug to ignore flake8's warning about unused import.
         import engagementmanager.vm_integration.em_api
+        logger.debug(engagementmanager.vm_integration.em_api.file_name)
         ###############################
         # Bootstrap Actions           #
         ###############################
         from engagementmanager.utils.constants import Constants
-        logger = LoggingServiceFactory.get_logger()
 
         if (settings.DOMAIN == Constants.prodDomain):
             logger.info("--Production Mode--")
@@ -77,20 +80,39 @@ class EngagementmanagerConfig(AppConfig):
         ice_scheduler.setup_hourly_job()
 
     def __register_bus_service_handlers(self):
-        from engagementmanager.bus.messages.activity_event_message import ActivityEventMessage
-        from engagementmanager.bus.messages.daily_scheduled_message import DailyScheduledMessage
-        from engagementmanager.bus.messages.new_notification_message import NewNotificationMessage
-        from engagementmanager.bus.handlers.activity_event_handler import ActivityEventHandler
-        from engagementmanager.bus.handlers.daily_resend_notifications_handler import DailyResendNotificationsHandler
-        from engagementmanager.bus.handlers.digest_email_notification_handler import DigestEmailNotificationHandler
-        from engagementmanager.bus.handlers.new_notification_handler import NewNotificationHandler
-        from engagementmanager.bus.messages.hourly_scheduled_message import HourlyScheduledMessage
-        from engagementmanager.bus.handlers.check_news_and_announcements_handler import CheckNewsAndAnnouncementsHandler
-        from engagementmanager.bus.handlers.daily_notify_inactive_engagements_handler import DailyNotifyInactiveEngagementsHandler
+        from engagementmanager.bus.messages.activity_event_message import \
+            ActivityEventMessage
+        from engagementmanager.bus.messages.daily_scheduled_message import \
+            DailyScheduledMessage
+        from engagementmanager.bus.messages.new_notification_message import \
+            NewNotificationMessage
+        from engagementmanager.bus.handlers.activity_event_handler import\
+            ActivityEventHandler
+        from engagementmanager.bus.handlers.daily_resend_notifications_handler\
+            import DailyResendNotificationsHandler
+        from engagementmanager.bus.handlers.digest_email_notification_handler\
+            import DigestEmailNotificationHandler
+        from engagementmanager.bus.handlers.new_notification_handler\
+            import NewNotificationHandler
+        from engagementmanager.bus.messages.hourly_scheduled_message\
+            import HourlyScheduledMessage
+        from engagementmanager.bus.handlers.\
+            check_news_and_announcements_handler import \
+            CheckNewsAndAnnouncementsHandler
+        from engagementmanager.bus.handlers.\
+            daily_notify_inactive_engagements_handler import \
+            DailyNotifyInactiveEngagementsHandler
+        from engagementmanager.bus.handlers.image_pushed_handler import \
+            ImagePushedHandler
 
         bus_service.register(ActivityEventHandler(), ActivityEventMessage)
         bus_service.register(NewNotificationHandler(), NewNotificationMessage)
-        bus_service.register(DigestEmailNotificationHandler(), DailyScheduledMessage)
-        bus_service.register(DailyResendNotificationsHandler(), DailyScheduledMessage)
-        bus_service.register(DailyNotifyInactiveEngagementsHandler(), DailyScheduledMessage)
-        bus_service.register(CheckNewsAndAnnouncementsHandler(), HourlyScheduledMessage)
+        bus_service.register(
+            DigestEmailNotificationHandler(), DailyScheduledMessage)
+        bus_service.register(
+            DailyResendNotificationsHandler(), DailyScheduledMessage)
+        bus_service.register(
+            DailyNotifyInactiveEngagementsHandler(), DailyScheduledMessage)
+        bus_service.register(
+            CheckNewsAndAnnouncementsHandler(), HourlyScheduledMessage)
+        bus_service.register(ImagePushedHandler(), HourlyScheduledMessage)
\ No newline at end of file
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index d5ef819..96ce260 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -36,7 +36,8 @@
 # ============LICENSE_END============================================
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
-from engagementmanager.bus.handlers.service_bus_base_handler import ServiceBusBaseHandler
+from engagementmanager.bus.handlers.service_bus_base_handler import \
+    ServiceBusBaseHandler
 from engagementmanager.service.activities_service import ActivitiesSvc
 from engagementmanager.service.logging_service import LoggingServiceFactory
 
@@ -47,6 +48,7 @@ class ActivityEventHandler(ServiceBusBaseHandler):
     activities_service = ActivitiesSvc()
 
     def handle_message(self, bus_message):
-        logger.info("New ICE event from type '%s' arrived, activity will be generated." %
-                    bus_message.activity_data.activity_type.name)
+        logger.info(
+            "New ICE event from type '%s' arrived, activity will be generated"
+            % bus_message.activity_data.activity_type.name)
         self.activities_service.generate_activity(bus_message.activity_data)
index 6ef4fdb..c503346 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -36,7 +36,8 @@
 # ============LICENSE_END============================================
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
-from engagementmanager.bus.handlers.service_bus_base_handler import ServiceBusBaseHandler
+from engagementmanager.bus.handlers.service_bus_base_handler import \
+    ServiceBusBaseHandler
 from engagementmanager.service.logging_service import LoggingServiceFactory
 
 logger = LoggingServiceFactory.get_logger()
@@ -44,6 +45,8 @@ logger = LoggingServiceFactory.get_logger()
 
 class CheckNewsAndAnnouncementsHandler(ServiceBusBaseHandler):
     def handle_message(self, bus_message):
-        logger.debug("New hourly scheduled message arrived, will check for news and announcements and send notification"
-                     " if needed.")
+        logger.debug(
+            "New hourly scheduled message arrived, will check " +
+            "for news and announcements and send notification"
+            " if needed.")
         pass
index 598b977..2ac3581 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -39,7 +39,8 @@
 from django.db.models.query_utils import Q
 from django.utils import timezone
 from django.utils.timezone import timedelta
-from engagementmanager.bus.handlers.service_bus_base_handler import ServiceBusBaseHandler
+from engagementmanager.bus.handlers.service_bus_base_handler import \
+    ServiceBusBaseHandler
 from engagementmanager.models import Engagement, VF
 from engagementmanager.service.activities_service import ActivitiesSvc
 from engagementmanager.service.checklist_service import CheckListSvc
@@ -52,10 +53,14 @@ logger = LoggingServiceFactory.get_logger()
 
 
 class DailyNotifyInactiveEngagements(ServiceBusBaseHandler):
+
     def handle_message(self, bus_message):
         logger.debug("New digest bus message arrived - email is about to sent")
         checklist_service = CheckListSvc()
-        engagements_list = Engagement.objects.filter(is_with_files=False, Q(engagement_stage=EngagementStage.Active.name) | Q(engagement_stage=EngagementStage.Intake.name))
+        engagements_list = Engagement.objects.filter(
+            Q(engagement_stage=EngagementStage.Active.name) | Q(
+                engagement_stage=EngagementStage.Intake.name),
+            is_with_files=False)
 
         for engagement in engagements_list:
             files_found = checklist_service.getEngagementFiles(engagement.uuid)
@@ -67,7 +72,10 @@ class DailyNotifyInactiveEngagements(ServiceBusBaseHandler):
             max_empty_time = self.get_max_empty_date(engagement.create_time)
 
             if max_empty_time < timezone.now():
-                archive_engagement(engagement.uuid, "More than 30 days passed and no files added to gitlab yet")
+                archive_engagement(
+                    engagement.uuid,
+                    "More than 30 days passed and no files \
+                    added to gitlab yet")
             else:
                 self.send_emails_logic(engagement)
 
@@ -81,13 +89,21 @@ class DailyNotifyInactiveEngagements(ServiceBusBaseHandler):
 
     def send_emails_logic(self, engagement):
 
-        delta_days_from_creation = self.get_days_delta(engagement.create_time, timezone.now())
+        delta_days_from_creation = self.get_days_delta(
+            engagement.create_time, timezone.now())
         alert_days = [7, 14, 21]
-        if (delta_days_from_creation in alert_days) or (delta_days_from_creation >= 23 and delta_days_from_creation < 30):
+        if (delta_days_from_creation in alert_days) or (
+                delta_days_from_creation >= 23 and
+                delta_days_from_creation < 30):
             vf = VF.objects.get(engagement=engagement)
             vf_name = vf.name
-            max_empty_time = self.get_max_empty_date(engagement.create_time).strftime('%b %d, %Y')
+            max_empty_time = self.get_max_empty_date(
+                engagement.create_time).strftime('%b %d, %Y')
             git_repo_url = vf.git_repo_url
             activity_data = NoticeEmptyEngagementData(
-                vf_name, max_empty_time, git_repo_url, str(delta_days_from_creation), engagement)
+                vf_name,
+                max_empty_time,
+                git_repo_url,
+                str(delta_days_from_creation),
+                engagement)
             ActivitiesSvc().generate_activity(activity_data)
index 12acea1..96f25a2 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -38,7 +38,8 @@
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
 from django.utils import timezone
 from django.utils.timezone import timedelta
-from engagementmanager.bus.handlers.service_bus_base_handler import ServiceBusBaseHandler
+from engagementmanager.bus.handlers.service_bus_base_handler import \
+    ServiceBusBaseHandler
 from engagementmanager.models import Engagement, VF
 from engagementmanager.service.activities_service import ActivitiesSvc
 from engagementmanager.service.checklist_service import CheckListSvc
@@ -52,9 +53,11 @@ logger = LoggingServiceFactory.get_logger()
 
 class DailyNotifyInactiveEngagementsHandler(ServiceBusBaseHandler):
     def handle_message(self, bus_message):
-        logger.debug("New digest bus message arrived - email is about to sent")
+        logger.debug("New digest bus message arrived -" +
+                     "email is about to sent")
         checklist_service = CheckListSvc()
-        engagements_list = Engagement.objects.filter(is_with_files=False, engagement_stage=EngagementStage.Active.name)
+        engagements_list = Engagement.objects.filter(
+            is_with_files=False, engagement_stage=EngagementStage.Active.name)
 
         for engagement in engagements_list:
             files_found = checklist_service.getEngagementFiles(engagement.uuid)
@@ -66,7 +69,10 @@ class DailyNotifyInactiveEngagementsHandler(ServiceBusBaseHandler):
             max_empty_time = self.get_max_empty_date(engagement.create_time)
 
             if max_empty_time < timezone.now():
-                archive_engagement(engagement.uuid, "More than 30 days passed and no files added to gitlab yet")
+                archive_engagement(
+                    engagement.uuid,
+                    "More than 30 days passed and no " +
+                    "files added to gitlab yet")
             else:
                 self.send_emails_logic(engagement)
 
@@ -78,13 +84,21 @@ class DailyNotifyInactiveEngagementsHandler(ServiceBusBaseHandler):
 
     def send_emails_logic(self, engagement):
 
-        delta_days_from_creation = self.get_days_delta(engagement.create_time, timezone.now())
+        delta_days_from_creation = self.get_days_delta(
+            engagement.create_time, timezone.now())
         alert_days = [7, 14, 21]
-        if (delta_days_from_creation in alert_days) or (delta_days_from_creation >= 23 and delta_days_from_creation < 30):
+        if (delta_days_from_creation in alert_days) or (
+                delta_days_from_creation >= 23 and
+                delta_days_from_creation < 30):
             vf = VF.objects.get(engagement=engagement)
             vf_name = vf.name
-            max_empty_time = self.get_max_empty_date(engagement.create_time).strftime('%b %d, %Y')
+            max_empty_time = self.get_max_empty_date(
+                engagement.create_time).strftime('%b %d, %Y')
             git_repo_url = vf.git_repo_url
             activity_data = NoticeEmptyEngagementData(
-                vf_name, max_empty_time, git_repo_url, str(delta_days_from_creation), engagement)
+                vf_name,
+                max_empty_time,
+                git_repo_url,
+                str(delta_days_from_creation),
+                engagement)
             ActivitiesSvc().generate_activity(activity_data)
index 9919cad..b7396cc 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -39,7 +39,8 @@
 import json
 from django.template.loader import get_template
 from engagementmanager import mail
-from engagementmanager.bus.handlers.service_bus_base_handler import ServiceBusBaseHandler
+from engagementmanager.bus.handlers.service_bus_base_handler import \
+    ServiceBusBaseHandler
 from engagementmanager.mail import sendMail
 from engagementmanager.models import Notification
 from engagementmanager.utils.constants import Constants
@@ -50,26 +51,42 @@ logger = LoggingServiceFactory.get_logger()
 
 class DailyResendNotificationsHandler(ServiceBusBaseHandler):
     def handle_message(self, bus_message):
-        logger.debug("New resend notifications message arrived - emails is about to sent to the "
-                     "all unsent notifications")
+        logger.debug(
+            "New resend notifications message arrived - " +
+            "emails is about to sent to the " +
+            "all unsent notifications")
         unsent_notifications = Notification.objects.filter(is_sent=False)
         for notification in unsent_notifications:
             if notification.user.email_updates_on_every_notification:
                 try:
-                    subject_template = get_template("{notification_template_dir}notification_mail_subject.html".format(
-                        notification_template_dir=Constants.notification_template_dir))
-                    msg_template = get_template("{notification_template_dir}notification_mail_body.html".format(
-                        notification_template_dir=Constants.notification_template_dir))
+                    subject_template = get_template(
+                        "{notification_template_dir}\
+                        notification_mail_subject.html".format(
+                            notification_template_dir=Constants.
+                            notification_template_dir))
+                    msg_template = get_template(
+                        "{notification_template_dir}\
+                        notification_mail_body.html".format(
+                            notification_template_dir=Constants.
+                            notification_template_dir))
 
-                    sendMail(notification.user.email, json.loads(notification.activity.metadata),
-                             msg_template, subject_template, mail_from=mail.ice_admin_mail_from)
+                    sendMail(
+                        notification.user.email,
+                        json.loads(
+                            notification.activity.metadata),
+                        msg_template,
+                        subject_template,
+                        mail_from=mail.ice_admin_mail_from)
                     notification.is_sent = True
                     notification.save()
                 except Exception as e:
-                    msg = "Something went wrong while trying to resend bulk mail " \
+                    msg = "Something went wrong while trying \
+                    to resend bulk mail " \
                           "as part of the notifications daily resend"
                     logger.error(msg + " " + e)
             else:
                 notification.is_sent = True
                 notification.save()
-                logger.info("User choose not to get email on every notification, set it as sent.")
+                logger.info(
+                    "User choose not to get email on every \
+                    notification, set it as sent.")
index 7f5cb6b..7ab475a 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -39,7 +39,8 @@
 from datetime import datetime
 from django.template.loader import get_template
 from engagementmanager import mail
-from engagementmanager.bus.handlers.service_bus_base_handler import ServiceBusBaseHandler
+from engagementmanager.bus.handlers.service_bus_base_handler import \
+    ServiceBusBaseHandler
 from engagementmanager.mail import sendMail
 from engagementmanager.models import Notification, IceUserProfile
 from engagementmanager.utils.constants import Constants
@@ -52,23 +53,34 @@ class DigestEmailNotificationHandler(ServiceBusBaseHandler):
     def handle_message(self, bus_message):
         logger.debug("New digest bus message arrived - email is about to sent")
         today = datetime.now().date()
-        users = Notification.objects.filter(activity__create_time__gte=today).values("user").distinct()
+        users = Notification.objects.filter(
+            activity__create_time__gte=today).values("user").distinct()
 
         for user in users:
             user = IceUserProfile.objects.get(id=user['user'])
 
             if user.email_updates_daily_digest:
-                notifications = Notification.objects.filter(activity__create_time__gte=today, user=user)
+                notifications = Notification.objects.filter(
+                    activity__create_time__gte=today, user=user)
                 try:
-                    subject_template = get_template("{notification_template_dir}"
-                                                    "notification_digest_mail_subject.html".format(
-                        notification_template_dir=Constants.notification_template_dir))
-                    msg_template = get_template("{notification_template_dir}"
-                                                "notification_digest_mail_body.html".format(
-                        notification_template_dir=Constants.notification_template_dir))
+                    subject_template = get_template(
+                        "{notification_template_dir}"
+                        "notification_digest_mail_subject.html".format(
+                            notification_template_dir=Constants.
+                            notification_template_dir))
+                    msg_template = get_template(
+                        "{notification_template_dir}"
+                        "notification_digest_mail_body.html".format(
+                            notification_template_dir=Constants.
+                            notification_template_dir))
 
-                    sendMail(user.email, notifications.values(),
-                             msg_template, subject_template, mail_from=mail.ice_admin_mail_from)
-                except Exception as e:
-                    msg = "Something went wrong while trying to send bulk mail as part of the digest notifications"
+                    sendMail(
+                        user.email,
+                        notifications.values(),
+                        msg_template,
+                        subject_template,
+                        mail_from=mail.ice_admin_mail_from)
+                except Exception:
+                    msg = "Something went wrong while trying " +\
+                        "to send bulk mail as part of the digest notifications"
                     logger.error(msg)
diff --git a/django/engagementmanager/bus/handlers/image_pushed_handler.py b/django/engagementmanager/bus/handlers/image_pushed_handler.py
new file mode 100644 (file)
index 0000000..edfb50e
--- /dev/null
@@ -0,0 +1,76 @@
+import logging
+
+from django.core.exceptions import ObjectDoesNotExist
+
+from engagementmanager.bus.handlers.service_bus_base_handler import ServiceBusBaseHandler
+from engagementmanager.slack_client.api import SlackClient
+from engagementmanager.models import VF, Checklist, IceUserProfile
+from engagementmanager.utils.constants import CheckListState
+from validationmanager.rados.rgwa_client_factory import RGWAClientFactory
+from datetime import datetime, timedelta
+from engagementmanager.service.checklist_state_service import set_state
+from engagementmanager.utils.request_data_mgr import request_data_mgr
+
+logger = logging.getLogger('ice.logger')
+
+
+class ImagePushedHandler(ServiceBusBaseHandler):
+    def handle_message(self, bus_message):
+        logger.debug("New hourly scheduled message arrived, Will check if there are new images and trigger the "
+                     "checklist scan in accordance.")
+
+        rgwa = RGWAClientFactory.admin()
+        start_date = datetime.today() - timedelta(hours=1)
+        last_hour_uasge = rgwa.get_usage(show_entries=True, start=start_date.strftime('%Y-%m-%d %H:%M:%S'))
+
+        if last_hour_uasge is not None and 'entries' in last_hour_uasge:
+            for entry in last_hour_uasge['entries']:
+                for bucket in entry['buckets']:
+                    if "_" not in bucket["bucket"]:
+                        # we must skip "cms-media", "cms-static", "em-media",
+                        # and "em-static", as well as any bucket not created
+                        # for images, for now this is sufficient but FIXME
+                        # could be more robust.
+                        continue
+                    if any(category['category'] == 'put_obj' for category in bucket['categories']):
+                        logger.debug("Found image which updated at the last hour -> will run checklist scan"
+                                     "for validation.")
+                        bucket_name_combinations = str(bucket['bucket']).split('_')
+                        engagement_manual_id = bucket_name_combinations[0]
+                        vf_name = bucket_name_combinations[1]
+
+                        vf = VF.objects.get(name=vf_name, engagement__engagement_manual_id=engagement_manual_id)
+                        self.validate_vf_exists(vf)
+                        self.notify_slack_users(vf, bucket['bucket'])
+                        self.set_checklist_states(vf)
+
+    def validate_vf_exists(self, vf):
+        if vf is None:
+            msg = "Couldn't fetch any VF"
+            logger.error(msg)
+            raise ObjectDoesNotExist(msg)
+
+    def notify_slack_users(self, vf, bucket_name):
+        slack_client = SlackClient()
+        slack_client.send_notifications_bucket_image_update(
+            vf.engagement.engagement_manual_id, vf.name, vf.engagement.reviewer,
+            vf.engagement.peer_reviewer, bucket_name)
+
+    def set_checklist_states(self, vf):
+        checklists = (Checklist.objects
+                      .filter(engagement=vf.engagement)
+                      .exclude(state=CheckListState.archive.name)
+                      .exclude(state=CheckListState.closed.name))
+
+        for checklist in checklists:
+            # FIXME Even though there is probably no associated request for
+            # this periodically-triggered task, set_state will crash if the
+            # request_data_mgr.get_user() returns None. So fake it.
+            request_data_mgr.set_user(
+                IceUserProfile.objects.filter(role__name='admin').first())
+            data = set_state(decline=True,
+                             checklist_uuid=checklist.uuid,
+                             isMoveToAutomation=True,
+                             description="This change was triggered by an update to the engagement rgwa bucket.")
+
+            logger.debug("set_state returned (%r)" % data)
index 00491fa..8ed4ebf 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -38,7 +38,8 @@
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
 import json
 from engagementmanager import mail
-from engagementmanager.bus.handlers.service_bus_base_handler import ServiceBusBaseHandler
+from engagementmanager.bus.handlers.service_bus_base_handler import \
+    ServiceBusBaseHandler
 from django.template.loader import get_template
 from engagementmanager.mail import sendMail
 from engagementmanager.utils.constants import Constants
@@ -49,26 +50,38 @@ logger = LoggingServiceFactory.get_logger()
 
 
 class NewNotificationHandler(ServiceBusBaseHandler):
+
     def handle_message(self, bus_message):
-        logger.info("New notification (%s) arrived - email will sent" %
-                    bus_message.notification.uuid)
+        logger.info(
+            "New notification " +
+            "(%s) arrived - email will sent" % bus_message.notification.uuid)
 
         user = bus_message.notification.user
         if user.email_updates_on_every_notification:
             try:
-                subject_template = get_template("{notification_template_dir}notification_mail_subject.html".format(
-                    notification_template_dir=Constants.notification_template_dir))
-                msg_template = get_template("{notification_template_dir}notification_mail_body.html".format(
-                    notification_template_dir=Constants.notification_template_dir))
-
-                sendMail(user.email, json.loads(bus_message.notification.activity.metadata),
-                         msg_template, subject_template, mail_from=mail.ice_admin_mail_from)
+                template_dir = Constants.notification_template_dir
+                subject_template = get_template(
+                    """{template_dir}notification_mail_subject.html""".format(
+                        template_dir=template_dir))
+                msg_template = get_template(
+                    """{template_dir}notification_mail_body.html""".format(
+                        template_dir=template_dir))
+                sendMail(
+                    user.email,
+                    json.loads(
+                        bus_message.notification.activity.metadata),
+                    msg_template,
+                    subject_template,
+                    mail_from=mail.ice_admin_mail_from)
                 bus_message.notification.is_sent = True
                 bus_message.notification.save()
             except Exception as e:
-                msg = "Something went wrong while trying to send bulk mail as part of the notification"
+                msg = "Something went wrong while trying to send " +\
+                    "bulk mail as part of the notification"
                 logger.error(msg + " " + str(e))
         else:
             bus_message.notification.is_sent = True
             bus_message.notification.save()
-            logger.info("User choose not to get email on every notification, set it as sent.")
+            logger.info(
+                "User choose not to get email on every " +
+                "notification, set it as sent.")
index 7b4a83b..03f33b5 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -38,7 +38,8 @@
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
 from abc import ABCMeta, abstractmethod
 
-from engagementmanager.bus.messages.service_bus_base_message import ServiceBusBaseMessage
+from engagementmanager.bus.messages.service_bus_base_message import \
+    ServiceBusBaseMessage
 from engagementmanager.utils.vvp_exceptions import VvpGeneralException
 
 
@@ -47,7 +48,9 @@ class ServiceBusBaseHandler:
 
     def validate_message(self, bus_message):
         if not issubclass(type(bus_message), ServiceBusBaseMessage):
-            raise VvpGeneralException("You can't handle message which is not from type of ServiceBusBaseMessage")
+            raise VvpGeneralException(
+                "You can't handle message which is not " +
+                "from type of ServiceBusBaseMessage")
 
     @abstractmethod
     def handle_message(self, bus_message):
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 67bf319..b5a5f81 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -36,7 +36,8 @@
 # ============LICENSE_END============================================
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
-from engagementmanager.bus.messages.service_bus_base_message import ServiceBusBaseMessage
+from engagementmanager.bus.messages.service_bus_base_message import \
+    ServiceBusBaseMessage
 from engagementmanager.utils.activities_data import ActivityData
 from engagementmanager.utils.vvp_exceptions import VvpGeneralException
 
@@ -44,6 +45,7 @@ from engagementmanager.utils.vvp_exceptions import VvpGeneralException
 class ActivityEventMessage(ServiceBusBaseMessage):
     def __init__(self, activity_data):
         if not issubclass(type(activity_data), ActivityData):
-            raise VvpGeneralException("Activity data can be from type ActivityData only.")
+            raise VvpGeneralException(
+                "Activity data can be from type ActivityData only.")
 
         self.activity_data = activity_data
index 41941e8..052fc82 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -36,7 +36,8 @@
 # ============LICENSE_END============================================
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
-from engagementmanager.bus.messages.service_bus_base_message import ServiceBusBaseMessage
+from engagementmanager.bus.messages.service_bus_base_message import \
+    ServiceBusBaseMessage
 
 
 class DailyScheduledMessage(ServiceBusBaseMessage):
index 8c733bf..a138840 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -36,7 +36,8 @@
 # ============LICENSE_END============================================
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
-from engagementmanager.bus.messages.service_bus_base_message import ServiceBusBaseMessage
+from engagementmanager.bus.messages.service_bus_base_message import \
+    ServiceBusBaseMessage
 
 
 class HourlyScheduledMessage(ServiceBusBaseMessage):
index ce4ce06..1e33e7d 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
 # ============LICENSE_END============================================
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
-from engagementmanager.bus.messages.service_bus_base_message import ServiceBusBaseMessage
+from engagementmanager.bus.messages.service_bus_base_message import \
+    ServiceBusBaseMessage
 from engagementmanager.models import Notification
 from engagementmanager.utils.vvp_exceptions import VvpGeneralException
 
 
 class NewNotificationMessage(ServiceBusBaseMessage):
     def __init__(self, notification):
-        if type(notification) is not Notification:
-            raise VvpGeneralException("New notification event can be from type Notification only.")
+        if not isinstance(notification, Notification):
+            raise VvpGeneralException(
+                "New notification event can be from type Notification only.")
 
         self.notification = notification
index 3f97a0d..e453e09 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index a0ca5b1..3babc09 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -79,8 +79,11 @@ class CMSClient(object):
         try:
             client = BackendApplicationClient(client_id=client_id)
             oatuh = OAuth2Session(client=client)
-            token = oatuh.fetch_token(token_url=self.api_url + 'oauth2/token/', client_id=client_id,
-                                      client_secret=client_secret)
+            token = oatuh.fetch_token(
+                token_url=self.api_url +
+                'oauth2/token/',
+                client_id=client_id,
+                client_secret=client_secret)
         except Exception as exception:
             logger.error(
                 'Could not create CMS token, error message: ' + str(exception))
@@ -107,16 +110,22 @@ class CMSClient(object):
         """
         response = None
         try:
-            response = self.session.get(self.api_url + resource, params=params)
+            response = self.session.get(self.api_url + resource,
+                                        params=params)
             if response.status_code == HTTP_401_UNAUTHORIZED:
-                logger.error('Token expired (401 status excepted), will renew cms token now')
+                logger.error(
+                    'Token expired (401 status excepted), \
+                    will renew cms token now')
                 self.__init__()
-                response = self.session.get(self.api_url + resource, params=params)
+                response = self.session.get(
+                    self.api_url + resource, params=params)
         except TokenExpiredError as exception:
-            logger.error('Token expired (TokenExpiredError exception excepted),'
-                              ' will renew cms token now: ' + str(exception))
+            logger.error(
+                'Token expired (TokenExpiredError exception excepted),'
+                ' will renew cms token now: ' + str(exception))
             self.__init__()
-            response = self.session.get(self.api_url + resource, params=params)
+            response = self.session.get(self.api_url + resource,
+                                        params=params)
         item = self.json_deserialize(response.content.decode('utf-8'))
         return item
 
@@ -130,8 +139,12 @@ class CMSClient(object):
         :param limit: date_min of posts to return
         :return: list of dicts for most recently published blog posts
         """
-        return self.get('posts?offset={}&limit={}&category_name={}&date_min={}'.format(int(offset), int(limit),
-                                                                                       category, date_min))['results']
+        return self.get(
+            'posts?offset={}&limit={}&category_name={}&date_min={}'.format(
+                int(offset),
+                int(limit),
+                category,
+                date_min))['results']
 
     def get_pages(self, title=""):
         """
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 686a8cc..d034b75 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -42,7 +42,8 @@ from rest_framework import status
 from rest_framework.response import Response
 from rest_framework.status import HTTP_401_UNAUTHORIZED, \
     HTTP_400_BAD_REQUEST, HTTP_500_INTERNAL_SERVER_ERROR
-from engagementmanager.service.authorization_service import AuthorizationService
+from engagementmanager.service.authorization_service import \
+    AuthorizationService
 from engagementmanager.utils.request_data_mgr import request_data_mgr
 from engagementmanager.service.logging_service import LoggingServiceFactory
 
@@ -59,10 +60,10 @@ def auth(action, is_internal=False):
 
             # Extract USER -  A MUST Have in KWARGS #
             user = request_data_mgr.get_user()
-            if user == None:
+            if user is None:
                 msg = "user couldn't be identified in the request"
                 logger.error(msg)
-                if (is_internal == True):
+                if (is_internal):
                     return msg, HTTP_400_BAD_REQUEST
                 return Response(msg, status=status.HTTP_400_BAD_REQUEST)
 
@@ -72,30 +73,42 @@ def auth(action, is_internal=False):
             try:
                 result = None
                 message = None
-                result, message = auth_service.is_user_able_to(user, action, eng_uuid, checklist_uuid)
-                logger.debug('Authorization Service : ' + action.name +
-                             '. Result=' + str(result) + '. message=' + str(message))
-                if result == False:
+                result, message = auth_service.is_user_able_to(
+                    user, action, eng_uuid, checklist_uuid)
+                logger.debug(
+                    'Authorization Service : ' +
+                    action.name +
+                    '. Result=' +
+                    str(result) +
+                    '. message=' +
+                    str(message))
+                if not result:
                     msg = "User not authorized: " + \
-                        str(user.uuid) + ". eng_uuid=" + str(eng_uuid) + ". checklist_uuid=" + str(checklist_uuid)
-                    if (is_internal == True):
+                        str(user.uuid) + ". eng_uuid=" + str(eng_uuid) + \
+                        ". checklist_uuid=" + str(checklist_uuid)
+                    if (is_internal):
                         return msg, HTTP_401_UNAUTHORIZED
                     msg = bleach.clean(msg, tags=['a', 'b'])
                     return Response(msg, status=status.HTTP_401_UNAUTHORIZED)
 
             except Exception as e:
-                logger.error("=====================Exception=====================")
-                msg = "A problem occurred while trying to authorize user.uuid= " + \
+                logger.error(
+                    "=====================Exception=====================")
+                msg = "A problem occurred while trying \
+                to authorize user.uuid= " + \
                     str(user.uuid) + ". eng_uuid=" + str(eng_uuid) + \
-                    ". checklist_uuid=" + str(checklist_uuid) + "action=" + str(action)
+                    ". checklist_uuid=" + \
+                    str(checklist_uuid) + "action=" + str(action)
                 logger.error(str(e) + " Message: " + msg)
                 logger.error(traceback.format_exc())
-                logger.error("===================================================")
+                logger.error(
+                    "===================================================")
 
-                if (is_internal == True):
+                if (is_internal):
                     return msg, HTTP_500_INTERNAL_SERVER_ERROR
                 msg = "Action was failed to be performed"
-                return Response(msg, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+                return Response(
+                    msg, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
             return func(*args, **kwargs)
 
         return _new_func
index 362e473..7d2bdf9 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
 # ============LICENSE_END============================================
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
+
+
 def classDecorator(decorators):
     def decorate(cls):
         for attr in cls.__dict__:
             if callable(getattr(cls, attr)):
                 for ice_decorator in decorators:
-                    if (attr in ["get", "put", "post", "delete", "entity_list", "entity_detail", "set_attr"]):
+                    if (attr in ["get", "put", "post", "delete",
+                                 "entity_list", "entity_detail", "set_attr"]):
                         setattr(cls, attr, ice_decorator(getattr(cls, attr)))
         return cls
     return decorate
index 1e7d840..2f8d6cf 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -45,6 +45,7 @@ logger = LoggingServiceFactory.get_logger()
 def logFuncEntry(func):
     @wraps(func)
     def log(*args, **kwargs):
-        logger.debug('calling {}'.format(func.__name__) + " | " + str(args) + " | " + str(kwargs))
+        logger.debug('calling {}'.format(func.__name__) +
+                     " | " + str(args) + " | " + str(kwargs))
         return func(*args, **kwargs)
     return log
index d0c15c1..24bff22 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -36,7 +36,8 @@
 # ============LICENSE_END============================================
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
-"""This module provides retry_connection, a simple wrapper around retrying.retry, for our most
+"""This module provides retry_connection,
+a simple wrapper around retrying.retry, for our most
 common use case.
 
 """
@@ -49,4 +50,5 @@ def is_connection_exception(exception):
     return isinstance(exception, (ConnectionError, Timeout))
 
 
-retry_connection = retry(stop_max_attempt_number=2, retry_on_exception=is_connection_exception)
+retry_connection = retry(stop_max_attempt_number=2,
+                         retry_on_exception=is_connection_exception)
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 4bc8de0..d33e840 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -43,10 +43,11 @@ from engagementmanager.service.logging_service import LoggingServiceFactory
 
 logger = LoggingServiceFactory.get_logger()
 
+
 class GitManager(object):
     def getRepoAssociatedFilesForUser(self, eng_uuid):
         logger.debug("Fetching the repo associated files for engagement " +
-                          eng_uuid)
+                     eng_uuid)
         vf = VF.objects.get(engagement__uuid=eng_uuid)
         fileList = send_get_list_of_repo_files_event(vf)
         return fileList
index c4c8afd..1adb1e1 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 10279b9..75e7300 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -47,7 +47,8 @@ ice_admin_mail_from = settings.CONTACT_FROM_ADDRESS
 logger = LoggingServiceFactory.get_logger()
 
 
-def sendMail(email, data, mail_body_template, mail_subject_template, mail_from=ice_admin_mail_from):
+def sendMail(email, data, mail_body_template, mail_subject_template,
+             mail_from=ice_admin_mail_from):
     logger.debug("about to send mail to " + email)
     if data is None:
         data = {}
@@ -55,7 +56,8 @@ def sendMail(email, data, mail_body_template, mail_subject_template, mail_from=i
     html_msg = mail_body_template.render(context=data)
     mail_subject = mail_subject_template.render(context=data)
     # send mail with template
-    send_mail(mail_subject, '', "D2 ICE Team <" + mail_from + ">", [email], fail_silently=False, html_message=html_msg)
+    send_mail(mail_subject, '', "D2 ICE Team <" + mail_from + ">",
+              [email], fail_silently=False, html_message=html_msg)
     logger.debug("Looks like email delivery to " + email + " has succeeded")
 
 
@@ -64,8 +66,11 @@ def sendBulkMail(datatuple):
 
     try:
         num_sent = send_mass_mail(datatuple)
-        logger.debug("Looks like email delivery has succeeded. Number of sent mails is " + str(num_sent))
+        logger.debug(
+            "Looks like email delivery has succeeded. Number of sent\
+            mails is " + str(num_sent))
         return num_sent
-    except Exception as e:  # Dont remove try-except since it is invoked from Notification Bot
+    # Dont remove try-except since it is invoked from Notification Bot
+    except Exception as e:
         logger.error("Email delivery has failed. Error is: " + str(e))
         raise e
index 36beacd..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -36,4 +36,3 @@
 # ============LICENSE_END============================================
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
-
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 5299367..f26e337 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -43,9 +43,11 @@ Will delete content from gitlab to create initial environment:
 3.Users
 
 This command uses gitlab client rest api to remove data.
-This command is part of clean_vvp_system command but can be used separately as well.
+This command is part of clean_vvp_system
+command but can be used separately as well.
 
-WARNING: It will delete almost everything, if you have necessary data DO NOT USE THIS COMMAND!
+WARNING: It will delete almost everything, if you have
+necessary data DO NOT USE THIS COMMAND!
 """
 from django.conf import settings
 from django.core.management.base import BaseCommand
@@ -69,7 +71,8 @@ class Command(BaseCommand):
         for entity in entities:
             entities_deleted = []
             gitlab_entity_url = settings.GITLAB_URL + "api/v3/%s/" % entity
-            r1 = requests.get(gitlab_entity_url, headers=headers, verify=False)
+            r1 = requests.get(gitlab_entity_url, headers=headers,
+                              verify=False)
             data = r1.json()
 
             while len(data) > 1:
@@ -77,13 +80,14 @@ class Command(BaseCommand):
                     try:
                         if record['id'] not in entities_deleted \
                                 and record['name'] != 'Administrator':
-                            r2 = requests.delete(gitlab_entity_url +
-                                                 str(record['id']),
-                                                 headers=headers, verify=False)
-                            logger.info("Entity '%s' with id %s Will be deleted"
-                                        " in a bit (type: %s)" % (
-                                            record['name'],
-                                            record['id'], entity,))
+                            requests.delete(gitlab_entity_url +
+                                            str(record['id']),
+                                            headers=headers,
+                                            verify=False)
+                            logger.info(
+                                "Entity '%s' with id %s Will be deleted"
+                                " in a bit (type: %s)" %
+                                (record['name'], record['id'], entity,))
 
                             entities_deleted.append(record['id'])
                     except Exception as e:
index c19f28d..b8f60c2 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
 Will delete content(jobs) from jenkins to create initial environment.
 
 This command uses jenkins_client api to remove data.
-This command is part of clean_vvp_system command but can be used separately as well.
+This command is part of clean_vvp_system command
+but can be used separately as well.
 
-WARNING: It will delete almost everything, if you have necessary data DO NOT USE THIS COMMAND!
+WARNING: It will delete almost everything, if you
+have necessary data DO NOT USE THIS COMMAND!
 """
 from validationmanager.utils.clients import get_jenkins_client
 from django.core.management.base import BaseCommand
@@ -63,7 +65,8 @@ class Command(BaseCommand):
 
             for job_name in job_names:
                 jenkins_client.delete_job(job_name)
-                logger.info("Jenkins job '%s' deleted successfully." % job_name)
+                logger.info(
+                    "Jenkins job '%s' deleted successfully." % job_name)
         except Exception as e:
             logger.error("Some problem occurred while trying "
                          "cleaning Jenkins...", e)
index 931f684..d91bf18 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
 """ clean_vvp_db
-Will delete content from database (almost all entities) to create initial environment.
+Will delete content from database (almost all entities)
+to create initial environment.
 
 This command uses django orm to remove data.
-This command is part of clean_vvp_system command but can be used separately as well.
+This command is part of clean_vvp_system command
+but can be used separately as well.
 
-WARNING: It will delete almost everything, if you have necessary data DO NOT USE THIS COMMAND!
+WARNING: It will delete almost everything, if you
+have necessary data DO NOT USE THIS COMMAND!
 """
 from django.core.management.base import BaseCommand
 from engagementmanager import models
-from engagementmanager.management.commands.initial_populate_db import admin_dummy_users, admin_ro_dummy_users, \
+from engagementmanager.management.commands.initial_populate_db \
+    import admin_dummy_users, admin_ro_dummy_users, \
     dummy_users, el_dummy_users
 from engagementmanager.service.logging_service import LoggingServiceFactory
 from engagementmanager.utils.constants import Constants
@@ -57,12 +61,14 @@ logger = LoggingServiceFactory.get_logger()
 class Command(BaseCommand):
     def handle(self, *args, **options):
         logger.info("***************************************")
-        logger.info(">>%s db is about to be cleaned up!" % Constants.program_name)
+        logger.info(">>%s db is about to be cleaned up!" %
+                    Constants.program_name)
         logger.info("***************************************")
 
         excluded_emails = [dummy_users[0][1], dummy_users[1][1],
                            el_dummy_users[0][1], el_dummy_users[1][1],
-                           admin_dummy_users[0][1], admin_ro_dummy_users[0][1], ]
+                           admin_dummy_users[0][1],
+                           admin_ro_dummy_users[0][1], ]
 
         try:
             models.EngagementStatus.objects.all().delete()
@@ -83,7 +89,9 @@ class Command(BaseCommand):
             models.Engagement.objects.all().delete()
             models.IceUserProfile.objects.exclude(email__in=excluded_emails)\
                 .delete()
-            models.CustomUser.objects.exclude(user_ptr_id__in=models.IceUserProfile.objects.all().values('id')).delete()
+            models.CustomUser.objects.exclude(
+                user_ptr_id__in=models.IceUserProfile.objects.
+                all().values('id')).delete()
 
             models.DeploymentTarget.objects.all().delete()
             models.DeploymentTargetSite.objects.all().delete()
index a86f770..04f9cb1 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -42,10 +42,12 @@ Will clean all program data:
 2. Deletes all data stored in database.
 3. Deletes all jobs stored in jenkins.
 
-It's recommended to clean the vvp system if you desire in a fresh copy of the vvp program
+It's recommended to clean the vvp system if
+you desire in a fresh copy of the vvp program
 without installing it all over again.
 
-WARNING: It will delete almost everything, if you have necessary data DO NOT USE THIS COMMAND!
+WARNING: It will delete almost everything,
+if you have necessary data DO NOT USE THIS COMMAND!
 """
 from django.core.management.base import BaseCommand
 from engagementmanager.management.commands import clean_gitlab_content
@@ -61,7 +63,8 @@ logger = LoggingServiceFactory.get_logger()
 class Command(BaseCommand):
     def handle(self, *args, **options):
         logger.info("***************************************")
-        logger.info("%s system is about to be cleaned up!" % Constants.program_name)
+        logger.info("%s system is about to be cleaned up!" %
+                    Constants.program_name)
         logger.info("***************************************")
 
         try:
@@ -80,14 +83,14 @@ class Command(BaseCommand):
             clean_vvp_db_command = clean_vvp_db.Command()
             clean_vvp_db_command.handle(args, options)
         except Exception as e:
-            logger.error("There was a problem cleaning %s db" % Constants.program_name, e)
-
+            logger.error("There was a problem cleaning %s db" %
+                         Constants.program_name, e)
         try:
             initial_populate_db_command = initial_populate_db.Command()
             initial_populate_db_command.handle(args, options)
         except Exception as e:
-            logger.error("There was a problem populate %s db after cleaning" % Constants.program_name, e)
-
+            logger.error("There was a problem populate %s db \
+            after cleaning" % Constants.program_name, e)
         logger.info("***************************************")
         logger.info("Done!")
         logger.info("***************************************")
index a0ca177..571c7e6 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -39,7 +39,8 @@
 """ intial_populate_db
 Will create initial content to use this system.
 
-This command is creating users, templates, companies, deployment targets, sites and much more.
+This command is creating users, templates, companies,
+deployment targets, sites and much more.
 Will run at the state of a clean system so it won't cause data collisions.
 
 WARNING: Do not run while there is data at the system.
@@ -49,7 +50,8 @@ import random
 from django.conf import settings
 from django.core.management.base import BaseCommand
 from django.utils import timezone
-from engagementmanager.models import Role, Vendor, IceUserProfile, DeploymentTarget, \
+from engagementmanager.models import Role, Vendor, \
+    IceUserProfile, DeploymentTarget, \
     DeploymentTargetSite, Checklist, ChecklistDecision, ChecklistLineItem, \
     ChecklistTemplate, ChecklistSection, ECOMPRelease, Engagement, \
     CustomUser
@@ -68,7 +70,8 @@ logger = LoggingServiceFactory.get_logger()
 class Command(BaseCommand):
 
     def handle(self, *args, **options):
-        if (settings.ENVIRONMENT == "local" or settings.ENVIRONMENT == "development"):
+        if (settings.ENVIRONMENT == "local" or
+                settings.ENVIRONMENT == "development"):
             execute_bootstrap_actions()
 
 
@@ -92,19 +95,26 @@ companies_not_public = [
     'Mitel',
 ]
 
-admin_dummy_users = [['admin bogus user', Constants.service_provider_admin_mail, '+1-23-456-78901']]
+admin_dummy_users = [['admin bogus user',
+                      Constants.service_provider_admin_mail,
+                      '+1-23-456-78901']]
 
 admin_ro_dummy_users = [
-    ['ro admin bogus user', Constants.service_provider_admin_ro_mail, '+1-23-456-78901']]
+    ['ro admin bogus user', Constants.service_provider_admin_ro_mail,
+     '+1-23-456-78901']]
 
 dummy_users = [
-    ['Bugs Bunny', 'bb@' + Constants.service_provider_mail_domain[0], '+1-404-986-9624'],
-    ['CI Standard 1', 'ci_standard_1@' + Constants.service_provider_mail_domain[0], '+1-404-986-9624'],
+    ['Bugs Bunny', 'bb@' + Constants.service_provider_mail_domain[0],
+     '+1-404-986-9624'],
+    ['CI Standard 1', 'ci_standard_1@' +
+        Constants.service_provider_mail_domain[0], '+1-404-986-9624'],
 ]
 
 el_dummy_users = [
-    ['Donald Duck', 'dd1122@' + Constants.service_provider_mail_domain[0], '+1-404-986-9624'],
-    ['Homer Simpson', 'hs0007@' + Constants.service_provider_mail_domain[0], '+1-425-281-3547']
+    ['Donald Duck', 'dd1122@' +
+        Constants.service_provider_mail_domain[0], '+1-404-986-9624'],
+    ['Homer Simpson', 'hs0007@' +
+        Constants.service_provider_mail_domain[0], '+1-425-281-3547']
 ]
 
 checklist_templates = [
@@ -123,14 +133,22 @@ checklist_templates = [
                         'name': 'Filenames',
                         'weight': 1,
                         'description': 'description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some \
+                        useful tips for how to validate this item in \
+                        the most awesome way:<br><br><ul><li>Here is \
+                        my awesome tip 1</li><li>Here is my awesome tip \
+                        2</li><li>Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     },
                     {
                         'name': 'Valid YAML and HEAT',
                         'weight': 1,
                         'description': 'Description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     }
                 ]
@@ -145,28 +163,44 @@ checklist_templates = [
                         'name': 'Parameters',
                         'weight': 1,
                         'description': 'description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     },
                     {
                         'name': 'Resources',
                         'weight': 1,
                         'description': 'Description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     },
                     {
                         'name': 'Unique Names for Resources',
                         'weight': 1,
                         'description': 'Description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     },
                     {
                         'name': 'Outputs',
                         'weight': 1,
                         'description': 'Description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     }
                 ]
@@ -182,77 +216,121 @@ checklist_templates = [
                         'name': 'Name, Flavor, and Image Assignments',
                         'weight': 1,
                         'description': 'description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     },
                     {
                         'name': 'Availability Zones',
                         'weight': 1,
                         'description': 'Description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     },
                     {
                         'name': 'Required Metadata',
                         'weight': 1,
                         'description': 'Description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     },
                     {
                         'name': 'Optional Metadata',
                         'weight': 1,
                         'description': 'Description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     },
                     {
                         'name': 'Volumes',
                         'weight': 1,
                         'description': 'Description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     },
                     {
                         'name': 'Keys and Keypairs',
                         'weight': 1,
                         'description': 'Description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     },
                     {
                         'name': 'Networks',
                         'weight': 1,
                         'description': 'Description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     },
                     {
                         'name': 'Subnet',
                         'weight': 1,
                         'description': 'Description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     },
                     {
                         'name': 'Fixed IPs',
                         'weight': 1,
                         'description': 'Description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome tip 1\
+                        </li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     },
                     {
                         'name': 'Allowed Address Pairs',
                         'weight': 1,
                         'description': 'Description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     },
                     {
                         'name': 'Ports',
                         'weight': 1,
                         'description': 'Description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     }
                 ]
@@ -268,28 +346,44 @@ checklist_templates = [
                         'name': 'HEAT Files Support (get_file)',
                         'weight': 1,
                         'description': 'description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     },
                     {
                         'name': 'HTTP-based references',
                         'weight': 1,
                         'description': 'Description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     },
                     {
                         'name': 'Anti-Affinity and Affinity Rules',
                         'weight': 1,
                         'description': 'Description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     },
                     {
                         'name': 'Resource Data Synchronization',
                         'weight': 1,
                         'description': 'Description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     }
                 ]
@@ -312,14 +406,22 @@ checklist_templates = [
                         'name': 'Image Source',
                         'weight': 1,
                         'description': 'description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     },
                     {
                         'name': 'Vendor Provided Image',
                         'weight': 1,
                         'description': 'Description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     }
                 ]
@@ -334,7 +436,11 @@ checklist_templates = [
                         'name': 'Clam AV Scan',
                         'weight': 1,
                         'description': 'description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     },
                 ]
@@ -356,14 +462,22 @@ checklist_templates = [
                         'name': 'Validated Heat Template(s)',
                         'weight': 1,
                         'description': 'description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     },
                     {
                         'name': 'Validated Glance Image(s)',
                         'weight': 1,
                         'description': 'Description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     }
                 ]
@@ -378,14 +492,22 @@ checklist_templates = [
                         'name': 'Create the HEAT Stack',
                         'weight': 1,
                         'description': 'description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     },
                     {
                         'name': 'Delete the HEAT Stack',
                         'weight': 1,
                         'description': 'Description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     }
                 ]
@@ -407,21 +529,33 @@ checklist_templates = [
                         'name': 'Validated Heat Template(s)',
                         'weight': 1,
                         'description': 'description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     },
                     {
                         'name': 'Validated Glance Image(s)',
                         'weight': 1,
                         'description': 'Description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome tip\
+                         1</li><li>Here is my awesome tip 2</li><li>\
+                         Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     },
                     {
                         'name': 'Successful Manual Instantiation',
                         'weight': 1,
                         'description': 'Description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     }
                 ]
@@ -436,7 +570,11 @@ checklist_templates = [
                         'name': 'Create the VNF',
                         'weight': 1,
                         'description': 'description',
-                        'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                        'validation_instructions': 'Here are some useful \
+                        tips for how to validate this item in the most \
+                        awesome way:<br><br><ul><li>Here is my awesome \
+                        tip 1</li><li>Here is my awesome tip 2</li><li>\
+                        Here is my awesome tip 3</li></ul>',
                         'line_type': 'manual',
                     },
                 ]
@@ -453,7 +591,7 @@ checklist_templates = [
 #   for vt in vts:
 #       for li in vt.line_items.all():
 #           print("['" + vt.name + "', '" + li.name + "'],")
-validation_tests = [
+heat_validation_tests = [
     ['test_all_nested_templates_provided', 'Filenames'],
     ['test_all_referenced_resources_exists', 'Resources'],
     ['test_allowed_address_pairs_format', 'Allowed Address Pairs'],
@@ -468,9 +606,11 @@ validation_tests = [
     ['test_default_values', 'Parameters'],
     ['test_env_and_yaml_same_name', 'Filenames'],
     ['test_env_files_provided', 'Filenames'],
-    ['test_environment_file_contains_required_sections', 'Valid YAML and HEAT'],
+    ['test_environment_file_contains_required_sections',
+     'Valid YAML and HEAT'],
     ['test_environment_file_extension', 'Filenames'],
-    ['test_environment_file_sections_have_the_right_format', 'Valid YAML and HEAT'],
+    ['test_environment_file_sections_have_the_right_format',
+     'Valid YAML and HEAT'],
     ['test_environment_structure', 'Valid YAML and HEAT'],
     ['test_fixed_ips_format', 'Fixed IPs'],
     ['test_fixed_ips_format', 'Ports'],
@@ -478,20 +618,25 @@ validation_tests = [
     ['test_fixed_ips_format_use_get_parm', 'Ports'],
     ['test_fixed_ips_include_vm_type_network_role', 'Ports'],
     ['test_fixed_ips_include_vm_type_network_role', 'Ports'],
-    ['test_get_file_only_reference_local_files', 'HEAT Files Support (get_file)'],
+    ['test_get_file_only_reference_local_files',
+        'HEAT Files Support (get_file)'],
     ['test_heat_pairs_provided', 'Filenames'],
     ['test_heat_template_file_extension', 'Filenames'],
-    ['test_heat_template_parameters_contain_required_fields', 'Valid YAML and HEAT'],
+    ['test_heat_template_parameters_contain_required_fields',
+     'Valid YAML and HEAT'],
     ['test_heat_template_structure', 'Valid YAML and HEAT'],
-    ['test_heat_template_structure_contains_required_sections', 'Valid YAML and HEAT'],
-    ['test_heat_template_structure_sections_have_the_right_format', 'Valid YAML and HEAT'],
+    ['test_heat_template_structure_contains_required_sections',
+     'Valid YAML and HEAT'],
+    ['test_heat_template_structure_sections_have_the_right_format',
+     'Valid YAML and HEAT'],
     ['test_heat_templates_provided', 'Filenames'],
     ['test_network_format', 'Networks'],
     ['test_network_format', 'Ports'],
     ['test_network_format_use_get_param_or_get_resource', 'Networks'],
     ['test_network_format_use_get_param_or_get_resource', 'Ports'],
     ['test_no_unused_parameters_between_env_and_templates', 'Parameters'],
-    ['test_nova_servers_correct_parameter_types', 'Name, Flavor, and Image Assignments'],
+    ['test_nova_servers_correct_parameter_types',
+        'Name, Flavor, and Image Assignments'],
     ['test_nova_servers_valid_resource_ids', 'Resources'],
     ['test_numeric_parameter', 'Parameters'],
     ['test_parameter_valid_keys', 'Valid YAML and HEAT'],
@@ -502,8 +647,10 @@ validation_tests = [
     ['test_referenced_and_defined_parameters_match', 'Parameters'],
     ['test_required_parameters_no_constraints', 'Required Metadata'],
     ['test_required_parameters_provided_in_env_file', 'Required Metadata'],
-    ['test_required_parameters_provided_in_heat_template', 'Required Metadata'],
-    ['test_required_parameters_provided_in_heat_template', 'Required Metadata'],
+    ['test_required_parameters_provided_in_heat_template',
+     'Required Metadata'],
+    ['test_required_parameters_provided_in_heat_template',
+     'Required Metadata'],
     ['test_servers_have_optional_metadata', 'Optional Metadata'],
     ['test_servers_have_required_metadata', 'Required Metadata'],
     ['test_servers_metadata_use_get_param', 'Required Metadata'],
@@ -512,14 +659,18 @@ validation_tests = [
     ['test_subnet_format_use_get_param_or_get_resource', 'Subnet'],
     ['test_subnet_format_use_get_param_or_get_resource', 'Ports'],
     ['test_unique_name_resources', 'Unique Names for Resources'],
-    ['test_unique_name_str_replace_use_req_params', 'Unique Names for Resources'],
-    ['test_unique_name_str_replace_use_req_params_in_tmpl', 'Unique Names for Resources'],
+    ['test_unique_name_str_replace_use_req_params',
+     'Unique Names for Resources'],
+    ['test_unique_name_str_replace_use_req_params_in_tmpl',
+        'Unique Names for Resources'],
     ['test_unique_resources_across_all_yaml_files', 'Resources'],
     ['test_unique_resources_across_yaml_file', 'Unique Names for Resources'],
     ['test_unique_resources_across_yaml_file', 'Resources'],
     ['test_valid_nesting', 'Filenames'],
-    ['test_vm_type_assignments_on_nova_servers_only_use_get_param', 'Name, Flavor, and Image Assignments'],
-    ['test_vm_type_consistent_on_nova_servers', 'Name, Flavor, and Image Assignments'],
+    ['test_vm_type_assignments_on_nova_servers_only_use_get_param',
+        'Name, Flavor, and Image Assignments'],
+    ['test_vm_type_consistent_on_nova_servers',
+        'Name, Flavor, and Image Assignments'],
     ['test_volume_format_outputs', 'Volumes'],
     ['test_volume_outputs_consumed', 'Volumes'],
     ['test_volume_resource_ids', 'Resources'],
@@ -529,6 +680,10 @@ validation_tests = [
     ['test_volume_templates_outputs_match_resources', 'Volumes'],
 ]
 
+glance_validation_tests = [
+    ['test_image_scan_complete', 'Clam AV Scan'],
+]
+
 deployment_targets = [
     ['AIC', '2.5'],
     ['AIC', '3.0'],
@@ -624,7 +779,8 @@ def populate_checklist_automation_value():
     for outerframe in outerframes:
         if ('unittest' in str(outerframe)):
             logger.error(
-                "Avoiding setting checklists in automation to be review since this is a test run: " + logEncoding(outerframe))
+                "Avoiding setting checklists in automation to be \
+                review since this is a test run: " + logEncoding(outerframe))
             return
 
     checklists = Checklist.objects.filter(state='automation')
@@ -638,10 +794,10 @@ def populate_checklist_automation_value():
         checklist.save()
     #    first = False
         decisions = ChecklistDecision.objects.filter(checklist=checklist)
-        first_decision = True
         for decision in decisions:
             decision = ChecklistDecision.objects.get(uuid=decision.uuid)
-            line_item = ChecklistLineItem.objects.get(uuid=decision.line_item_id)
+            line_item = ChecklistLineItem.objects.get(
+                uuid=decision.line_item_id)
             if line_item.line_type == 'auto':
                 rand_decision_value = bool(random.getrandbits(1))
                 if rand_decision_value:
@@ -654,44 +810,56 @@ def populate_checklist_automation_value():
 def create_templates():
     logger.info('Creating Checklist templates')
     for template in checklist_templates:
-        created_template, created = ChecklistTemplate.objects.get_or_create(name=template['name'],
-                                                                            defaults={
-            'category': template['category'],
-            'version': template['version'],
-            'create_time': timezone.now()
-        })
+        created_template, created = ChecklistTemplate.objects.get_or_create(
+            name=template['name'],
+            defaults={
+                'category': template['category'],
+                'version': template['version'],
+                'create_time': timezone.now()
+            })
         for section in template['sections']:
-            created_section = ChecklistSection.objects.get_or_create(name=section['name'],
-                                                                     template_id=created_template.uuid,
-                                                                     defaults={
-                'weight': section['weight'],
-                'description': section['description'],
-                'validation_instructions': section['validation_instructions']
+            created_section = ChecklistSection.objects.get_or_create(
+                name=section['name'],
+                template_id=created_template.uuid,
+                defaults={
+                    'weight': section['weight'],
+                    'description': section['description'],
+                    'validation_instructions':
+                    section['validation_instructions']
 
-            })
+                })
             created_section = ChecklistSection.objects.get(
                 name=section['name'], template_id=created_template.uuid)
             for line_item in section['line_items']:
-                created_line_item = ChecklistLineItem.objects.get_or_create(name=line_item['name'],
-                                                                            section_id=created_section.uuid,
-                                                                            template_id=created_template.uuid,
-                                                                            defaults={
-                    'weight': line_item['weight'],
-                    'description': line_item['description'],
-                    'validation_instructions': line_item['validation_instructions'],
-                    'line_type': line_item['line_type'],
-                    'section_id': created_section.uuid,
-                })
+                ChecklistLineItem.objects.get_or_create(
+                    name=line_item['name'],
+                    section_id=created_section.uuid,
+                    template_id=created_template.uuid,
+                    defaults={
+                        'weight': line_item['weight'],
+                        'description': line_item['description'],
+                        'validation_instructions':
+                        line_item['validation_instructions'],
+                        'line_type': line_item['line_type'],
+                        'section_id': created_section.uuid,
+                    })
 
 
 def create_validation_tests():
     logger.info('Creating Validation Tests')
-    template = ChecklistTemplate.objects.get(category='heat')
-    for test_name, line_item_name in validation_tests:
-        line_item = ChecklistLineItem.objects.get(name=line_item_name, template=template)
-        if line_item:
-            validation_test, status = ValidationTest.objects.get_or_create(name=test_name)
-            validation_test.line_items.add(line_item)
+    validation_tests = {
+        'heat': heat_validation_tests,
+        'glance': glance_validation_tests,
+    }
+    for category in validation_tests:
+        template = ChecklistTemplate.objects.get(category=category)
+        for test_name, line_item_name in validation_tests[category]:
+            line_item = ChecklistLineItem.objects.get(
+                name=line_item_name, template=template)
+            if line_item:
+                validation_test, status = ValidationTest.objects.get_or_create(
+                    name=test_name)
+                validation_test.line_items.add(line_item)
 
 
 def create_roles():
@@ -724,11 +892,13 @@ def create_companies():
         service_provider_company, created = Vendor.objects.get_or_create(
             name=Constants.service_provider_company_name, public=True)
         Constants.service_provider_company = service_provider_company
-        logger.info('The company was found or created : ' + str(service_provider_company))
+        logger.info('The company was found or created : ' +
+                    str(service_provider_company))
     except Exception as e:
         logger.error("bootstrap_actions - create_companies error:")
         logger.error(e)
-        logger.error('The company could not be found or created : ' + Constants.service_provider_company_name)
+        logger.error('The company could not be found or created : ' +
+                     Constants.service_provider_company_name)
 
     for company in companies_not_public:
         try:
@@ -766,22 +936,30 @@ def create_companies():
 
 
 def create_standard_users():
-    service_provider_company = Vendor.objects.get(name=Constants.service_provider_company_name)
+    service_provider_company = Vendor.objects.get(
+        name=Constants.service_provider_company_name)
     user_role = Role.objects.get(name="standard_user")
     user_list = dummy_users
 
     for user in user_list:
         try:
-            user_object, created = CustomUser.objects.get_or_create(username=user[1], defaults={
-                                                                    'is_active': True, 'email': user[1], 'activation_token': uuid4(), 'activation_token_create_time': timezone.now()})
+            user_object, created = CustomUser.objects.get_or_create(
+                username=user[1], defaults={
+                    'is_active': True, 'email': user[1],
+                    'activation_token': uuid4(),
+                    'activation_token_create_time': timezone.now()})
             user_object.set_password('iceusers')
             user_object.save()
             data = createUserTemplate(
-                service_provider_company, user[0], user_role, user[2], True, None, True, user_object)
-            standard_user, profile_created = IceUserProfile.objects.update_or_create(
-                email=user_object.email, defaults=data)
+                service_provider_company, user[0],
+                user_role, user[2], True, None,
+                True, user_object)
+            standard_user, profile_created = \
+                IceUserProfile.objects.update_or_create(
+                    email=user_object.email, defaults=data)
             logger.info(
-                'The Standard user was found or created: ' + str(standard_user.full_name))
+                'The Standard user was found or created: ' +
+                str(standard_user.full_name))
         except Exception as e:
             logger.error("bootstrap_actions - create_el_users error:")
             logger.error(e)
@@ -789,18 +967,23 @@ def create_standard_users():
 
 
 def create_el_users():
-    service_provider_company = Vendor.objects.get(name=Constants.service_provider_company_name)
+    service_provider_company = Vendor.objects.get(
+        name=Constants.service_provider_company_name)
     el_role = Role.objects.get(name="el")
     el_list = el_dummy_users
 
     for user in el_list:
         try:
-            user_object, created = CustomUser.objects.get_or_create(username=user[1], defaults={
-                                                                    'is_active': True, 'email': user[1], 'activation_token': uuid4(), 'activation_token_create_time': timezone.now()})
+            user_object, created = CustomUser.objects.get_or_create(
+                username=user[1], defaults={
+                    'is_active': True, 'email': user[1],
+                    'activation_token': uuid4(),
+                    'activation_token_create_time': timezone.now()})
             user_object.set_password('iceusers')
             user_object.save()
             data = createUserTemplate(
-                service_provider_company, user[0], el_role, user[2], True, None, True, user_object)
+                service_provider_company, user[0], el_role,
+                user[2], True, None, True, user_object)
             el_user, profile_created = IceUserProfile.objects.update_or_create(
                 email=user_object.email, defaults=data)
             logger.info(
@@ -812,23 +995,29 @@ def create_el_users():
 
 
 def create_admin_users():
-    service_provider_company = Vendor.objects.get(name=Constants.service_provider_company_name)
+    service_provider_company = Vendor.objects.get(
+        name=Constants.service_provider_company_name)
     admin_role = Role.objects.get(name=Roles.admin.name)  # @UndefinedVariable
 
     admin_list = admin_dummy_users
 
     for user in admin_list:
         try:
-            user_object, created = CustomUser.objects.get_or_create(username=user[1], defaults={'is_active': True, 'email': user[
-                                                                    1], 'password': "iceusers", 'activation_token': uuid4(), 'activation_token_create_time': timezone.now()})
+            user_object, created = CustomUser.objects.get_or_create(
+                username=user[1], defaults={'is_active': True, 'email': user[
+                    1], 'password': "iceusers", 'activation_token': uuid4(),
+                    'activation_token_create_time': timezone.now()})
             user_object.set_password('iceusers')
             user_object.save()
             data = createUserTemplate(
-                service_provider_company, user[0], admin_role, user[2], True, None, True, user_object)
-            admin_user, profile_created = IceUserProfile.objects.update_or_create(
-                email=user_object.email, defaults=data)
+                service_provider_company, user[0], admin_role, user[2],
+                True, None, True, user_object)
+            admin_user, profile_created = \
+                IceUserProfile.objects.update_or_create(
+                    email=user_object.email, defaults=data)
             logger.info(
-                'The admin user was found or created: ' + str(admin_user.full_name))
+                'The admin user was found or created: ' +
+                str(admin_user.full_name))
         except Exception as e:
             logger.error("bootstrap_actions - create_admin_users error:")
             logger.error(e)
@@ -836,7 +1025,8 @@ def create_admin_users():
 
 
 def create_admin_ro_users():
-    service_provider_company = Vendor.objects.get(name=Constants.service_provider_company_name)
+    service_provider_company = Vendor.objects.get(
+        name=Constants.service_provider_company_name)
     admin_ro_role = Role.objects.get(
         name=Roles.admin_ro.name)  # @UndefinedVariable
 
@@ -844,16 +1034,22 @@ def create_admin_ro_users():
 
     for user in admin_ro_list:
         try:
-            user_object, created = CustomUser.objects.get_or_create(username=user[1], defaults={'is_active': True, 'email': user[
-                                                                    1], 'password': "iceusers", 'activation_token': uuid4(), 'activation_token_create_time': timezone.now()})
+            user_object, created = CustomUser.objects.get_or_create(
+                username=user[1],
+                defaults={'is_active': True, 'email': user[
+                    1], 'password': "iceusers", 'activation_token': uuid4(),
+                    'activation_token_create_time': timezone.now()})
             user_object.set_password('iceusers')
             user_object.save()
             data = createUserTemplate(
-                service_provider_company, user[0], admin_ro_role, user[2], True, None, True, user_object)
-            admin_ro_user, profile_created = IceUserProfile.objects.update_or_create(
-                email=user_object.email, defaults=data)
+                service_provider_company, user[0], admin_ro_role, user[2],
+                True, None, True, user_object)
+            admin_ro_user, profile_created = \
+                IceUserProfile.objects.update_or_create(
+                    email=user_object.email, defaults=data)
             logger.info(
-                'The admin_ro user was found or created: ' + str(admin_ro_user.full_name))
+                'The admin_ro user was found or created: ' +
+                str(admin_ro_user.full_name))
         except Exception as e:
             logger.error("bootstrap_actions - create_admin_ro_users error:")
             logger.error(e)
@@ -866,10 +1062,12 @@ def create_admin_ro_users():
 def create_deployment_targets():
     for dt in deployment_targets:
         try:
-            deployment_target, created = DeploymentTarget.objects.get_or_create(
-                name=dt[0], version=dt[1], defaults={'version': dt[1]})
+            deployment_target, created = \
+                DeploymentTarget.objects.get_or_create(
+                    name=dt[0], version=dt[1], defaults={'version': dt[1]})
             logger.info(
-                'Deployment Target found or created: ' + str(deployment_target))
+                'Deployment Target found or created: ' +
+                str(deployment_target))
         except Exception as e:
             logger.error(
                 "bootstrap_actions - create_deployment_targets error:")
@@ -900,10 +1098,12 @@ def create_ecomp():
 def create_deployment_targets_sites():
     for dt in deployment_targets_sites:
         try:
-            deployment_target_site, created = DeploymentTargetSite.objects.get_or_create(
-                name=dt)
+            deployment_target_site, created = \
+                DeploymentTargetSite.objects.get_or_create(
+                    name=dt)
             logger.info(
-                'Deployment Target found or created: ' + str(deployment_target_site.name))
+                'Deployment Target found or created: ' +
+                str(deployment_target_site.name))
         except Exception as e:
             logger.error(
                 "bootstrap_actions - create_deployment_targets_sites error:")
index 2d6c5be..bde1986 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -39,7 +39,8 @@
 """ populate_all_gitlab_repo_and_user_and_jenkins
 Will populate gitlab and jenkins with vf data (where it's not exists).
 
-This command will be used for systems with missing gitlab/jenkins data for some vfs.
+This command will be used for systems
+with missing gitlab/jenkins data for some vfs.
 """
 from django.core.management.base import BaseCommand
 from rest_framework.status import HTTP_200_OK
@@ -55,14 +56,18 @@ logger = LoggingServiceFactory.get_logger()
 class Command(BaseCommand):
 
     def handle(self, *args, **options):
-        engStageList = [EngagementStage.Intake.name, EngagementStage.Active.name,
-                        EngagementStage.Validated.name, EngagementStage.Completed.name]
-        vf_list = VF.objects.filter(engagement__engagement_stage__in=engStageList)
+        engStageList = [EngagementStage.Intake.name,
+                        EngagementStage.Active.name,
+                        EngagementStage.Validated.name,
+                        EngagementStage.Completed.name]
+        vf_list = VF.objects.filter(
+            engagement__engagement_stage__in=engStageList)
         log_array = []
         error_array = []
         for vf_found in vf_list:
             logger.debug(vf_found.uuid)
-            msg, http_status, values = vm_client.send_provision_new_vf_event(vf_found)
+            msg, http_status, values = vm_client.send_provision_new_vf_event(
+                vf_found)
             vf_dict = {
                 'vf_uuid': vf_found.uuid,
                 'msg': msg,
index 52a1373..fd9db00 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -39,7 +39,8 @@
 """ render_rgwa_credentials
 Will create rados gateway user (S3 API) for each django user.
 
-This command will create the user if it's not exists so it safe to run it even the user are exists.
+This command will create the user if it's not exists
+so it safe to run it even the user are exists.
 This command is part of bucket usage (images) efforts.
 """
 from django.db.models import Q
index ffbb95a..ddbe92f 100644 (file)
@@ -1,5 +1,4 @@
-#  
-# ============LICENSE_START========================================== 
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -59,12 +58,17 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='Activity',
             fields=[
-                ('uuid', models.CharField(max_length=36, primary_key=True, serialize=False, unique=True)),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now)),
+                ('uuid', models.CharField(max_length=36,
+                                          primary_key=True, serialize=False,
+                                          unique=True)),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now)),
                 ('description', models.CharField(max_length=512)),
                 ('is_notification', models.BooleanField(default=False)),
                 ('activity_type', models.CharField(choices=[
-                 (b'3', b'eng_validation_request'), (b'4', b'next_steps'), (b'2', b'ssh_key_added'), (b'1', b'user_joined_eng')], max_length=36)),
+                 (b'3', b'eng_validation_request'), (b'4', b'next_steps'),
+                 (b'2', b'ssh_key_added'), (b'1', b'user_joined_eng')],
+                    max_length=36)),
                 ('metadata', models.CharField(max_length=1024)),
             ],
             options={
@@ -75,7 +79,9 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='ApplicationServiceInfrastructure',
             fields=[
-                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('id', models.AutoField(auto_created=True,
+                                        primary_key=True, serialize=False,
+                                        verbose_name='ID')),
                 ('name', models.CharField(max_length=100, unique=True)),
                 ('uuid', models.CharField(max_length=36, unique=True)),
             ],
@@ -86,12 +92,17 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='ContactRequest',
             fields=[
-                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='creation time')),
+                ('id', models.AutoField(auto_created=True,
+                                        primary_key=True, serialize=False,
+                                        verbose_name='ID')),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now,
+                    verbose_name='creation time')),
                 ('uuid', models.CharField(max_length=36, unique=True)),
                 ('fname', models.CharField(max_length=50)),
                 ('lname', models.CharField(max_length=50)),
-                ('email', models.EmailField(max_length=254, verbose_name='email')),
+                ('email', models.EmailField(max_length=254,
+                                            verbose_name='email')),
                 ('company', models.CharField(max_length=50)),
                 ('phone_number', models.CharField(max_length=30)),
                 ('message', models.TextField()),
@@ -103,7 +114,8 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='DeploymentTarget',
             fields=[
-                ('uuid', models.CharField(max_length=36, primary_key=True, serialize=False)),
+                ('uuid', models.CharField(max_length=36,
+                                          primary_key=True, serialize=False)),
                 ('name', models.CharField(max_length=45)),
                 ('version', models.CharField(max_length=100)),
             ],
@@ -114,12 +126,16 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='Engagement',
             fields=[
-                ('uuid', models.CharField(max_length=64, primary_key=True, serialize=False)),
-                ('engagement_manual_id', models.CharField(blank=True, max_length=36, null=True)),
+                ('uuid', models.CharField(max_length=64,
+                                          primary_key=True, serialize=False)),
+                ('engagement_manual_id', models.CharField(
+                    blank=True, max_length=36, null=True)),
                 ('progress', models.IntegerField(default=0)),
-                ('target_completion_date', models.DateField(blank=True, default=datetime.datetime(
-                    2016, 6, 29, 14, 7, 41, 103000, tzinfo=utc), null=True)),
-                ('engagement_stage', models.CharField(default=b'Intake', max_length=15)),
+                ('target_completion_date',
+                 models.DateField(blank=True, default=datetime.datetime(
+                     2016, 6, 29, 14, 7, 41, 103000, tzinfo=utc), null=True)),
+                ('engagement_stage', models.CharField(
+                    default=b'Intake', max_length=15)),
             ],
             options={
                 'db_table': 'ice_engagement',
@@ -128,19 +144,25 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='EngagementRequest',
             fields=[
-                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='creation time')),
+                ('id', models.AutoField(auto_created=True,
+                                        primary_key=True, serialize=False,
+                                        verbose_name='ID')),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now,
+                    verbose_name='creation time')),
                 ('uuid', models.CharField(max_length=36, unique=True)),
                 ('fname', models.CharField(max_length=50)),
                 ('lname', models.CharField(max_length=50)),
-                ('email', models.EmailField(max_length=254, verbose_name='email')),
+                ('email', models.EmailField(max_length=254,
+                                            verbose_name='email')),
                 ('company', models.CharField(max_length=50)),
                 ('country_code', models.CharField(max_length=5)),
                 ('phone_number', models.CharField(max_length=30)),
                 ('vf_csv', models.CharField(max_length=80)),
                 ('att_contact_fname', models.CharField(max_length=50)),
                 ('att_contact_lname', models.CharField(max_length=50)),
-                ('att_contact_email', models.EmailField(max_length=254, verbose_name='email')),
+                ('att_contact_email', models.EmailField(
+                    max_length=254, verbose_name='email')),
                 ('att_contact_phone', models.CharField(max_length=30)),
                 ('request_type', models.CharField(max_length=20)),
                 ('description', models.TextField()),
@@ -153,24 +175,36 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='IceUser',
             fields=[
-                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('id', models.AutoField(auto_created=True,
+                                        primary_key=True, serialize=False,
+                                        verbose_name='ID')),
                 ('uuid', models.CharField(max_length=36, unique=True)),
                 ('phone_number', models.CharField(max_length=30)),
                 ('full_name', models.CharField(max_length=30)),
-                ('email', models.EmailField(max_length=254, unique=True, verbose_name='email')),
+                ('email', models.EmailField(
+                    max_length=254,
+                    unique=True, verbose_name='email')),
                 ('password', models.CharField(max_length=256)),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='creation time')),
-                ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last_login')),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now,
+                    verbose_name='creation time')),
+                ('last_login', models.DateTimeField(
+                    blank=True, null=True, verbose_name='last_login')),
                 ('ssh_public_key', models.CharField(
-                    blank=True, max_length=1024, null=True, verbose_name='ssh_public_key')),
+                    blank=True, max_length=1024, null=True,
+                    verbose_name='ssh_public_key')),
                 ('regular_email_updates', models.BooleanField(default=False)),
-                ('email_updates_on_every_notification', models.BooleanField(default=True)),
-                ('email_updates_daily_digest', models.BooleanField(default=False)),
+                ('email_updates_on_every_notification',
+                 models.BooleanField(default=True)),
+                ('email_updates_daily_digest',
+                 models.BooleanField(default=False)),
                 ('is_active', models.BooleanField()),
                 ('is_att_contact', models.BooleanField()),
-                ('activation_token', models.CharField(max_length=128, unique=True)),
+                ('activation_token', models.CharField(max_length=128,
+                                                      unique=True)),
                 ('activation_token_create_time', models.DateTimeField(
-                    default=django.utils.timezone.now, verbose_name='activation_token_create_time')),
+                    default=django.utils.timezone.now,
+                    verbose_name='activation_token_create_time')),
             ],
             options={
                 'db_table': 'ice_user',
@@ -179,21 +213,31 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='NextStep',
             fields=[
-                ('uuid', models.CharField(max_length=36, primary_key=True, serialize=False)),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='creation time')),
+                ('uuid', models.CharField(max_length=36,
+                                          primary_key=True, serialize=False)),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now,
+                    verbose_name='creation time')),
                 ('last_update_time', models.DateTimeField(
-                    default=django.utils.timezone.now, verbose_name='last update time')),
-                ('last_update_type', models.CharField(default='Added', max_length=15)),
+                    default=django.utils.timezone.now,
+                    verbose_name='last update time')),
+                ('last_update_type', models.CharField(
+                    default='Added', max_length=15)),
                 ('position', models.IntegerField()),
                 ('description', models.TextField()),
                 ('state', models.CharField(max_length=15)),
                 ('engagement_stage', models.CharField(max_length=15)),
-                ('creator', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
-                                              related_name='NextStep_creator', to='engagementmanager.IceUser')),
+                ('creator', models.ForeignKey(
+                    on_delete=django.db.models.deletion.PROTECT,
+                    related_name='NextStep_creator',
+                    to='engagementmanager.IceUser')),
                 ('engagement', models.ForeignKey(
-                    on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.Engagement')),
-                ('last_updater', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT,
-                                                   related_name='NextStep_last_updater', to='engagementmanager.IceUser')),
+                    on_delete=django.db.models.deletion.PROTECT,
+                    to='engagementmanager.Engagement')),
+                ('last_updater', models.ForeignKey(
+                    null=True, on_delete=django.db.models.deletion.PROTECT,
+                    related_name='NextStep_last_updater',
+                    to='engagementmanager.IceUser')),
             ],
             options={
                 'db_table': 'ice_next_step',
@@ -203,13 +247,17 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='Notification',
             fields=[
-                ('uuid', models.CharField(max_length=36, primary_key=True, serialize=False, unique=True)),
+                ('uuid', models.CharField(max_length=36,
+                                          primary_key=True, serialize=False,
+                                          unique=True)),
                 ('is_sent', models.BooleanField(default=False)),
                 ('is_read', models.BooleanField(default=False)),
                 ('activity', models.ForeignKey(
-                    null=True, on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.Activity')),
+                    null=True, on_delete=django.db.models.deletion.CASCADE,
+                    to='engagementmanager.Activity')),
                 ('user', models.ForeignKey(
-                    on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.IceUser')),
+                    on_delete=django.db.models.deletion.CASCADE,
+                    to='engagementmanager.IceUser')),
             ],
             options={
                 'db_table': 'ice_notification',
@@ -218,7 +266,9 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='Role',
             fields=[
-                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('id', models.AutoField(auto_created=True,
+                                        primary_key=True, serialize=False,
+                                        verbose_name='ID')),
                 ('uuid', models.CharField(max_length=36, unique=True)),
                 ('name', models.CharField(max_length=36, unique=True)),
             ],
@@ -229,7 +279,9 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='Test',
             fields=[
-                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('id', models.AutoField(auto_created=True,
+                                        primary_key=True, serialize=False,
+                                        verbose_name='ID')),
                 ('name', models.CharField(max_length=45)),
                 ('uuid', models.CharField(max_length=36, unique=True)),
             ],
@@ -240,7 +292,9 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='ValidationCycle',
             fields=[
-                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('id', models.AutoField(auto_created=True,
+                                        primary_key=True, serialize=False,
+                                        verbose_name='ID')),
                 ('uuid', models.CharField(max_length=36, unique=True)),
                 ('start_date', models.DateTimeField()),
                 ('end_date', models.DateTimeField()),
@@ -264,7 +318,9 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='ValidationException',
             fields=[
-                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('id', models.AutoField(auto_created=True,
+                                        primary_key=True, serialize=False,
+                                        verbose_name='ID')),
                 ('uuid', models.CharField(max_length=36, unique=True)),
                 ('type', models.CharField(max_length=45)),
                 ('external_ref_id', models.CharField(max_length=45)),
@@ -276,16 +332,24 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='ValidationSteps',
             fields=[
-                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('id', models.AutoField(auto_created=True,
+                                        primary_key=True, serialize=False,
+                                        verbose_name='ID')),
                 ('uuid', models.CharField(max_length=36)),
-                ('requirment_id', models.CharField(blank=True, max_length=36, null=True)),
+                ('requirment_id', models.CharField(
+                    blank=True, max_length=36, null=True)),
                 ('passed', models.BooleanField()),
                 ('log', models.BinaryField()),
-                ('validation_notes', models.CharField(blank=True, max_length=200, null=True)),
-                ('test', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.Test')),
+                ('validation_notes', models.CharField(
+                    blank=True, max_length=200, null=True)),
+                ('test', models.ForeignKey(
+                    on_delete=django.db.models.deletion.PROTECT,
+                    to='engagementmanager.Test')),
                 ('validation_cycle', models.ForeignKey(
-                    on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.ValidationCycle')),
-                ('validation_exceptions', models.ManyToManyField(to='engagementmanager.ValidationException')),
+                    on_delete=django.db.models.deletion.PROTECT,
+                    to='engagementmanager.ValidationCycle')),
+                ('validation_exceptions', models.ManyToManyField(
+                    to='engagementmanager.ValidationException')),
             ],
             options={
                 'db_table': 'ice_validation_step',
@@ -295,7 +359,9 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='Vendor',
             fields=[
-                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('id', models.AutoField(auto_created=True,
+                                        primary_key=True, serialize=False,
+                                        verbose_name='ID')),
                 ('uuid', models.CharField(max_length=36, unique=True)),
                 ('name', models.CharField(max_length=100, unique=True)),
             ],
@@ -307,16 +373,25 @@ class Migration(migrations.Migration):
             name='VF',
             fields=[
                 ('name', models.CharField(max_length=100)),
-                ('uuid', models.CharField(max_length=36, primary_key=True, serialize=False, unique=True)),
+                ('uuid', models.CharField(max_length=36,
+                                          primary_key=True, serialize=False,
+                                          unique=True)),
                 ('is_att_internal', models.BooleanField(default=False)),
-                ('git_repo_url', models.CharField(blank=True, max_length=512, null=True)),
-                ('target_lab_entry_date', models.DateField(verbose_name='target_lab_entry_date')),
-                ('deployment_target', models.ForeignKey(blank=True, null=True,
-                                                        on_delete=django.db.models.deletion.SET_NULL, to='engagementmanager.DeploymentTarget')),
-                ('engagement', models.ForeignKey(blank=True, null=True,
-                                                 on_delete=django.db.models.deletion.SET_NULL, to='engagementmanager.Engagement')),
+                ('git_repo_url', models.CharField(
+                    blank=True, max_length=512, null=True)),
+                ('target_lab_entry_date', models.DateField(
+                    verbose_name='target_lab_entry_date')),
+                ('deployment_target', models.ForeignKey(
+                    blank=True, null=True,
+                    on_delete=django.db.models.deletion.SET_NULL,
+                    to='engagementmanager.DeploymentTarget')),
+                ('engagement', models.ForeignKey(
+                    blank=True, null=True,
+                    on_delete=django.db.models.deletion.SET_NULL,
+                    to='engagementmanager.Engagement')),
                 ('vendor', models.ForeignKey(
-                    on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.Vendor')),
+                    on_delete=django.db.models.deletion.PROTECT,
+                    to='engagementmanager.Vendor')),
             ],
             options={
                 'db_table': 'ice_vf',
@@ -325,12 +400,17 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='VFC',
             fields=[
-                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('id', models.AutoField(auto_created=True,
+                                        primary_key=True, serialize=False,
+                                        verbose_name='ID')),
                 ('name', models.CharField(max_length=45)),
                 ('version', models.CharField(max_length=45)),
                 ('uuid', models.CharField(max_length=36, unique=True)),
-                ('vf_acronym', models.CharField(blank=True, max_length=100, null=True)),
-                ('vf', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.VF')),
+                ('vf_acronym', models.CharField(
+                    blank=True, max_length=100, null=True)),
+                ('vf', models.ForeignKey(
+                    on_delete=django.db.models.deletion.PROTECT,
+                    to='engagementmanager.VF')),
             ],
             options={
                 'db_table': 'ice_vfc',
@@ -343,28 +423,37 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='validationcycle',
             name='vfc',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.VFC'),
+            field=models.ForeignKey(
+                on_delete=django.db.models.deletion.PROTECT,
+                to='engagementmanager.VFC'),
         ),
         migrations.AddField(
             model_name='iceuser',
             name='company',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.Vendor'),
+            field=models.ForeignKey(
+                on_delete=django.db.models.deletion.PROTECT,
+                to='engagementmanager.Vendor'),
         ),
         migrations.AddField(
             model_name='iceuser',
             name='role',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.Role'),
+            field=models.ForeignKey(
+                on_delete=django.db.models.deletion.PROTECT,
+                to='engagementmanager.Role'),
         ),
         migrations.AddField(
             model_name='engagement',
             name='contact_user',
-            field=models.ForeignKey(blank=True, null=True,
-                                    on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.IceUser'),
+            field=models.ForeignKey(
+                blank=True, null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                to='engagementmanager.IceUser'),
         ),
         migrations.AddField(
             model_name='engagement',
             name='engagement_team',
-            field=models.ManyToManyField(related_name='members', to='engagementmanager.IceUser'),
+            field=models.ManyToManyField(
+                related_name='members', to='engagementmanager.IceUser'),
         ),
         migrations.AlterUniqueTogether(
             name='deploymenttarget',
@@ -377,13 +466,17 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='activity',
             name='activity_owner',
-            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE,
-                                    to='engagementmanager.IceUser'),
+            field=models.ForeignKey(
+                null=True,
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.IceUser'),
         ),
         migrations.AddField(
             model_name='activity',
             name='engagement',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.Engagement'),
+            field=models.ForeignKey(
+                on_delete=django.db.models.deletion.PROTECT,
+                to='engagementmanager.Engagement'),
         ),
         migrations.AlterUniqueTogether(
             name='vfc',
index ae740e2..6ca999e 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -41,13 +41,11 @@ from django.conf import settings
 import django.contrib.auth.models
 from django.db import models
 import django.db.models.deletion
-from django.utils.timezone import utc
 import django.utils.timezone
 import engagementmanager.models
 import uuid
 import os
 from django.db import migrations, connection
-import engagementmanager
 from engagementmanager.service.logging_service import LoggingServiceFactory
 
 logger = LoggingServiceFactory.get_logger()
@@ -55,27 +53,34 @@ logger = LoggingServiceFactory.get_logger()
 
 def forwards(apps, schema_editor):
     if not schema_editor.connection.alias == 'default' \
-            or settings.DATABASES["default"]["ENGINE"] == "django.db.backends.sqlite3":
+            or settings.DATABASES["default"]["ENGINE"] == \
+            "django.db.backends.sqlite3":
         return
 
     cursor = connection.cursor()
-    cursor.execute(open(os.path.join(os.path.dirname(engagementmanager.__file__),
-                                     'sql-scripts/generate_excel_overview_sheet_procedure.sql'), "r").read())
+    cursor.execute(
+        open(
+            os.path.join(
+                os.path.dirname(
+                    engagementmanager.__file__),
+                'sql-scripts/generate_excel_overview_sheet_procedure.sql'),
+            "r").read())
 
 
 def create_user_for_pre_user_profiles(apps, schema_editor):
     CustomUser = apps.get_model("engagementmanager", "CustomUser")
     IceUserProfile = apps.get_model("engagementmanager", "IceUserProfile")
     users_list = IceUserProfile.objects.filter(user=None)
-    count = 0
     for profile in users_list:
         try:
-            custom_user, created = CustomUser.objects.get_or_create(username=profile.email)
+            custom_user, created = CustomUser.objects.get_or_create(
+                username=profile.email)
             custom_user.is_active = profile.is_active
             custom_user.email = profile.email
             custom_user.activation_token = profile.activation_token
             custom_user.password = profile.password
-            custom_user.activation_token_create_time = profile.activation_token_create_time
+            custom_user.activation_token_create_time = \
+                profile.activation_token_create_time
             custom_user.save()
             profile.user = custom_user
             profile.save()
@@ -86,27 +91,54 @@ def create_user_for_pre_user_profiles(apps, schema_editor):
 
 
 class Migration(migrations.Migration):
-    replaces = [('engagementmanager', '0001_initial'), ('engagementmanager', '0002_auto_20160704_1028'),
-                ('engagementmanager', '0003_auto_20160713_0929'), ('engagementmanager', '0004_auto_20160720_2143'),
-                ('engagementmanager', '0005_auto_20160815_1248'), ('engagementmanager', '0006_auto_20160825_0644'),
-                ('engagementmanager', '0007_auto_20160922_0421'), ('engagementmanager', '0008_auto_20161009_1210'),
-                ('engagementmanager', '0009_auto_20161018_0740'), ('engagementmanager', '0010_auto_20161025_0838'),
-                ('engagementmanager', '0011_auto_20161109_0811'), ('engagementmanager', '0012_auto_20161109_0822'),
-                ('engagementmanager', '0013_auto_20161128_1159'), ('engagementmanager', '0014_auto_20161129_1145'),
-                ('engagementmanager', '0015_engagementstatus'), ('engagementmanager', '0016_auto_20161208_0842'),
-                ('engagementmanager', '0017_auto_20161215_1535'), ('engagementmanager', '0018_set_old_notif_true'),
-                ('engagementmanager', '0019_auto_20170104_1715'), ('engagementmanager', '0020_add_indexes_20170108'),
-                ('engagementmanager', '0021_generate_excel_overview_sheet_procedure_20170110'),
-                ('engagementmanager', '0022_auto_20170118_1520'), ('engagementmanager', '0023_auto_20170123_1445'),
+    replaces = [('engagementmanager', '0001_initial'),
+                ('engagementmanager', '0002_auto_20160704_1028'),
+                ('engagementmanager', '0003_auto_20160713_0929'),
+                ('engagementmanager', '0004_auto_20160720_2143'),
+                ('engagementmanager', '0005_auto_20160815_1248'),
+                ('engagementmanager',
+                 '0006_auto_20160825_0644'),
+                ('engagementmanager', '0007_auto_20160922_0421'),
+                ('engagementmanager',
+                 '0008_auto_20161009_1210'),
+                ('engagementmanager', '0009_auto_20161018_0740'),
+                ('engagementmanager',
+                 '0010_auto_20161025_0838'),
+                ('engagementmanager', '0011_auto_20161109_0811'),
+                ('engagementmanager',
+                 '0012_auto_20161109_0822'),
+                ('engagementmanager', '0013_auto_20161128_1159'),
+                ('engagementmanager',
+                 '0014_auto_20161129_1145'),
+                ('engagementmanager', '0015_engagementstatus'),
+                ('engagementmanager',
+                 '0016_auto_20161208_0842'),
+                ('engagementmanager', '0017_auto_20161215_1535'),
+                ('engagementmanager',
+                 '0018_set_old_notif_true'),
+                ('engagementmanager', '0019_auto_20170104_1715'),
+                ('engagementmanager',
+                 '0020_add_indexes_20170108'),
+                ('engagementmanager',
+                 '0021_generate_excel_overview_sheet_procedure_20170110'),
+                ('engagementmanager', '0022_auto_20170118_1520'),
+                ('engagementmanager',
+                 '0023_auto_20170123_1445'),
                 ('engagementmanager', '0024_auto_20170227_1224'),
                 ('engagementmanager', '0025_change_nextsteps_to_new_state'),
-                ('engagementmanager', '0026_add_slack_handle_to_ice_user_profile'),
-                ('engagementmanager', '0027_add_version_to_vf'), ('engagementmanager', '0028_auto_20170425_1310'),
+                ('engagementmanager',
+                 '0026_add_slack_handle_to_ice_user_profile'),
+                ('engagementmanager', '0027_add_version_to_vf'),
+                ('engagementmanager',
+                 '0028_auto_20170425_1310'),
                 ('engagementmanager', '0029_auto_20170504_0749'),
                 ('engagementmanager', '0030_engagement_archived_time'),
-                ('engagementmanager', '0031_auto_20170620_1312'), ('engagementmanager', '0032_auto_20170702_1435'),
+                ('engagementmanager', '0031_auto_20170620_1312'),
+                ('engagementmanager',
+                 '0032_auto_20170702_1435'),
                 ('engagementmanager', '0033_auto_20170704_0635'),
-                ('engagementmanager', '0034_engagement_is_with_files'), ('engagementmanager', '0035_rgwa_fields'),
+                ('engagementmanager', '0034_engagement_is_with_files'),
+                ('engagementmanager', '0035_rgwa_fields'),
                 ('engagementmanager', '0036_auto_20170906_0935')]
 
     initial = True
@@ -119,11 +151,34 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='Activity',
             fields=[
-                ('uuid', models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False, unique=True)),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now)),
+                ('uuid', models.CharField(
+
+                    default=uuid.uuid4, max_length=36,
+                    primary_key=True, serialize=False,
+                    unique=True)),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now)),
                 ('description', models.CharField(max_length=512)),
                 ('is_notification', models.BooleanField(default=False)),
-                ('activity_type', models.CharField(choices=[('user_joined_eng', 'user_joined_eng'), ('ssh_key_added', 'ssh_key_added'), ('eng_validation_request', 'eng_validation_request'), ('update_next_steps', 'update_next_steps'), ('vfc', 'vfc'), ('change_checklist_state', 'change_checklist_state'), ('vf_provisioning_event', 'vf_provisioning_event'), ('test_finished_event', 'test_finished_event'), ('change_engagement_stage', 'change_engagement_stage'), ('add_next_steps', 'add_next_steps'), ('delete_next_steps', 'delete_next_steps'), ('notice_empty_engagement', 'notice_empty_engagement')], max_length=36)),
+                ('activity_type', models.CharField(
+
+                    choices=[('user_joined_eng', 'user_joined_eng'),
+                             ('ssh_key_added', 'ssh_key_added'),
+                             ('eng_validation_request',
+                              'eng_validation_request'),
+                             ('update_next_steps', 'update_next_steps'),
+                             ('vfc', 'vfc'), ('change_checklist_state',
+                                              'change_checklist_state'),
+                             ('vf_provisioning_event',
+                              'vf_provisioning_event'),
+                             ('test_finished_event', 'test_finished_event'),
+                             ('change_engagement_stage',
+                              'change_engagement_stage'),
+                             ('add_next_steps', 'add_next_steps'),
+                             ('delete_next_steps', 'delete_next_steps'),
+                             ('notice_empty_engagement',
+                              'notice_empty_engagement')],
+                    max_length=36)),
                 ('metadata', models.CharField(max_length=1024)),
             ],
             options={
@@ -134,9 +189,15 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='ApplicationServiceInfrastructure',
             fields=[
-                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('id', models.AutoField(
+                    auto_created=True,
+                    primary_key=True, serialize=False,
+                    verbose_name='ID')),
                 ('name', models.CharField(max_length=100, unique=True)),
-                ('uuid', models.CharField(default=uuid.uuid4, max_length=36, unique=True)),
+                ('uuid', models.CharField(
+
+
+                    default=uuid.uuid4, max_length=36, unique=True)),
             ],
             options={
                 'db_table': 'ice_application_service_infrastructure',
@@ -145,14 +206,37 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='Checklist',
             fields=[
-                ('uuid', models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False)),
-                ('name', models.CharField(max_length=255, verbose_name='checklist name')),
-                ('state', models.CharField(choices=[('automation', 'automation'), ('review', 'review'), ('peer_review', 'peer_review'), ('approval', 'approval'), ('handoff', 'handoff'), ('closed', 'closed'), ('archive', 'archive'), ('pending', 'pending')], default='pending', max_length=36)),
-                ('validation_cycle', models.IntegerField(verbose_name='validation cycle')),
-                ('weight', models.FloatField(default=0, verbose_name='checklist weight')),
-                ('associated_files', models.TextField(verbose_name='list of files from gitlab')),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='creation time')),
-                ('update_time', models.DateTimeField(blank=True, null=True, verbose_name='last update time')),
+                ('uuid', models.CharField(
+
+                    default=uuid.uuid4,
+                    max_length=36, primary_key=True, serialize=False)),
+                ('name', models.CharField(
+                    max_length=255,
+                    verbose_name='checklist name')),
+                ('state', models.CharField(
+                    choices=[('automation', 'automation'),
+                             ('review', 'review'),
+                             ('peer_review', 'peer_review'),
+                             ('approval', 'approval'), (
+                        'handoff', 'handoff'), ('closed', 'closed'),
+                        ('archive', 'archive'), ('pending', 'pending')],
+                    default='pending', max_length=36)),
+                ('validation_cycle', models.IntegerField(
+
+                    verbose_name='validation cycle')),
+                ('weight', models.FloatField(
+                    default=0,
+                    verbose_name='checklist weight')),
+                ('associated_files', models.TextField(
+
+                    verbose_name='list of files from gitlab')),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now,
+                    verbose_name='creation time')),
+                ('update_time', models.DateTimeField(
+                    blank=True,
+                    null=True,
+                    verbose_name='last update time')),
             ],
             options={
                 'db_table': 'ice_checklist',
@@ -161,12 +245,24 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='ChecklistAuditLog',
             fields=[
-                ('uuid', models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False)),
+                ('uuid', models.CharField(
+
+                    default=uuid.uuid4,
+                    max_length=36, primary_key=True, serialize=False)),
                 ('category', models.CharField(max_length=255)),
                 ('description', models.TextField()),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='creation time')),
-                ('update_time', models.DateTimeField(blank=True, null=True, verbose_name='last update time')),
-                ('checklist', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.Checklist')),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now,
+                    verbose_name='creation time')),
+                ('update_time', models.DateTimeField(
+                    blank=True,
+                    null=True,
+                    verbose_name='last update time')),
+                ('checklist', models.ForeignKey(
+                    blank=True, null=True,
+
+                    on_delete=django.db.models.deletion.CASCADE,
+                    to='engagementmanager.Checklist')),
             ],
             options={
                 'db_table': 'ice_checklist_audit_log',
@@ -175,12 +271,31 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='ChecklistDecision',
             fields=[
-                ('uuid', models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False)),
-                ('review_value', models.CharField(choices=[('approved', 'approved'), ('denied', 'denied'), ('not_relevant', 'not_relevant'), ('na', 'na')], max_length=36)),
-                ('peer_review_value', models.CharField(choices=[('approved', 'approved'), ('denied', 'denied'), ('not_relevant', 'not_relevant'), ('na', 'na')], max_length=36)),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='creation time')),
-                ('update_time', models.DateTimeField(blank=True, null=True, verbose_name='last update time')),
-                ('checklist', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.Checklist')),
+                ('uuid', models.CharField(
+
+                    default=uuid.uuid4,
+                    max_length=36, primary_key=True, serialize=False)),
+                ('review_value', models.CharField(
+                    choices=[('approved', 'approved'), (
+                        'denied', 'denied'),
+                        ('not_relevant', 'not_relevant'),
+                        ('na', 'na')], max_length=36)),
+                ('peer_review_value', models.CharField(
+                    choices=[('approved', 'approved'), (
+                        'denied', 'denied'),
+                        ('not_relevant', 'not_relevant'),
+                        ('na', 'na')], max_length=36)),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now,
+                    verbose_name='creation time')),
+                ('update_time', models.DateTimeField(
+                    blank=True,
+                    null=True,
+                    verbose_name='last update time')),
+                ('checklist', models.ForeignKey(
+
+                    on_delete=django.db.models.deletion.CASCADE,
+                    to='engagementmanager.Checklist')),
             ],
             options={
                 'db_table': 'ice_checklist_decision',
@@ -189,14 +304,31 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='ChecklistLineItem',
             fields=[
-                ('uuid', models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False)),
-                ('name', models.CharField(max_length=255, verbose_name='line name')),
-                ('weight', models.FloatField(verbose_name='line weight')),
-                ('description', models.TextField(verbose_name='line description')),
-                ('line_type', models.CharField(choices=[('auto', 'auto'), ('manual', 'manual')], default='auto', max_length=36)),
-                ('validation_instructions', models.TextField(verbose_name='line validation instructions')),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='creation time')),
-                ('update_time', models.DateTimeField(blank=True, null=True, verbose_name='last update time')),
+                ('uuid', models.CharField(
+
+                    default=uuid.uuid4,
+                    max_length=36, primary_key=True, serialize=False)),
+                ('name', models.CharField(max_length=255,
+                                          verbose_name='line name')),
+                ('weight', models.FloatField(
+                    verbose_name='line weight')),
+                ('description', models.TextField(
+                    verbose_name='line description')),
+                ('line_type', models.CharField(
+                    choices=[
+                        ('auto', 'auto'), ('manual', 'manual')],
+                    default='auto',
+                    max_length=36)),
+                ('validation_instructions', models.TextField(
+
+                    verbose_name='line validation instructions')),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now,
+                    verbose_name='creation time')),
+                ('update_time', models.DateTimeField(
+                    blank=True,
+                    null=True,
+                    verbose_name='last update time')),
             ],
             options={
                 'db_table': 'ice_checklist_line_item',
@@ -205,14 +337,32 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='ChecklistSection',
             fields=[
-                ('uuid', models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False)),
-                ('name', models.CharField(max_length=255, verbose_name='section name')),
-                ('weight', models.FloatField(verbose_name='checklist weight')),
-                ('description', models.TextField(verbose_name='section description')),
-                ('validation_instructions', models.TextField(verbose_name='section validation instructions')),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='creation time')),
-                ('update_time', models.DateTimeField(blank=True, null=True, verbose_name='last update time')),
-                ('parent_section', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.ChecklistSection')),
+                ('uuid', models.CharField(
+
+                    default=uuid.uuid4,
+                    max_length=36, primary_key=True, serialize=False)),
+                ('name', models.CharField(max_length=255,
+                                          verbose_name='section name')),
+                ('weight', models.FloatField(
+                    verbose_name='checklist weight')),
+                ('description', models.TextField(
+
+                    verbose_name='section description')),
+                ('validation_instructions', models.TextField(
+
+                    verbose_name='section validation instructions')),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now,
+                    verbose_name='creation time')),
+                ('update_time', models.DateTimeField(
+                    blank=True,
+                    null=True,
+                    verbose_name='last update time')),
+                ('parent_section', models.ForeignKey(
+                    blank=True, null=True,
+
+                    on_delete=django.db.models.deletion.CASCADE,
+                    to='engagementmanager.ChecklistSection')),
             ],
             options={
                 'db_table': 'ice_checklist_section',
@@ -221,12 +371,27 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='ChecklistTemplate',
             fields=[
-                ('uuid', models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False)),
-                ('name', models.CharField(max_length=255, verbose_name='template name')),
-                ('category', models.CharField(choices=[('overall', 'overall'), ('heat', 'heat'), ('glance', 'glance'), ('instantiation', 'instantiation'), ('asdc', 'asdc')], default='overall', max_length=36)),
-                ('version', models.IntegerField(verbose_name='template version')),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='creation time')),
-                ('update_time', models.DateTimeField(blank=True, null=True, verbose_name='last update time')),
+                ('uuid', models.CharField(
+
+                    default=uuid.uuid4,
+                    max_length=36, primary_key=True, serialize=False)),
+                ('name', models.CharField(max_length=255,
+                                          verbose_name='template name')),
+                ('category', models.CharField(
+                    choices=[('overall', 'overall'),
+                             ('heat', 'heat'), ('glance', 'glance'), (
+                        'instantiation', 'instantiation'), ('asdc', 'asdc')],
+                    default='overall',
+                    max_length=36)),
+                ('version', models.IntegerField(
+                    verbose_name='template version')),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now,
+                    verbose_name='creation time')),
+                ('update_time', models.DateTimeField(
+                    blank=True,
+                    null=True,
+                    verbose_name='last update time')),
             ],
             options={
                 'db_table': 'ice_checklist_template',
@@ -235,10 +400,19 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='CustomUser',
             fields=[
-                ('user_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
-                ('activation_token', models.CharField(max_length=128, null=True, unique=True)),
-                ('activation_token_create_time', models.DateTimeField(default=django.utils.timezone.now, null=True, verbose_name='activation_token_create_time')),
-                ('temp_password', models.CharField(blank=True, default=None, max_length=256, null=True)),
+                ('user_ptr', models.OneToOneField(
+                    auto_created=True,
+                    on_delete=django.db.models.deletion.CASCADE,
+                    parent_link=True, primary_key=True, serialize=False,
+                    to=settings.AUTH_USER_MODEL)),
+                ('activation_token', models.CharField(
+                    max_length=128, null=True, unique=True)),
+                ('activation_token_create_time', models.DateTimeField(
+                    default=django.utils.timezone.now, null=True,
+                    verbose_name='activation_token_create_time')),
+                ('temp_password', models.CharField(
+
+                    blank=True, default=None, max_length=256, null=True)),
             ],
             options={
                 'db_table': 'ice_custom_user',
@@ -251,7 +425,10 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='DeploymentTarget',
             fields=[
-                ('uuid', models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False)),
+                ('uuid', models.CharField(
+
+                    default=uuid.uuid4,
+                    max_length=36, primary_key=True, serialize=False)),
                 ('name', models.CharField(max_length=45)),
                 ('version', models.CharField(max_length=100)),
                 ('weight', models.IntegerField(default=1)),
@@ -264,7 +441,10 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='DeploymentTargetSite',
             fields=[
-                ('uuid', models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False)),
+                ('uuid', models.CharField(
+
+                    default=uuid.uuid4,
+                    max_length=36, primary_key=True, serialize=False)),
                 ('name', models.CharField(max_length=45)),
             ],
             options={
@@ -274,7 +454,10 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='ECOMPRelease',
             fields=[
-                ('uuid', models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False)),
+                ('uuid', models.CharField(
+
+                    default=uuid.uuid4,
+                    max_length=36, primary_key=True, serialize=False)),
                 ('name', models.CharField(max_length=45)),
                 ('weight', models.IntegerField(default=1)),
                 ('ui_visibility', models.BooleanField(default=True)),
@@ -286,23 +469,68 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='Engagement',
             fields=[
-                ('uuid', models.CharField(default=uuid.uuid4, max_length=64, primary_key=True, serialize=False)),
-                ('engagement_manual_id', models.CharField(db_index=True, default=-1, max_length=36)),
+                ('uuid', models.CharField(
+
+                    default=uuid.uuid4,
+                    max_length=64, primary_key=True, serialize=False)),
+                ('engagement_manual_id', models.CharField(
+                    db_index=True, default=-1, max_length=36)),
                 ('progress', models.IntegerField(default=0)),
-                ('target_completion_date', models.DateField(blank=True, default=engagementmanager.models.get_default_target_completion_date, null=True)),
-                ('engagement_stage', models.CharField(choices=[('Intake', 'Intake'), ('Active', 'Active'), ('Validated', 'Validated'), ('Completed', 'Completed'), ('Archived', 'Archived')], db_index=True, default='Intake', max_length=15)),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='creation time')),
-                ('heat_validated_time', models.DateTimeField(blank=True, null=True, verbose_name='heat validated time')),
-                ('image_scan_time', models.DateTimeField(blank=True, null=True, verbose_name='image scan time')),
-                ('aic_instantiation_time', models.DateTimeField(blank=True, null=True, verbose_name='aic instantiation time')),
-                ('asdc_onboarding_time', models.DateTimeField(blank=True, null=True, verbose_name='asdc onboarding time')),
-                ('started_state_time', models.DateTimeField(blank=True, null=True, verbose_name='started state time')),
-                ('intake_time', models.DateTimeField(blank=True, null=True, verbose_name='intake time')),
-                ('active_time', models.DateTimeField(blank=True, null=True, verbose_name='active time')),
-                ('validated_time', models.DateTimeField(blank=True, null=True, verbose_name='validated time')),
-                ('completed_time', models.DateTimeField(blank=True, null=True, verbose_name='completed time')),
+                ('target_completion_date', models.DateField(
+
+                    blank=True,
+                    default=engagementmanager.models.
+                    get_default_target_completion_date, null=True)),
+                ('engagement_stage', models.CharField(
+                    choices=[('Intake', 'Intake'), ('Active', 'Active'),
+                             ('Validated', 'Validated'), (
+                        'Completed', 'Completed'), ('Archived', 'Archived')],
+                    db_index=True,
+                    default='Intake', max_length=15)),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now,
+                    verbose_name='creation time')),
+                ('heat_validated_time', models.DateTimeField(
+
+                    blank=True, null=True,
+                    verbose_name='heat validated time')),
+                ('image_scan_time', models.DateTimeField(
+
+                    blank=True, null=True,
+                    verbose_name='image scan time')),
+                ('aic_instantiation_time', models.DateTimeField(
+
+                    blank=True, null=True,
+                    verbose_name='aic instantiation time')),
+                ('asdc_onboarding_time', models.DateTimeField(
+
+                    blank=True, null=True,
+                    verbose_name='asdc onboarding time')),
+                ('started_state_time', models.DateTimeField(
+
+                    blank=True, null=True,
+                    verbose_name='started state time')),
+                ('intake_time', models.DateTimeField(
+
+                    blank=True, null=True,
+                    verbose_name='intake time')),
+                ('active_time', models.DateTimeField(
+
+                    blank=True, null=True,
+                    verbose_name='active time')),
+                ('validated_time', models.DateTimeField(
+
+                    blank=True, null=True,
+                    verbose_name='validated time')),
+                ('completed_time', models.DateTimeField(
+
+                    blank=True, null=True,
+                    verbose_name='completed time')),
                 ('archive_reason', models.TextField(default=None, null=True)),
-                ('archived_time', models.DateTimeField(blank=True, null=True, verbose_name='archived time')),
+                ('archived_time', models.DateTimeField(
+
+                    blank=True, null=True,
+                    verbose_name='archived time')),
                 ('is_with_files', models.BooleanField(default=False)),
             ],
             options={
@@ -312,10 +540,15 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='EngagementStatus',
             fields=[
-                ('uuid', models.CharField(default=uuid.uuid4, max_length=64, primary_key=True, serialize=False)),
+                ('uuid', models.CharField(
+
+                    default=uuid.uuid4,
+                    max_length=64, primary_key=True, serialize=False)),
                 ('description', models.CharField(max_length=256)),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now)),
-                ('update_time', models.DateTimeField(default=django.utils.timezone.now)),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now)),
+                ('update_time', models.DateTimeField(
+                    default=django.utils.timezone.now)),
             ],
             options={
                 'db_table': 'ice_engagement_status',
@@ -324,9 +557,15 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='Feedback',
             fields=[
-                ('uuid', models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False, unique=True)),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now)),
-                ('description', models.TextField(verbose_name='feedback_description')),
+                ('uuid', models.CharField(
+
+                    default=uuid.uuid4, max_length=36,
+                    primary_key=True, serialize=False, unique=True)),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now)),
+                ('description', models.TextField(
+
+                    verbose_name='feedback_description')),
             ],
             options={
                 'db_table': 'ice_feedback',
@@ -335,20 +574,41 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='IceUserProfile',
             fields=[
-                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
-                ('uuid', models.CharField(default=uuid.uuid4, max_length=36, unique=True)),
+                ('id', models.AutoField(auto_created=True,
+                                        primary_key=True, serialize=False,
+                                        verbose_name='ID')),
+                ('uuid', models.CharField(
+
+
+                    default=uuid.uuid4, max_length=36, unique=True)),
                 ('phone_number', models.CharField(max_length=30)),
                 ('full_name', models.CharField(max_length=30)),
-                ('email', models.EmailField(db_index=True, max_length=254, unique=True, verbose_name='email')),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='creation time')),
-                ('ssh_public_key', models.CharField(blank=True, max_length=1024, null=True, verbose_name='ssh_public_key')),
+                ('email', models.EmailField(db_index=True,
+                                            max_length=254, unique=True,
+                                            verbose_name='email')),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now,
+                    verbose_name='creation time')),
+                ('ssh_public_key', models.CharField(
+                    blank=True,
+                    max_length=1024, null=True,
+                    verbose_name='ssh_public_key')),
                 ('regular_email_updates', models.BooleanField(default=False)),
-                ('email_updates_on_every_notification', models.BooleanField(default=True)),
-                ('email_updates_daily_digest', models.BooleanField(default=False)),
-                ('is_service_provider_contact', models.BooleanField(default=False)),
-                ('rgwa_access_key', models.CharField(blank=True, max_length=1024, null=True, unique=True)),
-                ('rgwa_secret_key', models.CharField(blank=True, max_length=1024, null=True, unique=True)),
-                ('slack_handle', models.CharField(blank=True, default=None, max_length=64, null=True)),
+                ('email_updates_on_every_notification',
+                 models.BooleanField(default=True)),
+                ('email_updates_daily_digest',
+                 models.BooleanField(default=False)),
+                ('is_service_provider_contact',
+                 models.BooleanField(default=False)),
+                ('rgwa_access_key', models.CharField(
+
+                    blank=True, max_length=1024, null=True, unique=True)),
+                ('rgwa_secret_key', models.CharField(
+
+                    blank=True, max_length=1024, null=True, unique=True)),
+                ('slack_handle', models.CharField(
+
+                    blank=True, default=None, max_length=64, null=True)),
             ],
             options={
                 'db_table': 'ice_user_profile',
@@ -357,13 +617,21 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='Invitation',
             fields=[
-                ('uuid', models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False)),
-                ('engagement_uuid', models.CharField(db_index=True, max_length=64)),
-                ('invited_by_user_uuid', models.CharField(db_index=True, max_length=64)),
+                ('uuid', models.CharField(
+
+                    default=uuid.uuid4,
+                    max_length=36, primary_key=True, serialize=False)),
+                ('engagement_uuid', models.CharField(
+                    db_index=True, max_length=64)),
+                ('invited_by_user_uuid', models.CharField(
+                    db_index=True, max_length=64)),
                 ('email', models.CharField(max_length=255)),
-                ('invitation_token', models.CharField(db_index=True, max_length=1024)),
+                ('invitation_token', models.CharField(
+                    db_index=True, max_length=1024)),
                 ('accepted', models.BooleanField(default=False)),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='invitation creation time')),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now,
+                    verbose_name='invitation creation time')),
             ],
             options={
                 'db_table': 'ice_invitation',
@@ -372,22 +640,60 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='NextStep',
             fields=[
-                ('uuid', models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False)),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='creation time')),
-                ('last_update_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='last update time')),
-                ('last_update_type', models.CharField(default='Added', max_length=15)),
+                ('uuid', models.CharField(
+
+                    default=uuid.uuid4,
+                    max_length=36, primary_key=True, serialize=False)),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now,
+                    verbose_name='creation time')),
+                ('last_update_time', models.DateTimeField(
+                    default=django.utils.timezone.now,
+                    verbose_name='last update time')),
+                ('last_update_type', models.CharField(
+                    default='Added', max_length=15)),
                 ('position', models.IntegerField()),
                 ('description', models.TextField()),
-                ('state', models.CharField(choices=[('Incomplete', 'Incomplete'), ('Completed', 'Completed')], max_length=15)),
+                ('state', models.CharField(
+                    choices=[
+                        ('Incomplete', 'Incomplete'),
+                        ('Completed', 'Completed')], max_length=15)),
                 ('engagement_stage', models.CharField(max_length=15)),
-                ('next_step_type', models.CharField(choices=[('set_ssh', 'set_ssh'), ('trial_agreements', 'trial_agreements'), ('add_contact_person', 'add_contact_person'), ('submit_vf_package', 'submit_vf_package'), ('el_handoff', 'el_handoff'), ('user_defined', 'user_defined')], default='user_defined', max_length=36)),
-                ('files', models.TextField(null=True, verbose_name='list of files')),
-                ('due_date', models.DateField(null=True, verbose_name='due_date')),
-                ('assignees', models.ManyToManyField(related_name='assignees', to='engagementmanager.IceUserProfile')),
-                ('creator', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='NextStep_creator', to='engagementmanager.IceUserProfile')),
-                ('engagement', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.Engagement')),
-                ('last_updater', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='NextStep_last_updater', to='engagementmanager.IceUserProfile')),
-                ('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.IceUserProfile')),
+                ('next_step_type', models.CharField(
+                    choices=[('set_ssh', 'set_ssh'),
+                             ('trial_agreements', 'trial_agreements'),
+                             ('add_contact_person', 'add_contact_person'), (
+                        'submit_vf_package', 'submit_vf_package'),
+                        ('el_handoff', 'el_handoff'),
+                        ('user_defined', 'user_defined')],
+                    default='user_defined',
+                    max_length=36)),
+                ('files', models.TextField(null=True,
+                                           verbose_name='list of files')),
+                ('due_date', models.DateField(null=True,
+                                              verbose_name='due_date')),
+                ('assignees', models.ManyToManyField(
+                    related_name='assignees',
+                    to='engagementmanager.IceUserProfile')),
+                ('creator', models.ForeignKey(
+                    on_delete=django.db.models.deletion.PROTECT,
+                    related_name='NextStep_creator',
+                    to='engagementmanager.IceUserProfile')),
+                ('engagement', models.ForeignKey(
+                    blank=True, null=True,
+
+                    on_delete=django.db.models.deletion.PROTECT,
+                    to='engagementmanager.Engagement')),
+                ('last_updater', models.ForeignKey(
+                    null=True,
+                    on_delete=django.db.models.deletion.PROTECT,
+                    related_name='NextStep_last_updater',
+                    to='engagementmanager.IceUserProfile')),
+                ('owner', models.ForeignKey(
+                    blank=True, null=True,
+
+                    on_delete=django.db.models.deletion.PROTECT,
+                    to='engagementmanager.IceUserProfile')),
             ],
             options={
                 'verbose_name_plural': 'Next steps',
@@ -397,11 +703,20 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='Notification',
             fields=[
-                ('uuid', models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False, unique=True)),
+                ('uuid', models.CharField(
+
+                    default=uuid.uuid4, max_length=36,
+                    primary_key=True, serialize=False, unique=True)),
                 ('is_sent', models.BooleanField(default=False)),
                 ('is_read', models.BooleanField(default=False)),
-                ('activity', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.Activity')),
-                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.IceUserProfile')),
+                ('activity', models.ForeignKey(
+                    null=True,
+                    on_delete=django.db.models.deletion.CASCADE,
+                    to='engagementmanager.Activity')),
+                ('user', models.ForeignKey(
+
+                    on_delete=django.db.models.deletion.CASCADE,
+                    to='engagementmanager.IceUserProfile')),
             ],
             options={
                 'db_table': 'ice_notification',
@@ -410,10 +725,23 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='RecentEngagement',
             fields=[
-                ('uuid', models.CharField(default=uuid.uuid4, max_length=64, primary_key=True, serialize=False)),
+                ('uuid', models.CharField(
+
+                    default=uuid.uuid4,
+                    max_length=64, primary_key=True, serialize=False)),
                 ('user_uuid', models.CharField(max_length=64)),
-                ('action_type', models.CharField(choices=[('JOINED_TO_ENGAGEMENT', 'JOINED_TO_ENGAGEMENT'), ('NEXT_STEP_ASSIGNED', 'NEXT_STEP_ASSIGNED'), ('GOT_OWNERSHIP_OVER_ENGAGEMENT', 'GOT_OWNERSHIP_OVER_ENGAGEMENT'), ('NAVIGATED_INTO_ENGAGEMENT', 'NAVIGATED_INTO_ENGAGEMENT'), ('NEW_VF_CREATED', 'NEW_VF_CREATED')], max_length=36)),
-                ('last_update', models.DateTimeField(default=django.utils.timezone.now, verbose_name='update time')),
+                ('action_type', models.CharField(
+                    choices=[('JOINED_TO_ENGAGEMENT', 'JOINED_TO_ENGAGEMENT'),
+                             ('NEXT_STEP_ASSIGNED', 'NEXT_STEP_ASSIGNED'), (
+                        'GOT_OWNERSHIP_OVER_ENGAGEMENT',
+                        'GOT_OWNERSHIP_OVER_ENGAGEMENT'),
+                        ('NAVIGATED_INTO_ENGAGEMENT',
+                         'NAVIGATED_INTO_ENGAGEMENT'),
+                        ('NEW_VF_CREATED', 'NEW_VF_CREATED')],
+                    max_length=36)),
+                ('last_update', models.DateTimeField(
+                    default=django.utils.timezone.now,
+                    verbose_name='update time')),
             ],
             options={
                 'db_table': 'ice_recent_engagement',
@@ -422,8 +750,13 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='Role',
             fields=[
-                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
-                ('uuid', models.CharField(default=uuid.uuid4, max_length=36, unique=True)),
+                ('id', models.AutoField(auto_created=True,
+                                        primary_key=True, serialize=False,
+                                        verbose_name='ID')),
+                ('uuid', models.CharField(
+
+
+                    default=uuid.uuid4, max_length=36, unique=True)),
                 ('name', models.CharField(max_length=36, unique=True)),
             ],
             options={
@@ -433,8 +766,13 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='Vendor',
             fields=[
-                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
-                ('uuid', models.CharField(default=uuid.uuid4, max_length=36, unique=True)),
+                ('id', models.AutoField(auto_created=True,
+                                        primary_key=True, serialize=False,
+                                        verbose_name='ID')),
+                ('uuid', models.CharField(
+
+
+                    default=uuid.uuid4, max_length=36, unique=True)),
                 ('name', models.CharField(max_length=100, unique=True)),
                 ('public', models.BooleanField()),
             ],
@@ -446,16 +784,40 @@ class Migration(migrations.Migration):
             name='VF',
             fields=[
                 ('name', models.CharField(db_index=True, max_length=100)),
-                ('version', models.CharField(db_index=True, max_length=100, null=True)),
-                ('uuid', models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False, unique=True)),
-                ('is_service_provider_internal', models.BooleanField(default=False)),
-                ('git_repo_url', models.CharField(default=-1, max_length=512)),
-                ('target_lab_entry_date', models.DateField(verbose_name='target_lab_entry_date')),
-                ('deployment_target', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='engagementmanager.DeploymentTarget')),
-                ('deployment_target_sites', models.ManyToManyField(blank=True, default=None, related_name='DeployTarget_sites', to='engagementmanager.DeploymentTargetSite')),
-                ('ecomp_release', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.ECOMPRelease')),
-                ('engagement', models.OneToOneField(default=-1, on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.Engagement')),
-                ('vendor', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.Vendor')),
+                ('version', models.CharField(
+                    db_index=True, max_length=100, null=True)),
+                ('uuid', models.CharField(
+
+                    default=uuid.uuid4, max_length=36,
+                    primary_key=True, serialize=False, unique=True)),
+                ('is_service_provider_internal',
+                 models.BooleanField(default=False)),
+                ('git_repo_url', models.CharField(default=-1,
+                                                  max_length=512)),
+                ('target_lab_entry_date', models.DateField(
+
+                    verbose_name='target_lab_entry_date')),
+                ('deployment_target', models.ForeignKey(
+                    blank=True, null=True,
+
+                    on_delete=django.db.models.deletion.SET_NULL,
+                    to='engagementmanager.DeploymentTarget')),
+                ('deployment_target_sites', models.ManyToManyField(
+                    blank=True, default=None,
+                    related_name='DeployTarget_sites',
+                    to='engagementmanager.DeploymentTargetSite')),
+                ('ecomp_release', models.ForeignKey(
+                    null=True,
+                    on_delete=django.db.models.deletion.CASCADE,
+                    to='engagementmanager.ECOMPRelease')),
+                ('engagement', models.OneToOneField(
+                    default=-1,
+                    on_delete=django.db.models.deletion.CASCADE,
+                    to='engagementmanager.Engagement')),
+                ('vendor', models.ForeignKey(
+
+                    on_delete=django.db.models.deletion.PROTECT,
+                    to='engagementmanager.Vendor')),
             ],
             options={
                 'db_table': 'ice_vf',
@@ -464,14 +826,31 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='VFC',
             fields=[
-                ('uuid', models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False, unique=True)),
+                ('uuid', models.CharField(
+
+                    default=uuid.uuid4, max_length=36,
+                    primary_key=True, serialize=False, unique=True)),
                 ('name', models.CharField(db_index=True, max_length=100)),
-                ('external_ref_id', models.CharField(default='', max_length=20)),
+                ('external_ref_id', models.CharField(default='',
+                                                     max_length=20)),
                 ('ice_mandated', models.BooleanField(default=False)),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='creation time')),
-                ('company', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='engagementmanager.Vendor')),
-                ('creator', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='Vfc_creator', to='engagementmanager.IceUserProfile')),
-                ('vf', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.VF')),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now,
+
+                    verbose_name='creation time')),
+                ('company', models.ForeignKey(
+                    null=True,
+                    on_delete=django.db.models.deletion.SET_NULL,
+                    to='engagementmanager.Vendor')),
+                ('creator', models.ForeignKey(
+                    blank=True, null=True,
+                    on_delete=django.db.models.deletion.PROTECT,
+                    related_name='Vfc_creator',
+                    to='engagementmanager.IceUserProfile')),
+                ('vf', models.ForeignKey(
+
+                    on_delete=django.db.models.deletion.PROTECT,
+                    to='engagementmanager.VF')),
             ],
             options={
                 'db_table': 'ice_vfc',
@@ -480,7 +859,10 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='recentengagement',
             name='vf',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.VF'),
+            field=models.ForeignKey(
+
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.VF'),
         ),
         migrations.AlterUniqueTogether(
             name='invitation',
@@ -489,62 +871,102 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='iceuserprofile',
             name='company',
-            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.Vendor'),
+            field=models.ForeignKey(
+                null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                to='engagementmanager.Vendor'),
         ),
         migrations.AddField(
             model_name='iceuserprofile',
             name='role',
-            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.Role'),
+            field=models.ForeignKey(
+                null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                to='engagementmanager.Role'),
         ),
         migrations.AddField(
             model_name='iceuserprofile',
             name='user',
-            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.CustomUser'),
+            field=models.OneToOneField(
+
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.CustomUser'),
         ),
         migrations.AddField(
             model_name='feedback',
             name='user',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.IceUserProfile'),
+            field=models.ForeignKey(
+
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AddField(
             model_name='engagementstatus',
             name='creator',
-            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='status_creator', to='engagementmanager.IceUserProfile'),
+            field=models.ForeignKey(
+                blank=True, null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                related_name='status_creator',
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AddField(
             model_name='engagementstatus',
             name='engagement',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.Engagement'),
+            field=models.ForeignKey(
+
+                on_delete=django.db.models.deletion.PROTECT,
+                to='engagementmanager.Engagement'),
         ),
         migrations.AddField(
             model_name='engagement',
             name='contact_user',
-            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='Engagement_contact_user', to='engagementmanager.IceUserProfile'),
+            field=models.ForeignKey(
+                blank=True, null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                related_name='Engagement_contact_user',
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AddField(
             model_name='engagement',
             name='creator',
-            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='Engagement_creator', to='engagementmanager.IceUserProfile'),
+            field=models.ForeignKey(
+                blank=True, null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                related_name='Engagement_creator',
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AddField(
             model_name='engagement',
             name='engagement_team',
-            field=models.ManyToManyField(related_name='members', to='engagementmanager.IceUserProfile'),
+            field=models.ManyToManyField(
+                related_name='members',
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AddField(
             model_name='engagement',
             name='peer_reviewer',
-            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='Engagement_peer_reviewer', to='engagementmanager.IceUserProfile'),
+            field=models.ForeignKey(
+                blank=True, null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                related_name='Engagement_peer_reviewer',
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AddField(
             model_name='engagement',
             name='reviewer',
-            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='Engagement_el_reviewer', to='engagementmanager.IceUserProfile'),
+            field=models.ForeignKey(
+                blank=True, null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                related_name='Engagement_el_reviewer',
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AddField(
             model_name='engagement',
             name='starred_engagement',
-            field=models.ManyToManyField(blank=True, default=None, to='engagementmanager.IceUserProfile'),
+            field=models.ManyToManyField(
+
+                blank=True, default=None,
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AlterUniqueTogether(
             name='deploymenttarget',
@@ -553,57 +975,93 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='checklistsection',
             name='template',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.ChecklistTemplate'),
+            field=models.ForeignKey(
+
+                on_delete=django.db.models.deletion.PROTECT,
+                to='engagementmanager.ChecklistTemplate'),
         ),
         migrations.AddField(
             model_name='checklistlineitem',
             name='section',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.ChecklistSection'),
+            field=models.ForeignKey(
+
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.ChecklistSection'),
         ),
         migrations.AddField(
             model_name='checklistlineitem',
             name='template',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.ChecklistTemplate'),
+            field=models.ForeignKey(
+
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.ChecklistTemplate'),
         ),
         migrations.AddField(
             model_name='checklistdecision',
             name='lineitem',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.ChecklistLineItem'),
+            field=models.ForeignKey(
+
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.ChecklistLineItem'),
         ),
         migrations.AddField(
             model_name='checklistdecision',
             name='template',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.ChecklistTemplate'),
+            field=models.ForeignKey(
+
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.ChecklistTemplate'),
         ),
         migrations.AddField(
             model_name='checklistauditlog',
             name='creator',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.IceUserProfile'),
+            field=models.ForeignKey(
+
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AddField(
             model_name='checklistauditlog',
             name='decision',
-            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.ChecklistDecision'),
+            field=models.ForeignKey(
+
+                blank=True, null=True,
+
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.ChecklistDecision'),
         ),
         migrations.AddField(
             model_name='checklist',
             name='creator',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='checklist_creator', to='engagementmanager.IceUserProfile'),
+            field=models.ForeignKey(
+
+                on_delete=django.db.models.deletion.CASCADE,
+                related_name='checklist_creator',
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AddField(
             model_name='checklist',
             name='engagement',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.Engagement'),
+            field=models.ForeignKey(
+
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.Engagement'),
         ),
         migrations.AddField(
             model_name='checklist',
             name='owner',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='checklist_owner', to='engagementmanager.IceUserProfile'),
+            field=models.ForeignKey(
+                on_delete=django.db.models.deletion.CASCADE,
+                related_name='checklist_owner',
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AddField(
             model_name='checklist',
             name='template',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.ChecklistTemplate'),
+            field=models.ForeignKey(
+
+                on_delete=django.db.models.deletion.PROTECT,
+                to='engagementmanager.ChecklistTemplate'),
         ),
         migrations.AlterUniqueTogether(
             name='applicationserviceinfrastructure',
@@ -612,12 +1070,18 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='activity',
             name='activity_owner',
-            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.IceUserProfile'),
+            field=models.ForeignKey(
+                blank=True, null=True,
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AddField(
             model_name='activity',
             name='engagement',
-            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.Engagement'),
+            field=models.ForeignKey(
+                null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                to='engagementmanager.Engagement'),
         ),
         migrations.AlterIndexTogether(
             name='notification',
index 682394a..a32c2d2 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -85,24 +85,34 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='engagement',
             name='create_time',
-            field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='creation time'),
+            field=models.DateTimeField(
+                default=django.utils.timezone.now,
+                verbose_name='creation time'),
         ),
         migrations.AddField(
             model_name='engagement',
             name='creator',
-            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT,
-                                    related_name='Engagement_creator', to='engagementmanager.IceUser'),
+            field=models.ForeignKey(
+                blank=True, null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                related_name='Engagement_creator',
+                to='engagementmanager.IceUser'),
         ),
         migrations.AddField(
             model_name='vfc',
             name='create_time',
-            field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='creation time'),
+            field=models.DateTimeField(
+                default=django.utils.timezone.now,
+                verbose_name='creation time'),
         ),
         migrations.AddField(
             model_name='vfc',
             name='creator',
-            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT,
-                                    related_name='Vfc_creator', to='engagementmanager.IceUser'),
+            field=models.ForeignKey(
+                blank=True, null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                related_name='Vfc_creator',
+                to='engagementmanager.IceUser'),
         ),
         migrations.AddField(
             model_name='vfc',
@@ -117,20 +127,29 @@ class Migration(migrations.Migration):
         migrations.AlterField(
             model_name='activity',
             name='activity_owner',
-            field=models.ForeignKey(blank=True, null=True,
-                                    on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.IceUser'),
+            field=models.ForeignKey(
+                blank=True, null=True,
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.IceUser'),
         ),
         migrations.AlterField(
             model_name='activity',
             name='activity_type',
-            field=models.CharField(choices=[(b'3', b'eng_validation_request'), (b'4', b'next_steps'),
-                                            (b'2', b'ssh_key_added'), (b'1', b'user_joined_eng'), (b'5', b'vfc')], max_length=36),
+            field=models.CharField(
+                choices=[(b'3', b'eng_validation_request'),
+                         (b'4', b'next_steps'),
+                         (b'2', b'ssh_key_added'),
+                         (b'1', b'user_joined_eng'),
+                         (b'5', b'vfc')], max_length=36),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='contact_user',
-            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT,
-                                    related_name='Engagement_contact_user', to='engagementmanager.IceUser'),
+            field=models.ForeignKey(
+                blank=True, null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                related_name='Engagement_contact_user',
+                to='engagementmanager.IceUser'),
         ),
         migrations.AlterField(
             model_name='engagement',
@@ -146,7 +165,9 @@ class Migration(migrations.Migration):
         migrations.AlterField(
             model_name='vfc',
             name='uuid',
-            field=models.CharField(max_length=36, primary_key=True, serialize=False, unique=True),
+            field=models.CharField(
+                max_length=36, primary_key=True,
+                serialize=False, unique=True),
         ),
         migrations.AlterUniqueTogether(
             name='vfc',
index 3bc94a0..39cc9cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -56,30 +56,61 @@ class Migration(migrations.Migration):
     operations = [
         migrations.AlterModelOptions(
             name='nextstep',
-            options={'verbose_name_plural': 'Next steps'},
+            options={
+                'verbose_name_plural': 'Next steps'},
         ),
         migrations.AddField(
             model_name='nextstep',
             name='next_step_type',
-            field=models.CharField(choices=[(b'(3,)', b'add_contact_person'), (b'(5,)', b'el_handoff'), (b'(1,)', b'set_ssh'), (
-                b'(4,)', b'submit_vf_package'), (b'(2,)', b'trial_agreements'), (b'6', b'user_defined')], default=b'user_defined', max_length=36),
+            field=models.CharField(
+                choices=[
+                    (b'(3,)',
+                     b'add_contact_person'),
+                    (b'(5,)',
+                     b'el_handoff'),
+                    (b'(1,)',
+                     b'set_ssh'),
+                    (b'(4,)',
+                     b'submit_vf_package'),
+                    (b'(2,)',
+                     b'trial_agreements'),
+                    (b'6',
+                     b'user_defined')],
+                default=b'user_defined',
+                max_length=36),
         ),
         migrations.AddField(
             model_name='nextstep',
             name='owner',
-            field=models.ForeignKey(blank=True, null=True,
-                                    on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.IceUser'),
+            field=models.ForeignKey(
+                blank=True,
+                null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                to='engagementmanager.IceUser'),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='target_completion_date',
-            field=models.DateField(blank=True, default=datetime.datetime(
-                2016, 7, 29, 9, 29, 32, 642800, tzinfo=utc), null=True),
+            field=models.DateField(
+                blank=True,
+                default=datetime.datetime(
+                    2016,
+                    7,
+                    29,
+                    9,
+                    29,
+                    32,
+                    642800,
+                    tzinfo=utc),
+                null=True),
         ),
         migrations.AlterField(
             model_name='nextstep',
             name='engagement',
-            field=models.ForeignKey(blank=True, null=True,
-                                    on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.Engagement'),
+            field=models.ForeignKey(
+                blank=True,
+                null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                to='engagementmanager.Engagement'),
         ),
     ]
index cfc04d3..452770f 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -57,12 +57,27 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='iceuser',
             name='temp_password',
-            field=models.CharField(blank=True, default=None, max_length=256, null=True, unique=True),
+            field=models.CharField(
+                blank=True,
+                default=None,
+                max_length=256,
+                null=True,
+                unique=True),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='target_completion_date',
-            field=models.DateField(blank=True, default=datetime.datetime(
-                2016, 8, 5, 18, 43, 43, 473000, tzinfo=utc), null=True),
+            field=models.DateField(
+                blank=True,
+                default=datetime.datetime(
+                    2016,
+                    8,
+                    5,
+                    18,
+                    43,
+                    43,
+                    473000,
+                    tzinfo=utc),
+                null=True),
         ),
     ]
index decbe51..35b4878 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -56,7 +56,8 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='DeploymentTargetSite',
             fields=[
-                ('uuid', models.CharField(max_length=36, primary_key=True, serialize=False)),
+                ('uuid', models.CharField(max_length=36,
+                                          primary_key=True, serialize=False)),
                 ('name', models.CharField(max_length=45)),
             ],
             options={
@@ -72,24 +73,30 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='vfc',
             name='company',
-            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL,
-                                    to='engagementmanager.Vendor'),
+            field=models.ForeignKey(
+                null=True, on_delete=django.db.models.deletion.SET_NULL,
+                to='engagementmanager.Vendor'),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='target_completion_date',
             field=models.DateField(
-                blank=True, default=engagementmanager.models.get_default_target_completion_date, null=True),
+                blank=True,
+                default=engagementmanager.models.
+                get_default_target_completion_date, null=True),
         ),
         migrations.AlterField(
             model_name='iceuser',
             name='temp_password',
-            field=models.CharField(blank=True, default=None, max_length=256, null=True),
+            field=models.CharField(
+                blank=True, default=None, max_length=256, null=True),
         ),
         migrations.AddField(
             model_name='vf',
             name='deployment_target_sites',
-            field=models.ManyToManyField(blank=True, default=None, related_name='DeployTarget_sites',
-                                         to='engagementmanager.DeploymentTargetSite'),
+            field=models.ManyToManyField(
+                blank=True, default=None,
+                related_name='DeployTarget_sites',
+                to='engagementmanager.DeploymentTargetSite'),
         ),
     ]
index 285631d..d361a3d 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -55,17 +55,38 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='Checklist',
             fields=[
-                ('uuid', models.CharField(max_length=36, primary_key=True, serialize=False)),
-                ('name', models.CharField(max_length=255, verbose_name='checklist name')),
-                ('state', models.CharField(choices=[(b'(4,)', b'approval'), (b'(7,)', b'archive'), (b'(1,)', b'automation'), (b'(6,)', b'closed'), (
-                    b'(5,)', b'handoff'), (b'(3,)', b'peer_review'), (b'8', b'pending'), (b'(2,)', b'review')], default=b'automation', max_length=36)),
-                ('validation_cycle', models.IntegerField(verbose_name='validation cycle')),
-                ('weight', models.FloatField(default=0, verbose_name='checklist weight')),
-                ('associated_files', models.TextField(verbose_name='list of files from gitlab')),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='creation time')),
-                ('update_time', models.DateTimeField(blank=True, null=True, verbose_name='last update time')),
-                ('creator', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
-                                              related_name='checklist_creator', to='engagementmanager.IceUser')),
+                ('uuid', models.CharField(max_length=36,
+                                          primary_key=True, serialize=False)),
+                ('name', models.CharField(
+                    max_length=255,
+                    verbose_name='checklist name')),
+                ('state', models.CharField(
+                    choices=[(b'(4,)', b'approval'),
+                             (b'(7,)', b'archive'),
+                             (b'(1,)', b'automation'), (b'(6,)', b'closed'), (
+                        b'(5,)', b'handoff'), (b'(3,)', b'peer_review'),
+                        (b'8', b'pending'), (b'(2,)', b'review')],
+                    default=b'automation', max_length=36)),
+                ('validation_cycle', models.IntegerField(
+
+                    verbose_name='validation cycle')),
+                ('weight', models.FloatField(
+                    default=0,
+                    verbose_name='checklist weight')),
+                ('associated_files', models.TextField(
+
+                    verbose_name='list of files from gitlab')),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now,
+                    verbose_name='creation time')),
+                ('update_time', models.DateTimeField(
+                    blank=True,
+                    null=True,
+                    verbose_name='last update time')),
+                ('creator', models.ForeignKey(
+                    on_delete=django.db.models.deletion.CASCADE,
+                    related_name='checklist_creator',
+                    to='engagementmanager.IceUser')),
             ],
             options={
                 'db_table': 'ice_checklist',
@@ -74,15 +95,25 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='ChecklistAuditLog',
             fields=[
-                ('uuid', models.CharField(max_length=36, primary_key=True, serialize=False)),
+                ('uuid', models.CharField(max_length=36,
+                                          primary_key=True, serialize=False)),
                 ('category', models.CharField(max_length=255)),
                 ('description', models.TextField()),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='creation time')),
-                ('update_time', models.DateTimeField(blank=True, null=True, verbose_name='last update time')),
-                ('checklist', models.ForeignKey(blank=True, null=True,
-                                                on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.Checklist')),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now,
+                    verbose_name='creation time')),
+                ('update_time', models.DateTimeField(
+                    blank=True,
+                    null=True,
+                    verbose_name='last update time')),
+                ('checklist', models.ForeignKey(
+                    blank=True, null=True,
+                    on_delete=django.db.models.deletion.CASCADE,
+                    to='engagementmanager.Checklist')),
                 ('creator', models.ForeignKey(
-                    on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.IceUser')),
+
+                    on_delete=django.db.models.deletion.CASCADE,
+                    to='engagementmanager.IceUser')),
             ],
             options={
                 'db_table': 'ice_checklist_audit_log',
@@ -91,15 +122,25 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='ChecklistDecision',
             fields=[
-                ('uuid', models.CharField(max_length=36, primary_key=True, serialize=False)),
+                ('uuid', models.CharField(max_length=36,
+                                          primary_key=True, serialize=False)),
                 ('review_value', models.CharField(choices=[
-                 (b'(1,)', b'approved'), (b'(2,)', b'denied'), (b'4', b'na'), (b'(3,)', b'not_relevant')], max_length=36)),
+                 (b'(1,)', b'approved'), (b'(2,)', b'denied'), (b'4', b'na'),
+                 (b'(3,)', b'not_relevant')], max_length=36)),
                 ('peer_review_value', models.CharField(choices=[
-                 (b'(1,)', b'approved'), (b'(2,)', b'denied'), (b'4', b'na'), (b'(3,)', b'not_relevant')], max_length=36)),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='creation time')),
-                ('update_time', models.DateTimeField(blank=True, null=True, verbose_name='last update time')),
+                 (b'(1,)', b'approved'), (b'(2,)', b'denied'), (b'4', b'na'),
+                 (b'(3,)', b'not_relevant')], max_length=36)),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now,
+                    verbose_name='creation time')),
+                ('update_time', models.DateTimeField(
+                    blank=True,
+                    null=True,
+                    verbose_name='last update time')),
                 ('checklist', models.ForeignKey(
-                    on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.Checklist')),
+
+                    on_delete=django.db.models.deletion.CASCADE,
+                    to='engagementmanager.Checklist')),
             ],
             options={
                 'db_table': 'ice_checklist_decision',
@@ -108,15 +149,27 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='ChecklistLineItem',
             fields=[
-                ('uuid', models.CharField(max_length=36, primary_key=True, serialize=False)),
-                ('name', models.CharField(max_length=255, verbose_name='line name')),
+                ('uuid', models.CharField(max_length=36,
+                                          primary_key=True, serialize=False)),
+                ('name', models.CharField(max_length=255,
+                                          verbose_name='line name')),
                 ('weight', models.FloatField(verbose_name='line weight')),
-                ('description', models.TextField(verbose_name='line description')),
-                ('line_type', models.CharField(choices=[(b'(1,)', b'auto'),
-                                                        (b'2', b'manual')], default=b'auto', max_length=36)),
-                ('validation_instructions', models.TextField(verbose_name='line validation instructions')),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='creation time')),
-                ('update_time', models.DateTimeField(blank=True, null=True, verbose_name='last update time')),
+                ('description', models.TextField(
+                    verbose_name='line description')),
+                ('line_type', models.CharField(
+                    choices=[(b'(1,)', b'auto'),
+                             (b'2', b'manual')],
+                    default=b'auto', max_length=36)),
+                ('validation_instructions', models.TextField(
+
+                    verbose_name='line validation instructions')),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now,
+                    verbose_name='creation time')),
+                ('update_time', models.DateTimeField(
+                    blank=True,
+                    null=True,
+                    verbose_name='last update time')),
             ],
             options={
                 'db_table': 'ice_checklist_line_item',
@@ -125,15 +178,28 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='ChecklistSection',
             fields=[
-                ('uuid', models.CharField(max_length=36, primary_key=True, serialize=False)),
-                ('name', models.CharField(max_length=255, verbose_name='section name')),
+                ('uuid', models.CharField(max_length=36,
+                                          primary_key=True, serialize=False)),
+                ('name', models.CharField(max_length=255,
+                                          verbose_name='section name')),
                 ('weight', models.FloatField(verbose_name='checklist weight')),
-                ('description', models.TextField(verbose_name='section description')),
-                ('validation_instructions', models.TextField(verbose_name='section validation instructions')),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='creation time')),
-                ('update_time', models.DateTimeField(blank=True, null=True, verbose_name='last update time')),
-                ('parent_section', models.ForeignKey(blank=True, null=True,
-                                                     on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.ChecklistSection')),
+                ('description', models.TextField(
+
+                    verbose_name='section description')),
+                ('validation_instructions', models.TextField(
+
+                    verbose_name='section validation instructions')),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now,
+                    verbose_name='creation time')),
+                ('update_time', models.DateTimeField(
+                    blank=True,
+                    null=True,
+                    verbose_name='last update time')),
+                ('parent_section',
+                 models.ForeignKey(blank=True, null=True,
+                                   on_delete=django.db.models.deletion.CASCADE,
+                                   to='engagementmanager.ChecklistSection')),
             ],
             options={
                 'db_table': 'ice_checklist_section',
@@ -142,13 +208,24 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='ChecklistTemplate',
             fields=[
-                ('uuid', models.CharField(max_length=36, primary_key=True, serialize=False)),
-                ('name', models.CharField(max_length=255, verbose_name='template name')),
-                ('category', models.CharField(choices=[
-                 (b'3', b'glance'), (b'(2,)', b'heat'), (b'(1,)', b'overall')], default=b'overall', max_length=36)),
-                ('version', models.IntegerField(verbose_name='template version')),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='creation time')),
-                ('update_time', models.DateTimeField(blank=True, null=True, verbose_name='last update time')),
+                ('uuid', models.CharField(max_length=36,
+                                          primary_key=True, serialize=False)),
+                ('name', models.CharField(max_length=255,
+                                          verbose_name='template name')),
+                ('category', models.CharField(
+                    choices=[
+                        (b'3', b'glance'), (b'(2,)', b'heat'),
+                        (b'(1,)', b'overall')],
+                    default=b'overall', max_length=36)),
+                ('version', models.IntegerField(
+                    verbose_name='template version')),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now,
+                    verbose_name='creation time')),
+                ('update_time', models.DateTimeField(
+                    blank=True,
+                    null=True,
+                    verbose_name='last update time')),
             ],
             options={
                 'db_table': 'ice_checklist_template',
@@ -157,81 +234,103 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='engagement',
             name='peer_reviewer',
-            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT,
-                                    related_name='Engagement_peer_reviewer', to='engagementmanager.IceUser'),
+            field=models.ForeignKey(
+                blank=True, null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                related_name='Engagement_peer_reviewer',
+                to='engagementmanager.IceUser'),
         ),
         migrations.AddField(
             model_name='nextstep',
             name='assignees',
-            field=models.ManyToManyField(related_name='assignees', to='engagementmanager.IceUser'),
+            field=models.ManyToManyField(
+                related_name='assignees', to='engagementmanager.IceUser'),
         ),
         migrations.AddField(
             model_name='nextstep',
             name='due_date',
-            field=models.DateField(null=True, verbose_name='due_date'),
+            field=models.DateField(null=True,
+                                   verbose_name='due_date'),
         ),
         migrations.AddField(
             model_name='nextstep',
             name='files',
-            field=models.TextField(null=True, verbose_name='list of files'),
+            field=models.TextField(null=True,
+                                   verbose_name='list of files'),
         ),
         migrations.AlterField(
             model_name='activity',
             name='activity_type',
-            field=models.CharField(choices=[(b'6', b'change_checklist_state'), (b'3', b'eng_validation_request'), (
-                b'4', b'next_steps'), (b'2', b'ssh_key_added'), (b'1', b'user_joined_eng'), (b'5', b'vfc')], max_length=36),
+            field=models.CharField(
+                choices=[(b'6', b'change_checklist_state'),
+                         (b'3', b'eng_validation_request'), (
+                    b'4', b'next_steps'), (b'2', b'ssh_key_added'),
+                    (b'1', b'user_joined_eng'), (b'5', b'vfc')],
+                max_length=36),
         ),
         migrations.AddField(
             model_name='checklistsection',
             name='template',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
-                                    to='engagementmanager.ChecklistTemplate'),
+            field=models.ForeignKey(
+                on_delete=django.db.models.deletion.PROTECT,
+                to='engagementmanager.ChecklistTemplate'),
         ),
         migrations.AddField(
             model_name='checklistlineitem',
             name='section',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
-                                    to='engagementmanager.ChecklistSection'),
+            field=models.ForeignKey(
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.ChecklistSection'),
         ),
         migrations.AddField(
             model_name='checklistlineitem',
             name='template',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
-                                    to='engagementmanager.ChecklistTemplate'),
+            field=models.ForeignKey(
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.ChecklistTemplate'),
         ),
         migrations.AddField(
             model_name='checklistdecision',
             name='lineitem',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
-                                    to='engagementmanager.ChecklistLineItem'),
+            field=models.ForeignKey(
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.ChecklistLineItem'),
         ),
         migrations.AddField(
             model_name='checklistdecision',
             name='template',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
-                                    to='engagementmanager.ChecklistTemplate'),
+            field=models.ForeignKey(
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.ChecklistTemplate'),
         ),
         migrations.AddField(
             model_name='checklistauditlog',
             name='decision',
-            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE,
-                                    to='engagementmanager.ChecklistDecision'),
+            field=models.ForeignKey(
+                blank=True, null=True,
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.ChecklistDecision'),
         ),
         migrations.AddField(
             model_name='checklist',
             name='engagement',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.Engagement'),
+            field=models.ForeignKey(
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.Engagement'),
         ),
         migrations.AddField(
             model_name='checklist',
             name='owner',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
-                                    related_name='checklist_owner', to='engagementmanager.IceUser'),
+            field=models.ForeignKey(
+                on_delete=django.db.models.deletion.CASCADE,
+                related_name='checklist_owner',
+                to='engagementmanager.IceUser'),
         ),
         migrations.AddField(
             model_name='checklist',
             name='template',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
-                                    to='engagementmanager.ChecklistTemplate'),
+            field=models.ForeignKey(
+                on_delete=django.db.models.deletion.PROTECT,
+                to='engagementmanager.ChecklistTemplate'),
         ),
     ]
index 655f30d..2224a49 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -54,8 +54,14 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='ECOMPRelease',
             fields=[
-                ('uuid', models.CharField(max_length=36, primary_key=True, serialize=False)),
-                ('name', models.CharField(max_length=45)),
+                ('uuid',
+                 models.CharField(
+                     max_length=36,
+                     primary_key=True,
+                     serialize=False)),
+                ('name',
+                 models.CharField(
+                     max_length=45)),
             ],
             options={
                 'db_table': 'ice_ecomp_release',
@@ -64,7 +70,10 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='vf',
             name='ecomp_release',
-            field=models.ForeignKey(blank=True, null=True,
-                                    on_delete=django.db.models.deletion.SET_NULL, to='engagementmanager.ECOMPRelease'),
+            field=models.ForeignKey(
+                blank=True,
+                null=True,
+                on_delete=django.db.models.deletion.SET_NULL,
+                to='engagementmanager.ECOMPRelease'),
         ),
     ]
index ce6ddcc..75af591 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -55,12 +55,34 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='RecentEngagement',
             fields=[
-                ('uuid', models.CharField(max_length=64, primary_key=True, serialize=False)),
-                ('user_uuid', models.CharField(max_length=64)),
-                ('action_type', models.CharField(choices=[(b'(3,)', b'GOT_OWNERSHIP_OVER_ENGAGEMENT'), (b'(1,)', b'JOINED_TO_ENGAGEMENT'), (
-                    b'(4,)', b'NAVIGATED_INTO_ENGAGEMENT'), (b'(2,)', b'NEXT_STEP_ASSIGNED')], max_length=36)),
-                ('last_update', models.DateTimeField(default=django.utils.timezone.now, verbose_name='update time')),
-                ('vf', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.VF')),
+                ('uuid',
+                 models.CharField(
+                     max_length=64,
+                     primary_key=True,
+                     serialize=False)),
+                ('user_uuid',
+                 models.CharField(
+                     max_length=64)),
+                ('action_type',
+                 models.CharField(
+                     choices=[
+                         (b'(3,)',
+                          b'GOT_OWNERSHIP_OVER_ENGAGEMENT'),
+                         (b'(1,)',
+                          b'JOINED_TO_ENGAGEMENT'),
+                         (b'(4,)',
+                          b'NAVIGATED_INTO_ENGAGEMENT'),
+                         (b'(2,)',
+                          b'NEXT_STEP_ASSIGNED')],
+                     max_length=36)),
+                ('last_update',
+                 models.DateTimeField(
+                     default=django.utils.timezone.now,
+                     verbose_name='update time')),
+                ('vf',
+                 models.ForeignKey(
+                     on_delete=django.db.models.deletion.CASCADE,
+                     to='engagementmanager.VF')),
             ],
             options={
                 'db_table': 'ice_recent_engagement',
@@ -69,6 +91,7 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='engagement',
             name='starred_engagement',
-            field=models.ManyToManyField(to='engagementmanager.IceUser'),
+            field=models.ManyToManyField(
+                to='engagementmanager.IceUser'),
         ),
     ]
index 5536536..252d16c 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -53,13 +53,42 @@ class Migration(migrations.Migration):
         migrations.AlterField(
             model_name='checklist',
             name='state',
-            field=models.CharField(choices=[(b'(4,)', b'approval'), (b'(7,)', b'archive'), (b'(1,)', b'automation'), (b'(6,)', b'closed'), (
-                b'(5,)', b'handoff'), (b'(3,)', b'peer_review'), (b'8', b'pending'), (b'(2,)', b'review')], default=b'pending', max_length=36),
+            field=models.CharField(
+                choices=[
+                    (b'(4,)',
+                     b'approval'),
+                    (b'(7,)',
+                     b'archive'),
+                    (b'(1,)',
+                     b'automation'),
+                    (b'(6,)',
+                     b'closed'),
+                    (b'(5,)',
+                     b'handoff'),
+                    (b'(3,)',
+                     b'peer_review'),
+                    (b'8',
+                     b'pending'),
+                    (b'(2,)',
+                     b'review')],
+                default=b'pending',
+                max_length=36),
         ),
         migrations.AlterField(
             model_name='recentengagement',
             name='action_type',
-            field=models.CharField(choices=[(b'(3,)', b'GOT_OWNERSHIP_OVER_ENGAGEMENT'), (b'(1,)', b'JOINED_TO_ENGAGEMENT'), (
-                b'(4,)', b'NAVIGATED_INTO_ENGAGEMENT'), (b'(5,)', b'NEW_VF_CREATED'), (b'(2,)', b'NEXT_STEP_ASSIGNED')], max_length=36),
+            field=models.CharField(
+                choices=[
+                    (b'(3,)',
+                     b'GOT_OWNERSHIP_OVER_ENGAGEMENT'),
+                    (b'(1,)',
+                     b'JOINED_TO_ENGAGEMENT'),
+                    (b'(4,)',
+                     b'NAVIGATED_INTO_ENGAGEMENT'),
+                    (b'(5,)',
+                     b'NEW_VF_CREATED'),
+                    (b'(2,)',
+                     b'NEXT_STEP_ASSIGNED')],
+                max_length=36),
         ),
     ]
index 19f8db6..aa4c78d 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -53,54 +53,88 @@ class Migration(migrations.Migration):
         migrations.AlterField(
             model_name='activity',
             name='activity_type',
-            field=models.CharField(choices=[(b'change_checklist_state', b'change_checklist_state'), (b'eng_validation_request', b'eng_validation_request'), (
-                b'next_steps', b'next_steps'), (b'ssh_key_added', b'ssh_key_added'), (b'user_joined_eng', b'user_joined_eng'), (b'vfc', b'vfc')], max_length=36),
+            field=models.CharField(
+                choices=[(b'change_checklist_state',
+                          b'change_checklist_state'),
+                         (b'eng_validation_request',
+                          b'eng_validation_request'), (
+                    b'next_steps', b'next_steps'),
+                    (b'ssh_key_added', b'ssh_key_added'),
+                    (b'user_joined_eng', b'user_joined_eng'),
+                    (b'vfc', b'vfc')], max_length=36),
         ),
         migrations.AlterField(
             model_name='checklist',
             name='state',
-            field=models.CharField(choices=[(b'approval', b'approval'), (b'archive', b'archive'), (b'automation', b'automation'), (b'closed', b'closed'), (
-                b'handoff', b'handoff'), (b'peer_review', b'peer_review'), (b'pending', b'pending'), (b'review', b'review')], default=b'pending', max_length=36),
+            field=models.CharField(
+                choices=[(b'approval', b'approval'),
+                         (b'archive', b'archive'),
+                         (b'automation', b'automation'),
+                         (b'closed', b'closed'), (
+                    b'handoff', b'handoff'), (b'peer_review', b'peer_review'),
+                    (b'pending', b'pending'), (b'review', b'review')],
+                default=b'pending', max_length=36),
         ),
         migrations.AlterField(
             model_name='checklistdecision',
             name='peer_review_value',
-            field=models.CharField(choices=[(b'approved', b'approved'), (b'denied', b'denied'),
-                                            (b'na', b'na'), (b'not_relevant', b'not_relevant')], max_length=36),
+            field=models.CharField(
+                choices=[(b'approved', b'approved'), (b'denied', b'denied'),
+                         (b'na', b'na'), (b'not_relevant', b'not_relevant')],
+                max_length=36),
         ),
         migrations.AlterField(
             model_name='checklistdecision',
             name='review_value',
-            field=models.CharField(choices=[(b'approved', b'approved'), (b'denied', b'denied'),
-                                            (b'na', b'na'), (b'not_relevant', b'not_relevant')], max_length=36),
+            field=models.CharField(
+                choices=[(b'approved', b'approved'), (b'denied', b'denied'),
+                         (b'na', b'na'), (b'not_relevant', b'not_relevant')],
+                max_length=36),
         ),
         migrations.AlterField(
             model_name='checklistlineitem',
             name='line_type',
-            field=models.CharField(choices=[(b'auto', b'auto'), (b'manual', b'manual')],
-                                   default=b'auto', max_length=36),
+            field=models.CharField(
+                choices=[(b'auto', b'auto'), (b'manual', b'manual')],
+                default=b'auto', max_length=36),
         ),
         migrations.AlterField(
             model_name='checklisttemplate',
             name='category',
-            field=models.CharField(choices=[(b'glance', b'glance'), (b'heat', b'heat'),
-                                            (b'overall', b'overall')], default=b'overall', max_length=36),
+            field=models.CharField(
+                choices=[(b'glance', b'glance'), (b'heat', b'heat'),
+                         (b'overall', b'overall')], default=b'overall',
+                max_length=36),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='starred_engagement',
-            field=models.ManyToManyField(blank=True, to='engagementmanager.IceUser'),
+            field=models.ManyToManyField(
+                blank=True, to='engagementmanager.IceUser'),
         ),
         migrations.AlterField(
             model_name='nextstep',
             name='next_step_type',
-            field=models.CharField(choices=[(b'add_contact_person', b'add_contact_person'), (b'el_handoff', b'el_handoff'), (b'set_ssh', b'set_ssh'), (
-                b'submit_vf_package', b'submit_vf_package'), (b'trial_agreements', b'trial_agreements'), (b'user_defined', b'user_defined')], default=b'user_defined', max_length=36),
+            field=models.CharField(
+                choices=[(b'add_contact_person', b'add_contact_person'),
+                         (b'el_handoff', b'el_handoff'),
+                         (b'set_ssh', b'set_ssh'), (
+                    b'submit_vf_package', b'submit_vf_package'),
+                    (b'trial_agreements', b'trial_agreements'),
+                    (b'user_defined', b'user_defined')],
+                default=b'user_defined', max_length=36),
         ),
         migrations.AlterField(
             model_name='recentengagement',
             name='action_type',
-            field=models.CharField(choices=[(b'GOT_OWNERSHIP_OVER_ENGAGEMENT', b'GOT_OWNERSHIP_OVER_ENGAGEMENT'), (b'JOINED_TO_ENGAGEMENT', b'JOINED_TO_ENGAGEMENT'), (
-                b'NAVIGATED_INTO_ENGAGEMENT', b'NAVIGATED_INTO_ENGAGEMENT'), (b'NEW_VF_CREATED', b'NEW_VF_CREATED'), (b'NEXT_STEP_ASSIGNED', b'NEXT_STEP_ASSIGNED')], max_length=36),
+            field=models.CharField(
+                choices=[(b'GOT_OWNERSHIP_OVER_ENGAGEMENT',
+                          b'GOT_OWNERSHIP_OVER_ENGAGEMENT'),
+                         (b'JOINED_TO_ENGAGEMENT', b'JOINED_TO_ENGAGEMENT'), (
+                    b'NAVIGATED_INTO_ENGAGEMENT',
+                    b'NAVIGATED_INTO_ENGAGEMENT'),
+                    (b'NEW_VF_CREATED', b'NEW_VF_CREATED'),
+                    (b'NEXT_STEP_ASSIGNED', b'NEXT_STEP_ASSIGNED')],
+                max_length=36),
         ),
     ]
index 9bcf50c..d359667 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -54,28 +54,38 @@ class Migration(migrations.Migration):
         migrations.AlterField(
             model_name='engagement',
             name='engagement_manual_id',
-            field=models.CharField(max_length=36),
+            field=models.CharField(
+                max_length=36),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='starred_engagement',
-            field=models.ManyToManyField(blank=True, default=None, to='engagementmanager.IceUser'),
+            field=models.ManyToManyField(
+                blank=True,
+                default=None,
+                to='engagementmanager.IceUser'),
         ),
         migrations.AlterField(
             model_name='vf',
             name='ecomp_release',
-            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE,
-                                    to='engagementmanager.ECOMPRelease'),
+            field=models.ForeignKey(
+                null=True,
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.ECOMPRelease'),
         ),
         migrations.AlterField(
             model_name='vf',
             name='engagement',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.Engagement'),
+            field=models.ForeignKey(
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.Engagement'),
         ),
         migrations.AlterField(
             model_name='vf',
             name='git_repo_url',
-            field=models.CharField(default='', max_length=512),
+            field=models.CharField(
+                default='',
+                max_length=512),
             preserve_default=False,
         ),
     ]
index 79214dc..7036260 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -54,29 +54,46 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='engagement',
             name='reviewer',
-            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT,
-                                    related_name='Engagement_el_reviewer', to='engagementmanager.IceUser'),
+            field=models.ForeignKey(
+                blank=True,
+                null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                related_name='Engagement_el_reviewer',
+                to='engagementmanager.IceUser'),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='engagement_manual_id',
-            field=models.CharField(default=-1, max_length=36),
+            field=models.CharField(
+                default=-1,
+                max_length=36),
         ),
         migrations.AlterField(
             model_name='nextstep',
             name='state',
-            field=models.CharField(choices=[(b'Completed', b'Completed'), (b'Confirmed',
-                                                                           b'Confirmed'), (b'TODO', b'TODO')], max_length=15),
+            field=models.CharField(
+                choices=[
+                    (b'Completed',
+                     b'Completed'),
+                    (b'Confirmed',
+                     b'Confirmed'),
+                    (b'TODO',
+                     b'TODO')],
+                max_length=15),
         ),
         migrations.AlterField(
             model_name='vf',
             name='engagement',
-            field=models.ForeignKey(default=-1, on_delete=django.db.models.deletion.CASCADE,
-                                    to='engagementmanager.Engagement'),
+            field=models.ForeignKey(
+                default=-1,
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.Engagement'),
         ),
         migrations.AlterField(
             model_name='vf',
             name='git_repo_url',
-            field=models.CharField(default=-1, max_length=512),
+            field=models.CharField(
+                default=-1,
+                max_length=512),
         ),
     ]
index 06a55c1..395d01d 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -54,46 +54,64 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='engagement',
             name='active_time',
-            field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='active time'),
+            field=models.DateTimeField(
+                default=django.utils.timezone.now,
+                verbose_name='active time'),
         ),
         migrations.AddField(
             model_name='engagement',
             name='aic_instantiation_time',
-            field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='aic instantiation time'),
+            field=models.DateTimeField(
+                default=django.utils.timezone.now,
+                verbose_name='aic instantiation time'),
         ),
         migrations.AddField(
             model_name='engagement',
             name='asdc_onboarding_time',
-            field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='asdc onboarding time'),
+            field=models.DateTimeField(
+                default=django.utils.timezone.now,
+                verbose_name='asdc onboarding time'),
         ),
         migrations.AddField(
             model_name='engagement',
             name='completed_time',
-            field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='completed time'),
+            field=models.DateTimeField(
+                default=django.utils.timezone.now,
+                verbose_name='completed time'),
         ),
         migrations.AddField(
             model_name='engagement',
             name='heat_validated_time',
-            field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='heat validated time'),
+            field=models.DateTimeField(
+                default=django.utils.timezone.now,
+                verbose_name='heat validated time'),
         ),
         migrations.AddField(
             model_name='engagement',
             name='image_scan_time',
-            field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='image scan time'),
+            field=models.DateTimeField(
+                default=django.utils.timezone.now,
+                verbose_name='image scan time'),
         ),
         migrations.AddField(
             model_name='engagement',
             name='intake_time',
-            field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='intake time'),
+            field=models.DateTimeField(
+                default=django.utils.timezone.now,
+                verbose_name='intake time'),
         ),
         migrations.AddField(
             model_name='engagement',
             name='started_state_time',
-            field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='started state time'),
+            field=models.DateTimeField(
+                default=django.utils.timezone.now,
+                verbose_name='started state time'),
         ),
         migrations.AddField(
             model_name='engagement',
             name='validated_time',
-            field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='validated time'),
+            field=models.DateTimeField(
+                default=django.utils.timezone.now,
+                verbose_name='validated time'),
         ),
     ]
index ee4efd4..bde0b91 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -53,52 +53,96 @@ class Migration(migrations.Migration):
         migrations.AlterField(
             model_name='activity',
             name='activity_type',
-            field=models.CharField(choices=[(b'change_checklist_state', b'change_checklist_state'), (b'eng_validation_request', b'eng_validation_request'), (b'next_steps', b'next_steps'), (b'ssh_key_added', b'ssh_key_added'), (
-                b'test_finished_event', b'test_finished_event'), (b'user_joined_eng', b'user_joined_eng'), (b'vf_provisioing_event', b'vf_provisioing_event'), (b'vfc', b'vfc')], max_length=36),
+            field=models.CharField(
+                choices=[
+                    (b'change_checklist_state',
+                     b'change_checklist_state'),
+                    (b'eng_validation_request',
+                     b'eng_validation_request'),
+                    (b'next_steps',
+                     b'next_steps'),
+                    (b'ssh_key_added',
+                     b'ssh_key_added'),
+                    (b'test_finished_event',
+                     b'test_finished_event'),
+                    (b'user_joined_eng',
+                     b'user_joined_eng'),
+                    (b'vf_provisioing_event',
+                     b'vf_provisioing_event'),
+                    (b'vfc',
+                     b'vfc')],
+                max_length=36),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='active_time',
-            field=models.DateTimeField(blank=True, null=True, verbose_name='active time'),
+            field=models.DateTimeField(
+                blank=True,
+                null=True,
+                verbose_name='active time'),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='aic_instantiation_time',
-            field=models.DateTimeField(blank=True, null=True, verbose_name='aic instantiation time'),
+            field=models.DateTimeField(
+                blank=True,
+                null=True,
+                verbose_name='aic instantiation time'),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='asdc_onboarding_time',
-            field=models.DateTimeField(blank=True, null=True, verbose_name='asdc onboarding time'),
+            field=models.DateTimeField(
+                blank=True,
+                null=True,
+                verbose_name='asdc onboarding time'),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='completed_time',
-            field=models.DateTimeField(blank=True, null=True, verbose_name='completed time'),
+            field=models.DateTimeField(
+                blank=True,
+                null=True,
+                verbose_name='completed time'),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='heat_validated_time',
-            field=models.DateTimeField(blank=True, null=True, verbose_name='heat validated time'),
+            field=models.DateTimeField(
+                blank=True,
+                null=True,
+                verbose_name='heat validated time'),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='image_scan_time',
-            field=models.DateTimeField(blank=True, null=True, verbose_name='image scan time'),
+            field=models.DateTimeField(
+                blank=True,
+                null=True,
+                verbose_name='image scan time'),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='intake_time',
-            field=models.DateTimeField(blank=True, null=True, verbose_name='intake time'),
+            field=models.DateTimeField(
+                blank=True,
+                null=True,
+                verbose_name='intake time'),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='started_state_time',
-            field=models.DateTimeField(blank=True, null=True, verbose_name='started state time'),
+            field=models.DateTimeField(
+                blank=True,
+                null=True,
+                verbose_name='started state time'),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='validated_time',
-            field=models.DateTimeField(blank=True, null=True, verbose_name='validated time'),
+            field=models.DateTimeField(
+                blank=True,
+                null=True,
+                verbose_name='validated time'),
         ),
     ]
index 84eee4d..0b9247c 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -55,14 +55,31 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='EngagementStatus',
             fields=[
-                ('uuid', models.CharField(max_length=64, primary_key=True, serialize=False)),
-                ('description', models.CharField(max_length=256)),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now)),
-                ('update_time', models.DateTimeField(default=django.utils.timezone.now)),
-                ('creator', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT,
-                                              related_name='status_creator', to='engagementmanager.IceUser')),
-                ('engagement', models.ForeignKey(
-                    on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.Engagement')),
+                ('uuid',
+                 models.CharField(
+                     max_length=64,
+                     primary_key=True,
+                     serialize=False)),
+                ('description',
+                 models.CharField(
+                     max_length=256)),
+                ('create_time',
+                 models.DateTimeField(
+                     default=django.utils.timezone.now)),
+                ('update_time',
+                 models.DateTimeField(
+                     default=django.utils.timezone.now)),
+                ('creator',
+                 models.ForeignKey(
+                     blank=True,
+                     null=True,
+                     on_delete=django.db.models.deletion.PROTECT,
+                     related_name='status_creator',
+                     to='engagementmanager.IceUser')),
+                ('engagement',
+                 models.ForeignKey(
+                     on_delete=django.db.models.deletion.PROTECT,
+                     to='engagementmanager.Engagement')),
             ],
             options={
                 'db_table': 'ice_engagement_status',
index 92d1518..de53576 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -53,7 +53,17 @@ class Migration(migrations.Migration):
         migrations.AlterField(
             model_name='engagement',
             name='engagement_stage',
-            field=models.CharField(choices=[(b'Active', b'Active'), (b'Completed', b'Completed'),
-                                            (b'Intake', b'Intake'), (b'Validated', b'Validated')], default=b'Intake', max_length=15),
+            field=models.CharField(
+                choices=[
+                    (b'Active',
+                     b'Active'),
+                    (b'Completed',
+                     b'Completed'),
+                    (b'Intake',
+                     b'Intake'),
+                    (b'Validated',
+                     b'Validated')],
+                default=b'Intake',
+                max_length=15),
         ),
     ]
index c0adc38..cc264ce 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -54,14 +54,18 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='Invitation',
             fields=[
-                ('uuid', models.CharField(max_length=36, primary_key=True, serialize=False)),
-                ('engagement_uuid', models.CharField(db_index=True, max_length=64)),
-                ('invited_by_user_uuid', models.CharField(db_index=True, max_length=64)),
+                ('uuid', models.CharField(max_length=36,
+                                          primary_key=True, serialize=False)),
+                ('engagement_uuid', models.CharField(
+                    db_index=True, max_length=64)),
+                ('invited_by_user_uuid', models.CharField(
+                    db_index=True, max_length=64)),
                 ('email', models.CharField(max_length=255)),
                 ('invitation_token', models.CharField(max_length=1024)),
                 ('accepted', models.BooleanField(default=False)),
                 ('create_time', models.DateTimeField(
-                    default=django.utils.timezone.now, verbose_name='invitation creation time')),
+                    default=django.utils.timezone.now,
+                    verbose_name='invitation creation time')),
             ],
             options={
                 'db_table': 'ice_invitation',
index 76e8265..6b54271 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -50,5 +50,6 @@ class Migration(migrations.Migration):
     ]
 
     operations = [
-        migrations.RunSQL("update ice_notification SET is_sent = 't' where is_sent = 'f';"),
+        migrations.RunSQL(
+            "update ice_notification SET is_sent = 't' where is_sent = 'f';"),
     ]
index 329ffa3..ea919ec 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -53,7 +53,19 @@ class Migration(migrations.Migration):
         migrations.AlterField(
             model_name='engagement',
             name='engagement_stage',
-            field=models.CharField(choices=[(b'Active', b'Active'), (b'Archived', b'Archived'), (b'Completed', b'Completed'), (
-                b'Intake', b'Intake'), (b'Validated', b'Validated')], default=b'Intake', max_length=15),
+            field=models.CharField(
+                choices=[
+                    (b'Active',
+                     b'Active'),
+                    (b'Archived',
+                     b'Archived'),
+                    (b'Completed',
+                     b'Completed'),
+                    (b'Intake',
+                     b'Intake'),
+                    (b'Validated',
+                     b'Validated')],
+                default=b'Intake',
+                max_length=15),
         ),
     ]
index 2b71e1e..ddb6680 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -65,13 +65,19 @@ class Migration(migrations.Migration):
         migrations.AlterField(
             model_name='engagement',
             name='engagement_stage',
-            field=models.CharField(choices=[(b'Active', b'Active'), (b'Archived', b'Archived'), (b'Completed', b'Completed'), (
-                b'Intake', b'Intake'), (b'Validated', b'Validated')], db_index=True, default=b'Intake', max_length=15),
+            field=models.CharField(
+                choices=[(b'Active', b'Active'), (b'Archived', b'Archived'),
+                         (b'Completed', b'Completed'), (
+                    b'Intake', b'Intake'), (b'Validated', b'Validated')],
+                db_index=True, default=b'Intake',
+                max_length=15),
         ),
         migrations.AlterField(
             model_name='iceuser',
             name='email',
-            field=models.EmailField(db_index=True, max_length=254, unique=True, verbose_name='email'),
+            field=models.EmailField(
+                db_index=True, max_length=254, unique=True,
+                verbose_name='email'),
         ),
         migrations.AlterField(
             model_name='invitation',
@@ -81,8 +87,10 @@ class Migration(migrations.Migration):
         migrations.AlterField(
             model_name='vf',
             name='engagement',
-            field=models.OneToOneField(default=-1, on_delete=django.db.models.deletion.CASCADE,
-                                       to='engagementmanager.Engagement'),
+            field=models.OneToOneField(
+                default=-1,
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.Engagement'),
         ),
         migrations.AlterField(
             model_name='vf',
index b902df4..6cd92cc 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -50,8 +50,13 @@ def forwards(apps, schema_editor):
         return
 
     cursor = connection.cursor()
-    cursor.execute(open(os.path.join(os.path.dirname(engagementmanager.__file__),
-                                     'sql-scripts/generate_excel_overview_sheet_procedure.sql'), "r").read())
+    cursor.execute(
+        open(
+            os.path.join(
+                os.path.dirname(
+                    engagementmanager.__file__),
+                'sql-scripts/generate_excel_overview_sheet_procedure.sql'),
+            "r").read())
 
 
 class Migration(migrations.Migration):
index b90451b..5769817 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -56,15 +56,16 @@ def create_user_for_pre_user_profiles(apps, schema_editor):
     CustomUser = apps.get_model("engagementmanager", "CustomUser")
     IceUserProfile = apps.get_model("engagementmanager", "IceUserProfile")
     users_list = IceUserProfile.objects.filter(user=None)
-    count = 0
     for profile in users_list:
         try:
-            custom_user, created = CustomUser.objects.get_or_create(username=profile.email)
+            custom_user, created = CustomUser.objects.get_or_create(
+                username=profile.email)
             custom_user.is_active = profile.is_active
             custom_user.email = profile.email
             custom_user.activation_token = profile.activation_token
             custom_user.password = profile.password
-            custom_user.activation_token_create_time = profile.activation_token_create_time
+            custom_user.activation_token_create_time = \
+                profile.activation_token_create_time
             custom_user.save()
             profile.user = custom_user
             profile.save()
@@ -78,19 +79,28 @@ class Migration(migrations.Migration):
 
     dependencies = [
         #         ('auth', '0009_auto_20170118_0740'),
-        ('engagementmanager', '0021_generate_excel_overview_sheet_procedure_20170110'),
+        ('engagementmanager',
+         '0021_generate_excel_overview_sheet_procedure_20170110'),
     ]
 
     operations = [
         migrations.CreateModel(
             name='CustomUser',
             fields=[
-                ('user_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE,
-                                                  parent_link=True, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
-                ('activation_token', models.CharField(max_length=128, null=True, unique=True)),
+                ('user_ptr', models.OneToOneField(
+                    auto_created=True,
+                    on_delete=django.db.models.deletion.CASCADE,
+                    parent_link=True, primary_key=True,
+                    serialize=False,
+                    to=settings.AUTH_USER_MODEL)),
+                ('activation_token', models.CharField(
+                    max_length=128, null=True, unique=True)),
                 ('activation_token_create_time', models.DateTimeField(
-                    default=django.utils.timezone.now, null=True, verbose_name='activation_token_create_time')),
-                ('temp_password', models.CharField(blank=True, default=None, max_length=256, null=True)),
+                    default=django.utils.timezone.now, null=True,
+                    verbose_name='activation_token_create_time')),
+                ('temp_password', models.CharField(
+
+                    blank=True, default=None, max_length=256, null=True)),
             ],
             options={
                 'abstract': False,
@@ -107,69 +117,126 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='IceUserProfile',
             name='user',
-            field=models.OneToOneField(null=True, on_delete=django.db.models.CASCADE, to='engagementmanager.CustomUser')
+            field=models.OneToOneField(
+                null=True, on_delete=django.db.models.CASCADE,
+                to='engagementmanager.CustomUser')
         ),
         migrations.AlterField(
             model_name='activity',
             name='activity_type',
-            field=models.CharField(choices=[(b'user_joined_eng', b'user_joined_eng'), (b'ssh_key_added', b'ssh_key_added'), (b'eng_validation_request', b'eng_validation_request'), (b'next_steps', b'next_steps'), (
-                b'vfc', b'vfc'), (b'change_checklist_state', b'change_checklist_state'), (b'vf_provisioing_event', b'vf_provisioing_event'), (b'test_finished_event', b'test_finished_event')], max_length=36),
+            field=models.CharField(
+                choices=[(b'user_joined_eng', b'user_joined_eng'),
+                         (b'ssh_key_added', b'ssh_key_added'),
+                         (b'eng_validation_request',
+                          b'eng_validation_request'),
+                         (b'next_steps', b'next_steps'), (b'vfc', b'vfc'),
+                         (b'change_checklist_state',
+                          b'change_checklist_state'),
+                         (b'vf_provisioing_event', b'vf_provisioing_event'),
+                         (b'test_finished_event', b'test_finished_event')],
+                max_length=36),
         ),
         migrations.AlterField(
             model_name='checklist',
             name='state',
-            field=models.CharField(choices=[(b'pending', b'pending'), (b'automation', b'automation'), (b'review', b'review'), (b'peer_review', b'peer_review'), (
-                b'approval', b'approval'), (b'handoff', b'handoff'), (b'closed', b'closed'), (b'archive', b'archive')], default=b'pending', max_length=36),
+            field=models.CharField(choices=[(b'pending', b'pending'),
+                                            (b'automation', b'automation'),
+                                            (b'review', b'review'),
+                                            (b'peer_review', b'peer_review'),
+                                            (b'approval', b'approval'),
+                                            (b'handoff', b'handoff'),
+                                            (b'closed', b'closed'),
+                                            (b'archive', b'archive')],
+                                   default=b'pending', max_length=36),
         ),
         migrations.AlterField(
             model_name='checklistdecision',
             name='peer_review_value',
-            field=models.CharField(choices=[(b'na', b'na'), (b'approved', b'approved'),
-                                            (b'denied', b'denied'), (b'not_relevant', b'not_relevant')], max_length=36),
+            field=models.CharField(choices=[(b'na', b'na'),
+                                            (b'approved', b'approved'),
+                                            (b'denied', b'denied'),
+                                            (b'not_relevant',
+                                             b'not_relevant')],
+                                   max_length=36),
         ),
         migrations.AlterField(
             model_name='checklistdecision',
             name='review_value',
-            field=models.CharField(choices=[(b'na', b'na'), (b'approved', b'approved'),
-                                            (b'denied', b'denied'), (b'not_relevant', b'not_relevant')], max_length=36),
+            field=models.CharField(
+                choices=[(b'na', b'na'), (b'approved', b'approved'),
+                         (b'denied', b'denied'),
+                         (b'not_relevant',
+                          b'not_relevant')],
+                max_length=36),
         ),
         migrations.AlterField(
             model_name='checklistlineitem',
             name='line_type',
             field=models.CharField(
-                choices=[(b'manual', b'manual'), (b'auto', b'auto')], default=b'auto', max_length=36),
+                choices=[(b'manual', b'manual'),
+                         (b'auto', b'auto')],
+                default=b'auto',
+                max_length=36),
         ),
         migrations.AlterField(
             model_name='checklisttemplate',
             name='category',
-            field=models.CharField(choices=[(b'glance', b'glance'), (b'instantiation', b'instantiation'), (
-                b'asdc', b'asdc'), (b'overall', b'overall'), (b'heat', b'heat')], default=b'overall', max_length=36),
+            field=models.CharField(
+                choices=[(b'glance', b'glance'),
+                         (b'instantiation', b'instantiation'), (
+                    b'asdc', b'asdc'),
+                    (b'overall', b'overall'),
+                    (b'heat', b'heat')],
+                default=b'overall', max_length=36),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='engagement_stage',
-            field=models.CharField(choices=[(b'Archived', b'Archived'), (b'Intake', b'Intake'), (b'Active', b'Active'), (
-                b'Validated', b'Validated'), (b'Completed', b'Completed')], db_index=True, default=b'Intake', max_length=15),
+            field=models.CharField(
+                choices=[(b'Archived', b'Archived'),
+                         (b'Intake', b'Intake'),
+                         (b'Active', b'Active'), (
+                    b'Validated', b'Validated'),
+                    (b'Completed', b'Completed')],
+                db_index=True,
+                default=b'Intake',
+                max_length=15),
         ),
 
         migrations.AlterField(
             model_name='nextstep',
             name='next_step_type',
-            field=models.CharField(choices=[(b'user_defined', b'user_defined'), (b'set_ssh', b'set_ssh'), (b'trial_agreements', b'trial_agreements'), (
-                b'add_contact_person', b'add_contact_person'), (b'submit_vf_package', b'submit_vf_package'), (b'el_handoff', b'el_handoff')], default=b'user_defined', max_length=36),
+            field=models.CharField(
+                choices=[(b'user_defined', b'user_defined'),
+                         (b'set_ssh', b'set_ssh'),
+                         (b'trial_agreements', b'trial_agreements'), (
+                    b'add_contact_person', b'add_contact_person'),
+                    (b'submit_vf_package', b'submit_vf_package'),
+                    (b'el_handoff', b'el_handoff')],
+                default=b'user_defined', max_length=36),
         ),
 
         migrations.AlterField(
             model_name='nextstep',
             name='state',
             field=models.CharField(
-                choices=[(b'Confirmed', b'Confirmed'), (b'TODO', b'TODO'), (b'Completed', b'Completed')], max_length=15),
+                choices=[(b'Confirmed', b'Confirmed'),
+                         (b'TODO', b'TODO'),
+                         (b'Completed', b'Completed')],
+                max_length=15),
         ),
         migrations.AlterField(
             model_name='recentengagement',
             name='action_type',
-            field=models.CharField(choices=[(b'JOINED_TO_ENGAGEMENT', b'JOINED_TO_ENGAGEMENT'), (b'NEXT_STEP_ASSIGNED', b'NEXT_STEP_ASSIGNED'), (
-                b'GOT_OWNERSHIP_OVER_ENGAGEMENT', b'GOT_OWNERSHIP_OVER_ENGAGEMENT'), (b'NAVIGATED_INTO_ENGAGEMENT', b'NAVIGATED_INTO_ENGAGEMENT'), (b'NEW_VF_CREATED', b'NEW_VF_CREATED')], max_length=36),
+            field=models.CharField(
+                choices=[(b'JOINED_TO_ENGAGEMENT', b'JOINED_TO_ENGAGEMENT'),
+                         (b'NEXT_STEP_ASSIGNED', b'NEXT_STEP_ASSIGNED'), (
+                    b'GOT_OWNERSHIP_OVER_ENGAGEMENT',
+                    b'GOT_OWNERSHIP_OVER_ENGAGEMENT'),
+                    (b'NAVIGATED_INTO_ENGAGEMENT',
+                     b'NAVIGATED_INTO_ENGAGEMENT'),
+                    (b'NEW_VF_CREATED', b'NEW_VF_CREATED')],
+                max_length=36),
         ),
         #         migrations.DeleteModel(
         #             name='IceUser',
@@ -178,98 +245,141 @@ class Migration(migrations.Migration):
         migrations.AlterField(
             model_name='notification',
             name='user',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.IceUserProfile'),
+            field=models.ForeignKey(
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AlterField(
             model_name='vfc',
             name='creator',
-            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT,
-                                    related_name='Vfc_creator', to='engagementmanager.IceUserProfile'),
+            field=models.ForeignKey(
+                blank=True, null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                related_name='Vfc_creator',
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AlterField(
             model_name='nextstep',
             name='owner',
             field=models.ForeignKey(
-                blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.IceUserProfile'),
+
+                blank=True, null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='engagement_team',
-            field=models.ManyToManyField(related_name='members', to='engagementmanager.IceUserProfile'),
+            field=models.ManyToManyField(
+                related_name='members',
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='contact_user',
-            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT,
-                                    related_name='Engagement_contact_user', to='engagementmanager.IceUserProfile'),
+            field=models.ForeignKey(
+                blank=True, null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                related_name='Engagement_contact_user',
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='creator',
-            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT,
-                                    related_name='Engagement_creator', to='engagementmanager.IceUserProfile'),
+            field=models.ForeignKey(
+                blank=True, null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                related_name='Engagement_creator',
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AlterField(
             model_name='checklistauditlog',
             name='creator',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.IceUserProfile'),
+            field=models.ForeignKey(
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='peer_reviewer',
-            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT,
-                                    related_name='Engagement_peer_reviewer', to='engagementmanager.IceUserProfile'),
+            field=models.ForeignKey(
+                blank=True, null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                related_name='Engagement_peer_reviewer',
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='reviewer',
-            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT,
-                                    related_name='Engagement_el_reviewer', to='engagementmanager.IceUserProfile'),
+            field=models.ForeignKey(
+                blank=True, null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                related_name='Engagement_el_reviewer',
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='starred_engagement',
-            field=models.ManyToManyField(blank=True, default=None, to='engagementmanager.IceUserProfile'),
+            field=models.ManyToManyField(
+
+                blank=True, default=None,
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AlterField(
             model_name='engagementstatus',
             name='creator',
-            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT,
-                                    related_name='status_creator', to='engagementmanager.IceUserProfile'),
+            field=models.ForeignKey(
+                blank=True, null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                related_name='status_creator',
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AlterField(
             model_name='nextstep',
             name='assignees',
-            field=models.ManyToManyField(related_name='assignees', to='engagementmanager.IceUserProfile'),
+            field=models.ManyToManyField(
+                related_name='assignees',
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AlterField(
             model_name='nextstep',
             name='creator',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
-                                    related_name='NextStep_creator', to='engagementmanager.IceUserProfile'),
+            field=models.ForeignKey(
+                on_delete=django.db.models.deletion.PROTECT,
+                related_name='NextStep_creator',
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AlterField(
             model_name='nextstep',
             name='last_updater',
-            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT,
-                                    related_name='NextStep_last_updater', to='engagementmanager.IceUserProfile'),
+            field=models.ForeignKey(
+                null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                related_name='NextStep_last_updater',
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AlterField(
             model_name='activity',
             name='activity_owner',
             field=models.ForeignKey(
-                blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.IceUserProfile'),
+                blank=True, null=True,
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AlterField(
             model_name='checklist',
             name='creator',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
-                                    related_name='checklist_creator', to='engagementmanager.IceUserProfile'),
+            field=models.ForeignKey(
+                on_delete=django.db.models.deletion.CASCADE,
+                related_name='checklist_creator',
+                to='engagementmanager.IceUserProfile'),
         ),
         migrations.AlterField(
             model_name='checklist',
             name='owner',
-            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
-                                    related_name='checklist_owner', to='engagementmanager.IceUserProfile'),
+            field=models.ForeignKey(
+                on_delete=django.db.models.deletion.CASCADE,
+                related_name='checklist_owner',
+                to='engagementmanager.IceUserProfile'),
         ),
     ]
index cd01832..20526d2 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -82,8 +82,9 @@ class Migration(migrations.Migration):
         migrations.AlterField(
             model_name='iceuserprofile',
             name='company',
-            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT,
-                                    to='engagementmanager.Vendor'),
+            field=models.ForeignKey(
+                null=True, on_delete=django.db.models.deletion.PROTECT,
+                to='engagementmanager.Vendor'),
         ),
         migrations.AlterField(
             model_name='iceuserprofile',
@@ -93,13 +94,16 @@ class Migration(migrations.Migration):
         migrations.AlterField(
             model_name='iceuserprofile',
             name='role',
-            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT,
-                                    to='engagementmanager.Role'),
+            field=models.ForeignKey(
+                null=True, on_delete=django.db.models.deletion.PROTECT,
+                to='engagementmanager.Role'),
         ),
         migrations.AlterField(
             model_name='iceuserprofile',
             name='user',
-            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.CustomUser'),
+            field=models.OneToOneField(
+                on_delete=django.db.models.deletion.CASCADE,
+                to='engagementmanager.CustomUser'),
         ),
         migrations.AlterModelTable(
             name='customuser',
index 3481eb5..0919dbb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -53,12 +53,33 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='engagement',
             name='archive_reason',
-            field=models.TextField(default=None, null=True),
+            field=models.TextField(
+                default=None,
+                null=True),
         ),
         migrations.AlterField(
             model_name='activity',
             name='activity_type',
-            field=models.CharField(choices=[(b'user_joined_eng', b'user_joined_eng'), (b'ssh_key_added', b'ssh_key_added'), (b'eng_validation_request', b'eng_validation_request'), (b'next_steps', b'next_steps'), (b'vfc', b'vfc'), (
-                b'change_checklist_state', b'change_checklist_state'), (b'vf_provisioing_event', b'vf_provisioing_event'), (b'test_finished_event', b'test_finished_event'), (b'change_engagement_stage', b'change_engagement_stage')], max_length=36),
+            field=models.CharField(
+                choices=[
+                    (b'user_joined_eng',
+                     b'user_joined_eng'),
+                    (b'ssh_key_added',
+                     b'ssh_key_added'),
+                    (b'eng_validation_request',
+                     b'eng_validation_request'),
+                    (b'next_steps',
+                     b'next_steps'),
+                    (b'vfc',
+                     b'vfc'),
+                    (b'change_checklist_state',
+                     b'change_checklist_state'),
+                    (b'vf_provisioing_event',
+                     b'vf_provisioing_event'),
+                    (b'test_finished_event',
+                     b'test_finished_event'),
+                    (b'change_engagement_stage',
+                     b'change_engagement_stage')],
+                max_length=36),
         ),
     ]
index bfec64d..0d5ae02 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -49,6 +49,10 @@ class Migration(migrations.Migration):
     ]
 
     operations = [
-        migrations.RunSQL("update  ice_next_step set state = 'Incomplete' where state = 'TODO';"),
-        migrations.RunSQL("update  ice_next_step set state = 'Completed' where state = 'Confirmed';"),
+        migrations.RunSQL(
+            "update  ice_next_step set state = 'Incomplete' \
+            where state = 'TODO';"),
+        migrations.RunSQL(
+            "update  ice_next_step set state = 'Completed' \
+            where state = 'Confirmed';"),
     ]
index 489b6ce..0406dfa 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -52,6 +52,7 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='iceuserprofile',
             name='slack_handle',
-            field=models.CharField(blank=True, default=None, max_length=64, null=True),
+            field=models.CharField(
+                blank=True, default=None, max_length=64, null=True),
         ),
     ]
index 3bd618e..5eb2087 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 68e15f5..d4988e9 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -53,59 +53,177 @@ class Migration(migrations.Migration):
         migrations.AlterField(
             model_name='activity',
             name='activity_type',
-            field=models.CharField(choices=[('user_joined_eng', 'user_joined_eng'), ('ssh_key_added', 'ssh_key_added'), ('eng_validation_request', 'eng_validation_request'), ('next_steps', 'next_steps'), ('vfc', 'vfc'), (
-                'change_checklist_state', 'change_checklist_state'), ('vf_provisioing_event', 'vf_provisioing_event'), ('test_finished_event', 'test_finished_event'), ('change_engagement_stage', 'change_engagement_stage')], max_length=36),
+            field=models.CharField(
+                choices=[
+                    ('user_joined_eng',
+                     'user_joined_eng'),
+                    ('ssh_key_added',
+                     'ssh_key_added'),
+                    ('eng_validation_request',
+                     'eng_validation_request'),
+                    ('next_steps',
+                     'next_steps'),
+                    ('vfc',
+                     'vfc'),
+                    ('change_checklist_state',
+                     'change_checklist_state'),
+                    ('vf_provisioing_event',
+                     'vf_provisioing_event'),
+                    ('test_finished_event',
+                     'test_finished_event'),
+                    ('change_engagement_stage',
+                     'change_engagement_stage')],
+                max_length=36),
         ),
         migrations.AlterField(
             model_name='checklist',
             name='state',
-            field=models.CharField(choices=[('automation', 'automation'), ('review', 'review'), ('peer_review', 'peer_review'), ('approval', 'approval'), (
-                'handoff', 'handoff'), ('closed', 'closed'), ('archive', 'archive'), ('pending', 'pending')], default='pending', max_length=36),
+            field=models.CharField(
+                choices=[
+                    ('automation',
+                     'automation'),
+                    ('review',
+                     'review'),
+                    ('peer_review',
+                     'peer_review'),
+                    ('approval',
+                     'approval'),
+                    ('handoff',
+                     'handoff'),
+                    ('closed',
+                     'closed'),
+                    ('archive',
+                     'archive'),
+                    ('pending',
+                     'pending')],
+                default='pending',
+                max_length=36),
         ),
         migrations.AlterField(
             model_name='checklistdecision',
             name='peer_review_value',
-            field=models.CharField(choices=[('approved', 'approved'), ('denied', 'denied'),
-                                            ('not_relevant', 'not_relevant'), ('na', 'na')], max_length=36),
+            field=models.CharField(
+                choices=[
+                    ('approved',
+                     'approved'),
+                    ('denied',
+                     'denied'),
+                    ('not_relevant',
+                     'not_relevant'),
+                    ('na',
+                     'na')],
+                max_length=36),
         ),
         migrations.AlterField(
             model_name='checklistdecision',
             name='review_value',
-            field=models.CharField(choices=[('approved', 'approved'), ('denied', 'denied'),
-                                            ('not_relevant', 'not_relevant'), ('na', 'na')], max_length=36),
+            field=models.CharField(
+                choices=[
+                    ('approved',
+                     'approved'),
+                    ('denied',
+                     'denied'),
+                    ('not_relevant',
+                     'not_relevant'),
+                    ('na',
+                     'na')],
+                max_length=36),
         ),
         migrations.AlterField(
             model_name='checklistlineitem',
             name='line_type',
-            field=models.CharField(choices=[('auto', 'auto'), ('manual', 'manual')], default='auto', max_length=36),
+            field=models.CharField(
+                choices=[
+                    ('auto',
+                     'auto'),
+                    ('manual',
+                     'manual')],
+                default='auto',
+                max_length=36),
         ),
         migrations.AlterField(
             model_name='checklisttemplate',
             name='category',
-            field=models.CharField(choices=[('overall', 'overall'), ('heat', 'heat'), ('glance', 'glance'),
-                                            ('instantiation', 'instantiation'), ('asdc', 'asdc')], default='overall', max_length=36),
+            field=models.CharField(
+                choices=[
+                    ('overall',
+                     'overall'),
+                    ('heat',
+                     'heat'),
+                    ('glance',
+                     'glance'),
+                    ('instantiation',
+                     'instantiation'),
+                    ('asdc',
+                     'asdc')],
+                default='overall',
+                max_length=36),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='engagement_stage',
-            field=models.CharField(choices=[('Intake', 'Intake'), ('Active', 'Active'), ('Validated', 'Validated'), (
-                'Completed', 'Completed'), ('Archived', 'Archived')], db_index=True, default='Intake', max_length=15),
+            field=models.CharField(
+                choices=[
+                    ('Intake',
+                     'Intake'),
+                    ('Active',
+                     'Active'),
+                    ('Validated',
+                     'Validated'),
+                    ('Completed',
+                     'Completed'),
+                    ('Archived',
+                     'Archived')],
+                db_index=True,
+                default='Intake',
+                max_length=15),
         ),
         migrations.AlterField(
             model_name='nextstep',
             name='next_step_type',
-            field=models.CharField(choices=[('set_ssh', 'set_ssh'), ('trial_agreements', 'trial_agreements'), ('add_contact_person', 'add_contact_person'), (
-                'submit_vf_package', 'submit_vf_package'), ('el_handoff', 'el_handoff'), ('user_defined', 'user_defined')], default='user_defined', max_length=36),
+            field=models.CharField(
+                choices=[
+                    ('set_ssh',
+                     'set_ssh'),
+                    ('trial_agreements',
+                     'trial_agreements'),
+                    ('add_contact_person',
+                     'add_contact_person'),
+                    ('submit_vf_package',
+                     'submit_vf_package'),
+                    ('el_handoff',
+                     'el_handoff'),
+                    ('user_defined',
+                     'user_defined')],
+                default='user_defined',
+                max_length=36),
         ),
         migrations.AlterField(
             model_name='nextstep',
             name='state',
-            field=models.CharField(choices=[('Incomplete', 'Incomplete'), ('Completed', 'Completed')], max_length=15),
+            field=models.CharField(
+                choices=[
+                    ('Incomplete',
+                     'Incomplete'),
+                    ('Completed',
+                     'Completed')],
+                max_length=15),
         ),
         migrations.AlterField(
             model_name='recentengagement',
             name='action_type',
-            field=models.CharField(choices=[('JOINED_TO_ENGAGEMENT', 'JOINED_TO_ENGAGEMENT'), ('NEXT_STEP_ASSIGNED', 'NEXT_STEP_ASSIGNED'), ('GOT_OWNERSHIP_OVER_ENGAGEMENT',
-                                                                                                                                             'GOT_OWNERSHIP_OVER_ENGAGEMENT'), ('NAVIGATED_INTO_ENGAGEMENT', 'NAVIGATED_INTO_ENGAGEMENT'), ('NEW_VF_CREATED', 'NEW_VF_CREATED')], max_length=36),
+            field=models.CharField(
+                choices=[
+                    ('JOINED_TO_ENGAGEMENT',
+                     'JOINED_TO_ENGAGEMENT'),
+                    ('NEXT_STEP_ASSIGNED',
+                     'NEXT_STEP_ASSIGNED'),
+                    ('GOT_OWNERSHIP_OVER_ENGAGEMENT',
+                     'GOT_OWNERSHIP_OVER_ENGAGEMENT'),
+                    ('NAVIGATED_INTO_ENGAGEMENT',
+                     'NAVIGATED_INTO_ENGAGEMENT'),
+                    ('NEW_VF_CREATED',
+                     'NEW_VF_CREATED')],
+                max_length=36),
         ),
     ]
index f1a4f9a..6d609e2 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index b24f67a..0fe2b05 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -53,6 +53,7 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='engagement',
             name='archived_time',
-            field=models.DateTimeField(blank=True, null=True, verbose_name='archived time'),
+            field=models.DateTimeField(
+                blank=True, null=True, verbose_name='archived time'),
         ),
     ]
index f1956c4..8c27f24 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -54,11 +54,38 @@ class Migration(migrations.Migration):
         migrations.AlterField(
             model_name='activity',
             name='activity_type',
-            field=models.CharField(choices=[('user_joined_eng', 'user_joined_eng'), ('ssh_key_added', 'ssh_key_added'), ('eng_validation_request', 'eng_validation_request'), ('update_next_steps', 'update_next_steps'), ('vfc', 'vfc'), ('change_checklist_state', 'change_checklist_state'), ('vf_provisioning_event', 'vf_provisioning_event'), ('test_finished_event', 'test_finished_event'), ('change_engagement_stage', 'change_engagement_stage'), ('add_next_steps', 'add_next_steps'), ('delete_next_steps', 'delete_next_steps')], max_length=36),
+            field=models.CharField(
+                choices=[
+                    ('user_joined_eng',
+                     'user_joined_eng'),
+                    ('ssh_key_added',
+                     'ssh_key_added'),
+                    ('eng_validation_request',
+                     'eng_validation_request'),
+                    ('update_next_steps',
+                     'update_next_steps'),
+                    ('vfc',
+                     'vfc'),
+                    ('change_checklist_state',
+                     'change_checklist_state'),
+                    ('vf_provisioning_event',
+                     'vf_provisioning_event'),
+                    ('test_finished_event',
+                     'test_finished_event'),
+                    ('change_engagement_stage',
+                     'change_engagement_stage'),
+                    ('add_next_steps',
+                     'add_next_steps'),
+                    ('delete_next_steps',
+                     'delete_next_steps')],
+                max_length=36),
         ),
         migrations.AlterField(
             model_name='activity',
             name='engagement',
-            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='engagementmanager.Engagement'),
+            field=models.ForeignKey(
+                null=True,
+                on_delete=django.db.models.deletion.PROTECT,
+                to='engagementmanager.Engagement'),
         ),
     ]
index 53e5a22..11f0d86 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -55,10 +55,16 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='Feedback',
             fields=[
-                ('uuid', models.CharField(max_length=36, primary_key=True, serialize=False, unique=True)),
-                ('create_time', models.DateTimeField(default=django.utils.timezone.now)),
-                ('description', models.TextField(verbose_name='feedback_description')),
-                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.IceUserProfile')),
+                ('uuid', models.CharField(max_length=36,
+                                          primary_key=True, serialize=False,
+                                          unique=True)),
+                ('create_time', models.DateTimeField(
+                    default=django.utils.timezone.now)),
+                ('description', models.TextField(
+                    verbose_name='feedback_description')),
+                ('user', models.ForeignKey(
+                    on_delete=django.db.models.deletion.CASCADE,
+                    to='engagementmanager.IceUserProfile')),
             ],
             options={
                 'db_table': 'ice_feedback',
index c6d1bb6..08aebc8 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -54,116 +54,158 @@ class Migration(migrations.Migration):
         migrations.AlterField(
             model_name='activity',
             name='uuid',
-            field=models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False, unique=True),
+            field=models.CharField(
+                default=uuid.uuid4, max_length=36, primary_key=True,
+                serialize=False, unique=True),
         ),
         migrations.AlterField(
             model_name='applicationserviceinfrastructure',
             name='uuid',
-            field=models.CharField(default=uuid.uuid4, max_length=36, unique=True),
+            field=models.CharField(
+                default=uuid.uuid4, max_length=36, unique=True),
         ),
         migrations.AlterField(
             model_name='checklist',
             name='uuid',
-            field=models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False),
+            field=models.CharField(
+                default=uuid.uuid4, max_length=36, primary_key=True,
+                serialize=False),
         ),
         migrations.AlterField(
             model_name='checklistauditlog',
             name='uuid',
-            field=models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False),
+            field=models.CharField(
+                default=uuid.uuid4, max_length=36, primary_key=True,
+                serialize=False),
         ),
         migrations.AlterField(
             model_name='checklistdecision',
             name='uuid',
-            field=models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False),
+            field=models.CharField(
+                default=uuid.uuid4, max_length=36, primary_key=True,
+                serialize=False),
         ),
         migrations.AlterField(
             model_name='checklistlineitem',
             name='uuid',
-            field=models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False),
+            field=models.CharField(
+                default=uuid.uuid4, max_length=36, primary_key=True,
+                serialize=False),
         ),
         migrations.AlterField(
             model_name='checklistsection',
             name='uuid',
-            field=models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False),
+            field=models.CharField(
+                default=uuid.uuid4, max_length=36, primary_key=True,
+                serialize=False),
         ),
         migrations.AlterField(
             model_name='checklisttemplate',
             name='uuid',
-            field=models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False),
+            field=models.CharField(
+                default=uuid.uuid4, max_length=36, primary_key=True,
+                serialize=False),
         ),
         migrations.AlterField(
             model_name='deploymenttarget',
             name='uuid',
-            field=models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False),
+            field=models.CharField(
+                default=uuid.uuid4, max_length=36, primary_key=True,
+                serialize=False),
         ),
         migrations.AlterField(
             model_name='deploymenttargetsite',
             name='uuid',
-            field=models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False),
+            field=models.CharField(
+                default=uuid.uuid4, max_length=36, primary_key=True,
+                serialize=False),
         ),
         migrations.AlterField(
             model_name='ecomprelease',
             name='uuid',
-            field=models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False),
+            field=models.CharField(
+                default=uuid.uuid4, max_length=36, primary_key=True,
+                serialize=False),
         ),
         migrations.AlterField(
             model_name='engagement',
             name='uuid',
-            field=models.CharField(default=uuid.uuid4, max_length=64, primary_key=True, serialize=False),
+            field=models.CharField(
+                default=uuid.uuid4, max_length=64, primary_key=True,
+                serialize=False),
         ),
         migrations.AlterField(
             model_name='engagementstatus',
             name='uuid',
-            field=models.CharField(default=uuid.uuid4, max_length=64, primary_key=True, serialize=False),
+            field=models.CharField(
+                default=uuid.uuid4, max_length=64, primary_key=True,
+                serialize=False),
         ),
         migrations.AlterField(
             model_name='feedback',
             name='uuid',
-            field=models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False, unique=True),
+            field=models.CharField(
+                default=uuid.uuid4, max_length=36, primary_key=True,
+                serialize=False, unique=True),
         ),
         migrations.AlterField(
             model_name='iceuserprofile',
             name='uuid',
-            field=models.CharField(default=uuid.uuid4, max_length=36, unique=True),
+            field=models.CharField(
+                default=uuid.uuid4, max_length=36, unique=True),
         ),
         migrations.AlterField(
             model_name='invitation',
             name='uuid',
-            field=models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False),
+            field=models.CharField(
+                default=uuid.uuid4, max_length=36, primary_key=True,
+                serialize=False),
         ),
         migrations.AlterField(
             model_name='nextstep',
             name='uuid',
-            field=models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False),
+            field=models.CharField(
+                default=uuid.uuid4, max_length=36, primary_key=True,
+                serialize=False),
         ),
         migrations.AlterField(
             model_name='notification',
             name='uuid',
-            field=models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False, unique=True),
+            field=models.CharField(
+                default=uuid.uuid4, max_length=36, primary_key=True,
+                serialize=False, unique=True),
         ),
         migrations.AlterField(
             model_name='recentengagement',
             name='uuid',
-            field=models.CharField(default=uuid.uuid4, max_length=64, primary_key=True, serialize=False),
+            field=models.CharField(
+                default=uuid.uuid4, max_length=64, primary_key=True,
+                serialize=False),
         ),
         migrations.AlterField(
             model_name='role',
             name='uuid',
-            field=models.CharField(default=uuid.uuid4, max_length=36, unique=True),
+            field=models.CharField(
+                default=uuid.uuid4, max_length=36, unique=True),
         ),
         migrations.AlterField(
             model_name='vendor',
             name='uuid',
-            field=models.CharField(default=uuid.uuid4, max_length=36, unique=True),
+            field=models.CharField(
+                default=uuid.uuid4, max_length=36, unique=True),
         ),
         migrations.AlterField(
             model_name='vf',
             name='uuid',
-            field=models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False, unique=True),
+            field=models.CharField(
+                default=uuid.uuid4, max_length=36, primary_key=True,
+                serialize=False, unique=True),
         ),
         migrations.AlterField(
             model_name='vfc',
             name='uuid',
-            field=models.CharField(default=uuid.uuid4, max_length=36, primary_key=True, serialize=False, unique=True),
+            field=models.CharField(
+                default=uuid.uuid4, max_length=36, primary_key=True,
+                serialize=False, unique=True),
         ),
     ]
index 01d15f5..8cd6eb6 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index cce62bf..86b0c3a 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -53,16 +53,50 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='iceuserprofile',
             name='rgwa_access_key',
-            field=models.CharField(blank=True, max_length=1024, null=True, unique=True),
+            field=models.CharField(
+                blank=True,
+                max_length=1024,
+                null=True,
+                unique=True),
         ),
         migrations.AddField(
             model_name='iceuserprofile',
             name='rgwa_secret_key',
-            field=models.CharField(blank=True, max_length=1024, null=True, unique=True),
+            field=models.CharField(
+                blank=True,
+                max_length=1024,
+                null=True,
+                unique=True),
         ),
         migrations.AlterField(
             model_name='activity',
             name='activity_type',
-            field=models.CharField(choices=[('user_joined_eng', 'user_joined_eng'), ('ssh_key_added', 'ssh_key_added'), ('eng_validation_request', 'eng_validation_request'), ('update_next_steps', 'update_next_steps'), ('vfc', 'vfc'), ('change_checklist_state', 'change_checklist_state'), ('vf_provisioning_event', 'vf_provisioning_event'), ('test_finished_event', 'test_finished_event'), ('change_engagement_stage', 'change_engagement_stage'), ('add_next_steps', 'add_next_steps'), ('delete_next_steps', 'delete_next_steps'), ('notice_empty_engagement', 'notice_empty_engagement')], max_length=36),
+            field=models.CharField(
+                choices=[
+                    ('user_joined_eng',
+                     'user_joined_eng'),
+                    ('ssh_key_added',
+                     'ssh_key_added'),
+                    ('eng_validation_request',
+                     'eng_validation_request'),
+                    ('update_next_steps',
+                     'update_next_steps'),
+                    ('vfc',
+                     'vfc'),
+                    ('change_checklist_state',
+                     'change_checklist_state'),
+                    ('vf_provisioning_event',
+                     'vf_provisioning_event'),
+                    ('test_finished_event',
+                     'test_finished_event'),
+                    ('change_engagement_stage',
+                     'change_engagement_stage'),
+                    ('add_next_steps',
+                     'add_next_steps'),
+                    ('delete_next_steps',
+                     'delete_next_steps'),
+                    ('notice_empty_engagement',
+                     'notice_empty_engagement')],
+                max_length=36),
         ),
     ]
index 7c85b6c..b37d84f 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 71deb84..0b84172 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -45,7 +45,9 @@ from django.db.models.signals import post_save
 from django.utils import timezone
 from django.utils.timezone import timedelta
 from engagementmanager.service.logging_service import LoggingServiceFactory
-from engagementmanager.utils.constants import EngagementStage, ActivityType, NextStepType, CheckListState, CheckListCategory, CheckListDecisionValue, CheckListLineType, \
+from engagementmanager.utils.constants import EngagementStage, ActivityType, \
+    NextStepType, CheckListState, CheckListCategory, CheckListDecisionValue, \
+    CheckListLineType, \
     RecentEngagementActionType, NextStepState
 
 
@@ -188,21 +190,45 @@ class Engagement(models.Model):
     engagement_team = models.ManyToManyField(
         IceUserProfile, related_name='members')
     creator = models.ForeignKey(
-        IceUserProfile, on_delete=models.PROTECT, null=True, blank=True, related_name='Engagement_creator')
+        IceUserProfile,
+        on_delete=models.PROTECT,
+        null=True,
+        blank=True,
+        related_name='Engagement_creator')
     contact_user = models.ForeignKey(
-        IceUserProfile, on_delete=models.PROTECT, null=True, blank=True, related_name='Engagement_contact_user')
+        IceUserProfile,
+        on_delete=models.PROTECT,
+        null=True,
+        blank=True,
+        related_name='Engagement_contact_user')
     engagement_manual_id = models.CharField(
-        max_length=36, null=False, blank=False, default=-1, db_index=True)  # index in favor of dashboard search
+        max_length=36,
+        null=False,
+        blank=False,
+        default=-1,
+        db_index=True)  # index in favor of dashboard search
     progress = models.IntegerField(default=0)
     target_completion_date = models.DateField(
         null=True, blank=True, default=get_default_target_completion_date)
-    engagement_stage = models.CharField(max_length=15, default=EngagementStage.Intake.name, choices=EngagementStage.choices(
-    ), db_index=True)  # Can be: Intake, Active, Validated, Completed @UndefinedVariable
+    engagement_stage = models.CharField(
+        max_length=15,
+        default=EngagementStage.Intake.name,
+        choices=EngagementStage.choices(),
+        db_index=True)
+    # Can be: Intake, Active, Validated, Completed @UndefinedVariable
     create_time = models.DateTimeField('creation time', default=timezone.now)
     peer_reviewer = models.ForeignKey(
-        IceUserProfile, on_delete=models.PROTECT, null=True, blank=True, related_name='Engagement_peer_reviewer')
+        IceUserProfile,
+        on_delete=models.PROTECT,
+        null=True,
+        blank=True,
+        related_name='Engagement_peer_reviewer')
     reviewer = models.ForeignKey(
-        IceUserProfile, on_delete=models.PROTECT, null=True, blank=True, related_name='Engagement_el_reviewer')
+        IceUserProfile,
+        on_delete=models.PROTECT,
+        null=True,
+        blank=True,
+        related_name='Engagement_el_reviewer')
     starred_engagement = models.ManyToManyField(
         IceUserProfile, default=None, blank=True)
     heat_validated_time = models.DateTimeField(
@@ -239,7 +265,11 @@ class EngagementStatus(models.Model):
     engagement = models.ForeignKey(Engagement, on_delete=models.PROTECT)
     description = models.CharField(max_length=256)
     creator = models.ForeignKey(
-        IceUserProfile, on_delete=models.PROTECT, null=True, blank=True, related_name='status_creator')
+        IceUserProfile,
+        on_delete=models.PROTECT,
+        null=True,
+        blank=True,
+        related_name='status_creator')
     create_time = models.DateTimeField(default=timezone.now)
     update_time = models.DateTimeField(default=timezone.now)
 
@@ -261,7 +291,10 @@ class Activity(models.Model):
     metadata = models.CharField(max_length=1024)
 
     def __str__(self):
-        return 'Activity created at ' + str(self.create_time) + ', Description: ' + self.description + ', Notification:' + str(self.is_notification) + ', ActivityType=' + str(self.activity_type)
+        return 'Activity created at ' + str(self.create_time) \
+            + ', Description: ' + self.description + \
+            ', Notification:' + str(self.is_notification) + \
+            ', ActivityType=' + str(self.activity_type)
 
     class Meta:
         ordering = ['-create_time']
@@ -279,7 +312,8 @@ class Notification(models.Model):
     activity = models.ForeignKey(Activity, on_delete=models.CASCADE, null=True)
 
     def __str__(self):
-        return str(self.user) + ' ' + str(self.is_sent) + ' ' + str(self.is_read)
+        return str(self.user) + ' ' + str(self.is_sent) + \
+            ' ' + str(self.is_read)
 
     class Meta:
         db_table = "ice_notification"
@@ -296,7 +330,9 @@ class Feedback(models.Model):
     description = models.TextField('feedback_description')
 
     def __str__(self):
-        return 'Feedback created at ' + str(self.create_time) + ' ' + str(self.user) + ', Description: ' + self.description
+        return 'Feedback created at ' + \
+            str(self.create_time) + ' ' + str(self.user) + \
+            ', Description: ' + self.description
 
     class Meta:
         db_table = "ice_feedback"
@@ -331,7 +367,10 @@ class VF(models.Model):
         DeploymentTarget, on_delete=models.SET_NULL, null=True, blank=True)
     ecomp_release = models.ForeignKey(ECOMPRelease, null=True, blank=False)
     deployment_target_sites = models.ManyToManyField(
-        DeploymentTargetSite, default=None, blank=True, related_name='DeployTarget_sites')
+        DeploymentTargetSite,
+        default=None,
+        blank=True,
+        related_name='DeployTarget_sites')
     is_service_provider_internal = models.BooleanField(default=False)
     vendor = models.ForeignKey(Vendor, on_delete=models.PROTECT)
     git_repo_url = models.CharField(max_length=512, blank=False, default=-1)
@@ -341,8 +380,10 @@ class VF(models.Model):
     def jenkins_job_name(self):
         if not self.engagement.engagement_manual_id:
             raise ValueError(
-                "engagement_manual_id (%s) is not valid for jenkins job name" % self.engagement.engagement_manual_id)
-        return "{self.name}_{self.engagement.engagement_manual_id}".format(self=self)
+                "engagement_manual_id (%s) is not valid for jenkins job name" %
+                self.engagement.engagement_manual_id)
+        return "{self.name}_{self.engagement.engagement_manual_id}".format(
+            self=self)
 
     def __str__(self):
         return self.name
@@ -362,7 +403,11 @@ class VFC(models.Model):
     company = models.ForeignKey(Vendor, on_delete=SET_NULL, null=True)
     create_time = models.DateTimeField('creation time', default=timezone.now)
     creator = models.ForeignKey(
-        IceUserProfile, on_delete=models.PROTECT, null=True, blank=True, related_name='Vfc_creator')
+        IceUserProfile,
+        on_delete=models.PROTECT,
+        null=True,
+        blank=True,
+        related_name='Vfc_creator')
 
     def __str__(self):
         return self.name
@@ -393,8 +438,10 @@ class ChecklistTemplate(models.Model):  # Reference Table
     uuid = models.CharField(
         default=uuid.uuid4, max_length=36, primary_key=True)
     name = models.CharField('template name', max_length=255)
-    category = models.CharField(max_length=36, choices=CheckListCategory.choices(
-    ), default=CheckListCategory.overall.name)  # @UndefinedVariable
+    category = models.CharField(
+        max_length=36,
+        choices=CheckListCategory.choices(),
+        default=CheckListCategory.overall.name)  # @UndefinedVariable
     version = models.IntegerField('template version')
     create_time = models.DateTimeField('creation time', default=timezone.now)
     update_time = models.DateTimeField(
@@ -435,8 +482,10 @@ class ChecklistLineItem(models.Model):  # Reference Table
     name = models.CharField('line name', max_length=255)
     weight = models.FloatField('line weight')
     description = models.TextField('line description')
-    line_type = models.CharField(max_length=36, choices=CheckListLineType.choices(
-    ), default=CheckListLineType.auto.name)  # @UndefinedVariable
+    line_type = models.CharField(
+        max_length=36,
+        choices=CheckListLineType.choices(),
+        default=CheckListLineType.auto.name)  # @UndefinedVariable
     validation_instructions = models.TextField('line validation instructions')
     create_time = models.DateTimeField('creation time', default=timezone.now)
     update_time = models.DateTimeField(
@@ -447,9 +496,13 @@ class ChecklistLineItem(models.Model):  # Reference Table
         ChecklistSection, on_delete=models.CASCADE, null=False, blank=False)
 
     def save(self, *args, **kwargs):
-        if (self.template != self.section.template != None):
-            raise ValueError("ChecklistLineItem can't be saved/updated since the template " +
-                             self.template.name + " is not equal to its section's template " + self.section.template.name)
+        if (self.template != self.section.template is not None):
+            raise ValueError(
+                "ChecklistLineItem can't be saved/updated \
+                since the template " +
+                self.template.name +
+                " is not equal to its section's template " +
+                self.section.template.name)
         super(ChecklistLineItem, self).save(*args, **kwargs)
 
     def __str__(self):
@@ -478,10 +531,14 @@ class Checklist(models.Model):
     template = models.ForeignKey(ChecklistTemplate, on_delete=models.PROTECT)
     # The EL that opened the modal.
     creator = models.ForeignKey(
-        IceUserProfile, on_delete=models.CASCADE, related_name='checklist_creator')
+        IceUserProfile,
+        on_delete=models.CASCADE,
+        related_name='checklist_creator')
     # The user who currently validates the checklist
     owner = models.ForeignKey(
-        IceUserProfile, on_delete=models.CASCADE, related_name='checklist_owner')
+        IceUserProfile,
+        on_delete=models.CASCADE,
+        related_name='checklist_owner')
 
     def __str__(self):
         return self.name + ' ' + self.state
@@ -495,11 +552,16 @@ class NextStep(models.Model):
         default=uuid.uuid4, max_length=36, primary_key=True)
     create_time = models.DateTimeField('creation time', default=timezone.now)
     creator = models.ForeignKey(
-        IceUserProfile, on_delete=models.PROTECT, related_name="NextStep_creator")
+        IceUserProfile,
+        on_delete=models.PROTECT,
+        related_name="NextStep_creator")
     last_update_time = models.DateTimeField(
         'last update time', default=timezone.now)
     last_updater = models.ForeignKey(
-        IceUserProfile, on_delete=models.PROTECT, null=True, related_name="NextStep_last_updater")
+        IceUserProfile,
+        on_delete=models.PROTECT,
+        null=True,
+        related_name="NextStep_last_updater")
     # Can be: Modified, Added, Completed, Denied
     last_update_type = models.CharField(max_length=15, default='Added')
     position = models.IntegerField()
@@ -514,15 +576,18 @@ class NextStep(models.Model):
         Engagement, on_delete=models.PROTECT, null=True, blank=True)
     owner = models.ForeignKey(
         IceUserProfile, on_delete=models.PROTECT, null=True, blank=True)
-    next_step_type = models.CharField(max_length=36, choices=NextStepType.choices(
-    ), default=NextStepType.user_defined.name)  # @UndefinedVariable
+    next_step_type = models.CharField(
+        max_length=36,
+        choices=NextStepType.choices(),
+        default=NextStepType.user_defined.name)  # @UndefinedVariable
     files = models.TextField('list of files', null=True)
     assignees = models.ManyToManyField(
         IceUserProfile, related_name='assignees')
     due_date = models.DateField('due_date', null=True)
 
     def __str__(self):
-        return self.engagement_stage + ' ' + self.state + ' ' + self.description
+        return self.engagement_stage + ' ' + self.state + \
+            ' ' + self.description
 
     class Meta:
         db_table = "ice_next_step"
@@ -535,9 +600,10 @@ class ChecklistDecision(models.Model):
     uuid = models.CharField(
         default=uuid.uuid4, max_length=36, primary_key=True)
     review_value = models.CharField(
-        max_length=36, choices=CheckListDecisionValue.choices())  # @UndefinedVariable
+        max_length=36,
+        choices=CheckListDecisionValue.choices())
     peer_review_value = models.CharField(
-        max_length=36, choices=CheckListDecisionValue.choices())  # @UndefinedVariable
+        max_length=36, choices=CheckListDecisionValue.choices())
     create_time = models.DateTimeField('creation time', default=timezone.now)
     update_time = models.DateTimeField(
         'last update time', null=True, blank=True)
@@ -546,19 +612,33 @@ class ChecklistDecision(models.Model):
     lineitem = models.ForeignKey(ChecklistLineItem, on_delete=models.CASCADE)
 
     def save(self, *args, **kwargs):
-        if (self.template != self.checklist.template != None):
-            raise ValueError("ChecklistDecision can't be saved/updated since the template " +
-                             self.template.name + " is not equal to its checklist's template " + self.checklist.template.name)
-        if (self.template != self.lineitem.section.template != None):
-            raise ValueError("ChecklistDecision can't be saved/updated since the template " + self.template.name +
-                             " is not equal to its lineitem/section's template " + self.lineitem.section.template)
-        if (self.checklist.template != self.lineitem.section.template != None):
-            raise ValueError("ChecklistDecision can't be saved/updated since its checklist's template " +
-                             self.checklist.template + " is not equal to its lineitem/section's template " + self.lineitem.section.template)
+        if (self.template != self.checklist.template is not None):
+            raise ValueError(
+                "ChecklistDecision can't be saved/updated \
+                since the template " +
+                self.template.name +
+                " is not equal to its checklist's template " +
+                self.checklist.template.name)
+        if (self.template != self.lineitem.section.template is not None):
+            raise ValueError(
+                "ChecklistDecision can't be saved/updated \
+                since the template " +
+                self.template.name +
+                " is not equal to its lineitem/section's template " +
+                self.lineitem.section.template)
+        if (self.checklist.template != self.lineitem.section.template
+                is not None):
+            raise ValueError(
+                "ChecklistDecision can't be saved/updated since \
+                its checklist's template " +
+                self.checklist.template +
+                " is not equal to its lineitem/section's template " +
+                self.lineitem.section.template)
         super(ChecklistDecision, self).save(*args, **kwargs)
 
     def __str__(self):
-        return 'decision:' + self.uuid + ' ' + self.template.name + ' ' + self.review_value + ' ' + self.peer_review_value
+        return 'decision:' + self.uuid + ' ' + self.template.name + \
+            ' ' + self.review_value + ' ' + self.peer_review_value
 
     class Meta:
         db_table = "ice_checklist_decision"
@@ -581,9 +661,11 @@ class ChecklistAuditLog(models.Model):
         ChecklistDecision, on_delete=models.CASCADE, null=True, blank=True)
 
     def save(self, *args, **kwargs):
-        if (self.checklist != None and self.decision != None):
+        if (self.checklist is not None and self.decision is not None):
             raise ValueError(
-                "ChecklistAuditLog can't be attached to both checklist and decision. Please remove one of them and retry the operation")
+                "ChecklistAuditLog can't be attached \
+                to both checklist and decision. Please \
+                remove one of them and retry the operation")
         super(ChecklistAuditLog, self).save(*args, **kwargs)
 
     def __str__(self):
@@ -602,13 +684,17 @@ class Invitation(models.Model):
         max_length=64, null=False, blank=False, db_index=True)
     email = models.CharField(max_length=255, null=False, blank=False)
     invitation_token = models.CharField(
-        max_length=1024, null=False, blank=False, db_index=True)  # index in favor of signup
+        max_length=1024,
+        null=False,
+        blank=False,
+        db_index=True)  # index in favor of signup
     accepted = models.BooleanField(default=False)
     create_time = models.DateTimeField(
         'invitation creation time', default=timezone.now)
 
     def __str__(self):
-        return "Invite from " + self.invited_by_user_uuid + " to " + self.email + " for joining engagement " + self.engagement_uuid
+        return "Invite from " + self.invited_by_user_uuid + " to " + \
+            self.email + " for joining engagement " + self.engagement_uuid
 
     class Meta:
         db_table = "ice_invitation"
index 3fee019..2355304 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -51,28 +51,33 @@ default_next_steps = [
     {
         'position': 2,
         'stage': 'Intake',
-        'text': 'Please work with your Engagement Lead (EL) to complete the necessary trial agreements.',
+        'text': 'Please work with your Engagement Lead (EL) to complete the ' +
+        'necessary trial agreements.',
         'condition': lambda x, y: True,
         'type': NextStepType.trial_agreements.name  # @UndefinedVariable
     },
     {
         'position': 3,
         'stage': 'Intake',
-        'text': 'Please add your ' + Constants.service_provider_company_name + ' sponsor or vendor contact information.',
+        'text': 'Please add your ' + Constants.service_provider_company_name\
+        + ' sponsor or vendor contact information.',
         'condition': lambda user, eng: False if (eng.contact_user) else True,
         'type': NextStepType.add_contact_person.name  # @UndefinedVariable
     },
     {
         'position': 1,
         'stage': 'Active',
-        'text': 'Please submit the first version of the VF package. If you have any problems or questions, please contact your Engagement Lead (EL)',
+        'text': 'Please submit the first version of the VF package.' +\
+        'If you have any problems or questions,' +\
+        'please contact your Engagement Lead (EL)',
         'condition': lambda x, y: True,
         'type': NextStepType.submit_vf_package.name  # @UndefinedVariable
     },
     {
         'position': 1,
         'stage': 'Validated',
-        'text': 'Please schedule a time with your Engagement Lead (EL) to complete the handoff.',
+        'text': 'Please schedule a time with your Engagement Lead (EL)' +\
+        'to complete the handoff.',
         'condition': lambda x, y: True,
         'type': NextStepType.el_handoff.name  # @UndefinedVariable
     }
@@ -83,18 +88,28 @@ def create_default_next_steps_for_user(user, el_user):
     """
     This method is for personal default next step only since it has an owner
     """
-    def cond(user): return False if (user.ssh_public_key and user.ssh_public_key != '') else True
+    def cond(user): return False if (
+        user.ssh_public_key and user.ssh_public_key != '') else True
     if cond(user):
         desc = "Please add your SSH key to be able to contribute."
-        nextstep = NextStep.objects.create(creator=el_user, last_updater=el_user, position=1, description=desc, last_update_type='Added', state='Incomplete',
-                                           engagement_stage='Intake', engagement=None, owner=user, next_step_type=NextStepType.set_ssh.name, due_date=timezone.now() + timedelta(days=1))  # @UndefinedVariable
+        nextstep = NextStep.objects.create(
+            creator=el_user,
+            last_updater=el_user, position=1,
+            description=desc,
+            last_update_type='Added',
+            state='Incomplete',
+            engagement_stage='Intake',
+            engagement=None, owner=user,
+            next_step_type=NextStepType.set_ssh.name,
+            due_date=timezone.now() + timedelta(days=1))
         nextstep.assignees.add(user)
         nextstep.save()
 
 
 def create_default_next_steps(user, engagement, el_user):
     """
-    This method is for non-personal default next step only since it doesn't have an owner
+    This method is for non-personal default next step \
+    only since it doesn't have an owner
     """
     for step in default_next_steps:
         cond = step['condition']
@@ -104,10 +119,17 @@ def create_default_next_steps(user, engagement, el_user):
             if (user.company == Constants.service_provider_company):
                 desc = desc.replace('$Contact', 'Vendor Contact')
             else:
-                desc = desc.replace('$Contact', Constants.service_provider_company_name + ' Sponsor Contact')
+                desc = desc.replace(
+                    '$Contact', Constants.service_provider_company_name
+                    + ' Sponsor Contact')
             logger.debug('Creating default next step : ' + desc)
-            nextstep = NextStep.objects.create(creator=el_user, last_updater=el_user, position=step['position'], description=desc, state='Incomplete', engagement_stage=step[
-                                               'stage'], engagement=engagement, next_step_type=ns_type, due_date=timezone.now() + timedelta(days=1))
+            nextstep = NextStep.objects.create(
+                creator=el_user,
+                last_updater=el_user, position=step['position'],
+                description=desc, state='Incomplete',
+                engagement_stage=step['stage'],
+                engagement=engagement, next_step_type=ns_type,
+                due_date=timezone.now() + timedelta(days=1))
             nextstep.assignees.add(el_user)
             nextstep.save()
         else:
index 59f2e1f..ce2676d 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -45,7 +45,8 @@ logger = LoggingServiceFactory.get_logger()
 
 def num_of_notifications_for_user(user_uuid):
     user = IceUserProfile.objects.get(uuid=user_uuid)
-    amountOfnotificationForUser = Notification.objects.filter(user=user, is_read=False).filter().count()
+    amountOfnotificationForUser = Notification.objects.filter(
+        user=user, is_read=False).filter().count()
     return amountOfnotificationForUser
 
 
@@ -53,7 +54,9 @@ def pull_recent_notifications(user_uuid, offset, limit):
     ModifiedNotificationsSet = []
     logger.debug("Pulling unread notifications from DB")
     user = IceUserProfile.objects.get(uuid=user_uuid)
-    notificationsList = Notification.objects.filter(user=user).order_by('is_read', '-activity__create_time')[int(offset):int(offset) + int(limit)]
+    notificationsList = Notification.objects.filter(user=user).order_by(
+        'is_read', '-activity__create_time')[
+            int(offset):int(offset) + int(limit)]
     num_of_objects = Notification.objects.filter(user=user).count()
     for notif in notificationsList:
         serializedNotification = ThinNotificationModelSerializer(notif).data
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 3499b95..ed6c4d5 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -48,8 +48,10 @@ from engagementmanager.decorator.log_func_entry import logFuncEntry
 from engagementmanager.models import IceUserProfile
 from engagementmanager.rest.vvp_api_view import VvpApiView
 from engagementmanager.utils.constants import Constants
-from engagementmanager.utils.vvp_exceptions import VvpObjectNotAvailable, VvpGeneralException, VvpBadRequest
-from engagementmanager.views_helper import generateActivationLink, getFirstEngByUser
+from engagementmanager.utils.vvp_exceptions \
+    import VvpObjectNotAvailable, VvpGeneralException, VvpBadRequest
+from engagementmanager.views_helper \
+    import generateActivationLink, getFirstEngByUser
 from engagementmanager.vm_integration import vm_client
 from engagementmanager.service.logging_service import LoggingServiceFactory
 
@@ -63,8 +65,9 @@ class ResendActivationMail(VvpApiView):
     def get(self, request, user_uuid, format=None):
         ice_user_obj = IceUserProfile.objects.get(uuid=user_uuid)
 
-        data = {'activation_link': generateActivationLink(ice_user_obj.user.activation_token, ice_user_obj),
-                'full_name': ice_user_obj.full_name}
+        data = {'activation_link': generateActivationLink(
+            ice_user_obj.user.activation_token, ice_user_obj),
+            'full_name': ice_user_obj.full_name}
 
         # updating the activation time
         ice_user_obj.user.activation_token_create_time = timezone.now()
@@ -72,10 +75,12 @@ class ResendActivationMail(VvpApiView):
         ice_user_obj.save()
         self.logger.debug("Activation Link: " + data['activation_link'])
 
-        body = get_template("{activate_template_dir}activate_mail_body.html".format(
-            activate_template_dir=Constants.activate_template_dir))
-        subject = get_template("{activate_template_dir}activate_mail_subject.html".format(
-            activate_template_dir=Constants.activate_template_dir))
+        body = get_template(
+            "{activate_template_dir}activate_mail_body.html".format(
+                activate_template_dir=Constants.activate_template_dir))
+        subject = get_template(
+            "{activate_template_dir}activate_mail_subject.html".format(
+                activate_template_dir=Constants.activate_template_dir))
         mail.sendMail(ice_user_obj.email, data, body, subject)
 
         return Response()
@@ -98,18 +103,22 @@ class ActivateUser(VvpApiView):
 
         if user.activation_token != kwargs['token']:
             raise VvpBadRequest(
-                "User's activation token is not equal to the token in the activation path param.")
+                "User's activation token is not equal to the \
+                token in the activation path param.")
 
         created = user.activation_token_create_time
         current = timezone.now()
-        if created.year == current.year and created.month == current.month and (created.day == current.day or
-                                                                                created.day == current.day - 1):
+        if created.year == current.year and created.month == current.month \
+            and (created.day == current.day or
+                 created.day == current.day - 1):
             delta = current - created
-            if abs(delta).total_seconds() / 3600.0 <= settings.TOKEN_EXPIRATION_IN_HOURS:
+            if abs(delta).total_seconds() / 3600.0 <= \
+                    settings.TOKEN_EXPIRATION_IN_HOURS:
                 user.is_active = True
                 user.save()
                 self.logger.debug(
-                    "User " + user_profile.full_name + " is activated successfully, redirecting to Login")
+                    "User " + user_profile.full_name + " is activated successfully, \
+                    redirecting to Login")
                 user = IceUserProfile.objects.get(email=user.email)
                 eng = getFirstEngByUser(user)
                 result = {'activation_success': True, }
@@ -119,5 +128,5 @@ class ActivateUser(VvpApiView):
                 return Response(result)
         else:
             raise SignatureExpired("User's activation token expired.")
-        
+
         return Response({'activation_success': False, })
index 47b4cc7..e2502da 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -60,6 +60,7 @@ class PullActivities(VvpApiView):
         if not num:
             num = settings.NUMBER_OF_POLLED_ACTIVITIES
         eng = Engagement.objects.get(uuid=request_data_mgr.get_eng_uuid())
-        activities = self.activities_service.pull_recent_activities(eng, recent_activities_limit=num)
+        activities = self.activities_service.pull_recent_activities(
+            eng, recent_activities_limit=num)
         serializer = ActivityModelSerializer(activities, many=True)
         return Response(serializer.data)
index 200dcaa..daa69e2 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -36,8 +36,6 @@
 # ============LICENSE_END============================================
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
-import json
-
 from rest_framework.response import Response
 from rest_framework.status import HTTP_400_BAD_REQUEST,\
     HTTP_500_INTERNAL_SERVER_ERROR
@@ -71,8 +69,9 @@ class NewCheckList(VvpApiView):
         data = request.data
 
         if ('checkListName' not in data or not data['checkListName'] or
-           'checkListTemplateUuid' not in data or not data['checkListTemplateUuid'] or
-           'checkListAssociatedFiles' not in data):
+            'checkListTemplateUuid' not in data or
+            not data['checkListTemplateUuid'] or
+                'checkListAssociatedFiles' not in data):
             msg = "One of the CheckList's input parameters is missing"
             self.logger.error(msg)
             return Response(msg, status=HTTP_400_BAD_REQUEST)
@@ -83,7 +82,8 @@ class NewCheckList(VvpApiView):
             return Response(msg, status=HTTP_400_BAD_REQUEST)
 
         data = CheckListSvc().createOrUpdateChecklist(
-            data['checkListName'], data['checkListTemplateUuid'], data['checkListAssociatedFiles'], None)
+            data['checkListName'], data['checkListTemplateUuid'],
+            data['checkListAssociatedFiles'], None)
 
         return Response(data)
 
@@ -107,9 +107,10 @@ class ExistingCheckList(VvpApiView):
     def put(self, request, checklistUuid):
         data = request.data
         if ('checklistUuid' not in data or not data['checklistUuid'] or
-           'checkListName' not in data or not data['checkListName'] or
-           'checkListTemplateUuid' not in data or not data['checkListTemplateUuid'] or
-           'checkListAssociatedFiles' not in data):
+            'checkListName' not in data or not data['checkListName'] or
+            'checkListTemplateUuid' not in data or
+            not data['checkListTemplateUuid'] or
+                'checkListAssociatedFiles' not in data):
             msg = "One of the CheckList's input parameters is missing"
             self.logger.error(msg)
             return Response(msg, status=HTTP_400_BAD_REQUEST)
@@ -119,7 +120,8 @@ class ExistingCheckList(VvpApiView):
             return Response(msg, status=HTTP_400_BAD_REQUEST)
 
         data = CheckListSvc().createOrUpdateChecklist(
-            data['checkListName'], data['checkListTemplateUuid'], data['checkListAssociatedFiles'], data['checklistUuid'])
+            data['checkListName'], data['checkListTemplateUuid'],
+            data['checkListAssociatedFiles'], data['checklistUuid'])
 
         return Response(data)
 
index 4b86a33..62aafdf 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -36,7 +36,6 @@
 # ============LICENSE_END============================================
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
-import json
 
 from rest_framework.response import Response
 
@@ -46,8 +45,9 @@ from engagementmanager.decorator.log_func_entry import logFuncEntry
 from engagementmanager.models import ChecklistDecision, Checklist
 from engagementmanager.rest.vvp_api_view import VvpApiView
 from engagementmanager.service.authorization_service import Permissions
-from engagementmanager.service.checklist_audit_log_service import getAuditLogsWithChecklist, \
-    addAuditLogToChecklist, getAuditLogsWithDecision, addAuditLogToDecision
+from engagementmanager.service.checklist_audit_log_service \
+    import getAuditLogsWithChecklist, addAuditLogToChecklist, \
+    getAuditLogsWithDecision, addAuditLogToDecision
 from engagementmanager.utils.request_data_mgr import request_data_mgr
 
 
@@ -68,7 +68,8 @@ class ChecklistAuditLog(VvpApiView):
         checklistUuid = request_data_mgr.get_cl_uuid()
 
         if ('description' not in data or not data['description']):
-            msg = "description for the audit log is not provided in the request's body"
+            msg = "description for the audit log is " +\
+                "not provided in the request's body"
             self.logger.error(msg)
             raise KeyError(msg)
         description = data['description']
index a0cfe01..5a965de 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -46,7 +46,8 @@ from engagementmanager.decorator.class_decorator import classDecorator
 from engagementmanager.decorator.log_func_entry import logFuncEntry
 from engagementmanager.rest.vvp_api_view import VvpApiView
 from engagementmanager.service.authorization_service import Permissions
-from engagementmanager.service.checklist_decision_service import setDecision, getDecision
+from engagementmanager.service.checklist_decision_service import setDecision, \
+    getDecision
 from engagementmanager.utils.request_data_mgr import request_data_mgr
 
 
index e9c6eb3..ceadf18 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -59,9 +59,13 @@ class ChecklistState(VvpApiView):
         decline = data['decline']
         if decline == "True":
             checklist = set_state(True, request_data_mgr.get_cl_uuid(),
-                                  isMoveToAutomation=False, description=data['description'])
+                                  isMoveToAutomation=False,
+                                  description=data['description'])
         else:
-            checklist = set_state(False, request_data_mgr.get_cl_uuid(), description=data['description'])
+            checklist = set_state(
+                False, request_data_mgr.get_cl_uuid(),
+                description=data['description'])
 
-        cldata = json.dumps(SuperThinChecklistModelSerializer(checklist).data, ensure_ascii=False)
+        cldata = json.dumps(SuperThinChecklistModelSerializer(
+            checklist).data, ensure_ascii=False)
         return Response(cldata)
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index efe0b4e..bef4962 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 17e33fb..d808156 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -47,11 +47,12 @@ from engagementmanager.service.cms.posts_service import CMSPostsService
 @classDecorator([logFuncEntry])
 class Posts(VvpApiView):
 
-    def get(self, request, format=None, **kwargs):
+    def get(self, request):
         categoryParam = request.GET.get('category', "")
         limitParam = request.GET.get('limit', 5)
         offsetParam = request.GET.get('offset', 0)
         fromLastDaysParam = request.GET.get('fromLastDays', None)
 
-        posts = CMSPostsService().getPosts(offsetParam, limitParam, fromLastDaysParam, categoryParam)
+        posts = CMSPostsService().getPosts(offsetParam, limitParam,
+                                           fromLastDaysParam, categoryParam)
         return Response(posts)
index 89a6243..ac26492 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 11e8dfc..7ee7e70 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -36,7 +36,6 @@
 # ============LICENSE_END============================================
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
-import json
 from uuid import uuid4
 
 from django.utils import timezone
@@ -56,17 +55,27 @@ class EngLeadsDataLoader(VvpApiView):
 
     def get(self, request):
         data = request.data
-        service_provider_company = Vendor.objects.get(name=Constants.service_provider_company_name)
+        service_provider_company = Vendor.objects.get(
+            name=Constants.service_provider_company_name)
         el_role = Role.objects.get(name="el")
         for el in data:
             user_object = CustomUser.objects.create_user(
-                username=el['full_name'], email=el['full_name'], password=el['password'], is_active=False, activation_token=uuid4(), activation_token_create_time=timezone.now())
-            data = createUserTemplate(service_provider_company, el['full_name'], el_role, '', True, None, True, user_object)
-            el_user, is_profile_created = IceUserProfile.objects.update_or_create(
-                email=user_object.email, defaults=data)
+                username=el['full_name'], email=el['full_name'],
+                password=el['password'], is_active=False,
+                activation_token=uuid4(),
+                activation_token_create_time=timezone.now())
+            data = createUserTemplate(
+                service_provider_company, el['full_name'], el_role, '',
+                True, None, True, user_object)
+            el_user, is_profile_created = \
+                IceUserProfile.objects.update_or_create(
+                    email=user_object.email, defaults=data)
             self.logger.info("User: " + el_user.full_name +
-                             " was created successfully during bulk_load_engagement_leads function")
-        self.logger.info("All users were created successfully during bulk_load_engagement_leads function")
+                             " was created successfully during \
+                             bulk_load_engagement_leads function")
+        self.logger.info(
+            "All users were created successfully during \
+            bulk_load_engagement_leads function")
         return Response()
 
 
@@ -76,7 +85,12 @@ class CompaniesDataLoader(VvpApiView):
     def get(self, request):
         data = request.data
         for vendor in data:
-            Vendor.objects.get_or_create(name=vendor['name'], defaults={'public': True})
-            self.logger.info('Company found or created during bulk load vendors: ' + logEncoding(vendor))
-        self.logger.info("All companies were created successfully during bulk_load_companies function")
+            Vendor.objects.get_or_create(
+                name=vendor['name'], defaults={'public': True})
+            self.logger.info(
+                'Company found or created during bulk load vendors: '
+                + logEncoding(vendor))
+        self.logger.info(
+            "All companies were created successfully during \
+            bulk_load_companies function")
         return Response()
index c52d9b9..4eaa625 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -45,7 +45,8 @@ from engagementmanager.decorator.log_func_entry import logFuncEntry
 from engagementmanager.models import DeploymentTarget
 from engagementmanager.rest.vvp_api_view import VvpApiView
 from engagementmanager.serializers import DeploymentTargetModelSerializer
-from engagementmanager.service.deploment_target_service import update_deployment_target
+from engagementmanager.service.deploment_target_service \
+    import update_deployment_target
 
 
 @classDecorator([logFuncEntry])
@@ -58,12 +59,16 @@ class DeploymentTargetRESTMethods(VvpApiView):
             update_deployment_target(engagement_uuid, dt_uuid)
             return Response(msg)
         else:
-            msg = "DTarget PUT Request failed, engagement_uuid wasn't found in kwargs or its content is empty, therefore cannot filter by it to find the required VF"
+            msg = "DTarget PUT Request failed, engagement_uuid wasn't found \
+            in kwargs or its content is empty, therefore cannot filter by it \
+            to find the required VF"
             self.logger.error(msg)
             msg = "Action failed."
             return Response(msg, status=HTTP_400_BAD_REQUEST)
 
     def get(self, request):
-        deployment_targets = DeploymentTarget.objects.filter(ui_visibility=True).order_by('weight')
-        serializer = DeploymentTargetModelSerializer(deployment_targets, many=True)
+        deployment_targets = DeploymentTarget.objects.filter(
+            ui_visibility=True).order_by('weight')
+        serializer = DeploymentTargetModelSerializer(
+            deployment_targets, many=True)
         return Response(serializer.data)
index 32ff5a4..748871e 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -44,7 +44,8 @@ from engagementmanager.decorator.class_decorator import classDecorator
 from engagementmanager.decorator.log_func_entry import logFuncEntry
 from engagementmanager.models import VF, DeploymentTargetSite
 from engagementmanager.rest.vvp_api_view import VvpApiView
-from engagementmanager.serializers import ThinDeploymentTargetSiteModelSerializer
+from engagementmanager.serializers import \
+    ThinDeploymentTargetSiteModelSerializer
 from engagementmanager.service.authorization_service import Permissions
 
 
@@ -56,16 +57,19 @@ class DTSites(VvpApiView):
         if vf_uuid:
             vf = VF.objects.get(uuid=vf_uuid)
             dtsites = vf.deployment_target_sites
-            serializer = ThinDeploymentTargetSiteModelSerializer(dtsites, many=True)
+            serializer = ThinDeploymentTargetSiteModelSerializer(
+                dtsites, many=True)
             return Response(serializer.data)
         else:
             dtsites = DeploymentTargetSite.objects.all()
-            serializer = ThinDeploymentTargetSiteModelSerializer(dtsites, many=True)
+            serializer = ThinDeploymentTargetSiteModelSerializer(
+                dtsites, many=True)
             return Response(serializer.data)
 
     """
     expecting: VF object uuid, DeploymentTargetSite uuid
-    result: addition of the DeploymentTargetSite object with dtsite_uuid to the VF's deployment_target_sites
+    result: addition of the DeploymentTargetSite object with dtsite_uuid \
+    to the VF's deployment_target_sites
     """
     @auth(Permissions.add_deployment_target_site)
     def post(self, request):
@@ -76,7 +80,8 @@ class DTSites(VvpApiView):
 
         try:
             dtsite = DeploymentTargetSite.objects.get(name=name)
-            msg = "DTSite was already existed, hence would next be added to the VF's sites list"
+            msg = "DTSite was already existed, hence would next be \
+            added to the VF's sites list"
         except DeploymentTargetSite.DoesNotExist:
             dtsite = DeploymentTargetSite.objects.create(name=name)
             dtsite.save()
index a2585ac..0632ee4 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -38,7 +38,7 @@
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
 from rest_framework.permissions import IsAuthenticated
 from rest_framework.response import Response
-from rest_framework.status import HTTP_400_BAD_REQUEST, HTTP_202_ACCEPTED
+from rest_framework.status import HTTP_400_BAD_REQUEST
 
 from engagementmanager.decorator.class_decorator import classDecorator
 from engagementmanager.decorator.log_func_entry import logFuncEntry
@@ -58,12 +58,15 @@ class ECOMPReleaseRESTMethods(VvpApiView):
             update_ECOMP(engagement_uuid, ecomp_uuid)
             return Response(msg)
         else:
-            msg = "ECOMPRelease PUT Request failed, engagement_uuid wasn't found in kwargs or its content is empty, therefore cannot filter by it to find the required VF"
+            msg = "ECOMPRelease PUT Request failed, engagement_uuid wasn't \
+            found in kwargs or its content is empty, therefore cannot filter \
+            by it to find the required VF"
             self.logger.error(msg)
             msg = "Action failed."
             return Response(msg, status=HTTP_400_BAD_REQUEST)
 
     def get(self, request):
-        ecomp_releases = ECOMPRelease.objects.filter(ui_visibility=True).order_by('weight')
+        ecomp_releases = ECOMPRelease.objects.filter(
+            ui_visibility=True).order_by('weight')
         serializer = ECOMPReleaseModelSerializer(ecomp_releases, many=True)
         return Response(serializer.data)
index 89e74fe..c557cd5 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -51,8 +51,8 @@ from engagementmanager.serializers import VFModelSerializer, \
     EngagementStatusModelSerializer
 from engagementmanager.service.authorization_service import Permissions
 from engagementmanager.service import engagement_service as eng_svc
-from engagementmanager.utils.constants import Roles, RecentEngagementActionType, \
-    CheckListState, EngagementStage
+from engagementmanager.utils.constants import Roles, \
+    RecentEngagementActionType, CheckListState, EngagementStage
 from engagementmanager.utils.request_data_mgr import request_data_mgr
 from engagementmanager.utils.validator import logEncoding
 from rest_framework.response import Response
@@ -69,14 +69,17 @@ class ExpandedEngByUser(VvpApiView):
         if ('stage' not in data or not data['stage']
             or 'keyword' not in data
             or 'offset' not in data or int(data['offset']) < 0
-                or 'limit' not in data or not data['limit'] or (data['limit'] < 1)):
-            msg = "GetExpandedEngByUser - get request: one of the parameters is missing or invalid."
+                or 'limit' not in data or not data['limit'] or
+                (data['limit'] < 1)):
+            msg = "GetExpandedEngByUser - get request: one of the parameters \
+            is missing or invalid."
             self.logger.error(msg)
             msg = "Action was failed due to bad request."
             return Response(msg, status=HTTP_400_BAD_REQUEST)
         user = request_data_mgr.get_user()
         data = eng_svc.get_dashboard_expanded_engs(
-            data['stage'], data['keyword'], data['offset'], data['limit'], user)
+            data['stage'], data['keyword'], data['offset'],
+            data['limit'], user)
         return Response(data)
 
 
@@ -95,7 +98,8 @@ class ExportEngagements(VvpApiView):
         stageParam = request.GET['stage']
         keywordParam = request.GET['keyword']
 
-        # data, status = eng_svc.get_dashboard_expanded_engs(stageParam, keywordParam, 0, sys.maxint, user)
+        # data, status = eng_svc.get_dashboard_expanded_engs
+        # (stageParam, keywordParam, 0, sys.maxint, user)
         vfs, deployment_targets = eng_svc.get_expanded_engs_for_export(
             stageParam, keywordParam, user)
 
@@ -103,92 +107,96 @@ class ExportEngagements(VvpApiView):
         # Create 'Validation Details' sheet and fill it up with required data:
         validationWorkSheet = workbook.create_sheet()
         validationWorkSheet.title = 'Validation Details'
-        headlines = [WriteOnlyCell(validationWorkSheet, value=u"EId"),
-                     WriteOnlyCell(validationWorkSheet, value=u"Engagement"),
-                     WriteOnlyCell(validationWorkSheet, value=u"Reviewer"),
-                     WriteOnlyCell(
-                         validationWorkSheet, value=u"Peer reviewer"),
-                     WriteOnlyCell(validationWorkSheet, value=u"VFC"),
-                     WriteOnlyCell(validationWorkSheet, value=u"VFC #"),
-                     WriteOnlyCell(validationWorkSheet, value=u"Started"),
-                     WriteOnlyCell(validationWorkSheet, value=u"Vendor"),
-                     WriteOnlyCell(validationWorkSheet, value=u"AIC Version"),
-                     WriteOnlyCell(
-                         validationWorkSheet, value=u"ECOMP Release"),
-                     WriteOnlyCell(validationWorkSheet, value=u"Validate"),
-                     WriteOnlyCell(validationWorkSheet, value=u"Completed"),
-                     WriteOnlyCell(validationWorkSheet, value=u"Stage"),
-                     WriteOnlyCell(
-                         validationWorkSheet, value=u"Heat Pre-validated"),
-                     WriteOnlyCell(validationWorkSheet, value=u"Image Scan"),
-                     WriteOnlyCell(
-                         validationWorkSheet, value=u"AIC Instantiated"),
-                     WriteOnlyCell(
-                         validationWorkSheet, value=u"ASDC Onboarded"),
-                     WriteOnlyCell(
-                         validationWorkSheet, value=u"Overall Progress in %"),
-                     WriteOnlyCell(
-                         validationWorkSheet, value=u"Target Completion Date"),
-                     WriteOnlyCell(validationWorkSheet, value=u"Status")]
+        headlines = [
+            WriteOnlyCell(validationWorkSheet, value=u"EId"),
+            WriteOnlyCell(validationWorkSheet, value=u"Engagement"),
+            WriteOnlyCell(validationWorkSheet, value=u"Reviewer"),
+            WriteOnlyCell(
+                validationWorkSheet, value=u"Peer reviewer"),
+            WriteOnlyCell(validationWorkSheet, value=u"VFC"),
+            WriteOnlyCell(validationWorkSheet, value=u"VFC #"),
+            WriteOnlyCell(validationWorkSheet, value=u"Started"),
+            WriteOnlyCell(validationWorkSheet, value=u"Vendor"),
+            WriteOnlyCell(validationWorkSheet, value=u"AIC Version"),
+            WriteOnlyCell(
+                validationWorkSheet, value=u"ECOMP Release"),
+            WriteOnlyCell(validationWorkSheet, value=u"Validate"),
+            WriteOnlyCell(validationWorkSheet, value=u"Completed"),
+            WriteOnlyCell(validationWorkSheet, value=u"Stage"),
+            WriteOnlyCell(
+                validationWorkSheet, value=u"Heat Pre-validated"),
+            WriteOnlyCell(validationWorkSheet, value=u"Image Scan"),
+            WriteOnlyCell(
+                validationWorkSheet, value=u"AIC Instantiated"),
+            WriteOnlyCell(
+                validationWorkSheet, value=u"ASDC Onboarded"),
+            WriteOnlyCell(
+                validationWorkSheet, value=u"Overall Progress in %"),
+            WriteOnlyCell(
+                validationWorkSheet, value=u"Target Completion Date"),
+            WriteOnlyCell(validationWorkSheet, value=u"Status")]
         for headline in headlines:
             headline.font = Font(name='Courier', size=16, bold=True)
         validationWorkSheet.append(headlines)
 
         for vf in vfs:
-            validationWorkSheet.append([smart_str(vf["engagement__engagement_manual_id"]),
-                                        smart_str(vf["vf__name"]),
-                                        smart_str(
-                                            vf["vf_engagement__reviewer"]),
-                                        smart_str(
-                                            vf["vf_engagement__peer_reviewer"]),
-                                        smart_str(vf["vfcs"]),
-                                        smart_str(vf["vfcs__number"]),
-                                        smart_str(
-                                            vf["engagement__started_state_time"]),
-                                        smart_str(vf["vendor__name"]),
-                                        smart_str(
-                                            vf["deployment_target__version"]),
-                                        smart_str(vf["ecomp_release__name"]),
-                                        smart_str(
-                                            vf["engagement__validated_time"]),
-                                        smart_str(
-                                            vf["engagement__completed_time"]),
-                                        smart_str(
-                                            vf["engagement__engagement_stage"]),
-                                        smart_str(
-                                            vf["engagement__heat_validated_time"]),
-                                        smart_str(
-                                            vf["engagement__image_scan_time"]),
-                                        smart_str(
-                                            vf["engagement__aic_instantiation_time"]),
-                                        smart_str(
-                                            vf["engagement__asdc_onboarding_time"]),
-                                        smart_str(vf["engagement__progress"]),
-                                        smart_str(
-                                            vf["engagement__target_completion_date"]),
-                                        smart_str(
-                                            vf["engagement__latest_status"])
-                                        ])
+            validationWorkSheet.append(
+                [smart_str(vf["engagement__engagement_manual_id"]),
+                 smart_str(vf["vf__name"]),
+                 smart_str(
+                    vf["vf_engagement__reviewer"]),
+                 smart_str(
+                    vf["vf_engagement__peer_reviewer"]),
+                 smart_str(vf["vfcs"]),
+                 smart_str(vf["vfcs__number"]),
+                 smart_str(
+                    vf["engagement__started_state_time"]),
+                 smart_str(vf["vendor__name"]),
+                 smart_str(
+                    vf["deployment_target__version"]),
+                 smart_str(vf["ecomp_release__name"]),
+                 smart_str(
+                    vf["engagement__validated_time"]),
+                 smart_str(
+                    vf["engagement__completed_time"]),
+                 smart_str(
+                    vf["engagement__engagement_stage"]),
+                 smart_str(
+                    vf["engagement__heat_validated_time"]),
+                 smart_str(
+                    vf["engagement__image_scan_time"]),
+                 smart_str(
+                    vf["engagement__aic_instantiation_time"]),
+                 smart_str(
+                    vf["engagement__asdc_onboarding_time"]),
+                 smart_str(vf["engagement__progress"]),
+                 smart_str(
+                    vf["engagement__target_completion_date"]),
+                 smart_str(
+                    vf["engagement__latest_status"])
+                 ])
 
         # Create 'Overview' sheet and fill it up with required data:
         overviewWorkSheet = workbook.create_sheet()
         overviewWorkSheet.title = 'Overview'
-        headlines = [WriteOnlyCell(validationWorkSheet, value=u"AIC/ECOMP"),
-                     WriteOnlyCell(
-                         validationWorkSheet, value=u"Active Count of Engagement"),
-                     WriteOnlyCell(
-                         validationWorkSheet, value=u"Sum of Nr of VFs"),
-                     WriteOnlyCell(
-                         validationWorkSheet, value=u"Intake Count of Engagement"),
-                     WriteOnlyCell(
-                         validationWorkSheet, value=u"Sum of Nr of VFs"),
-                     WriteOnlyCell(
-                         validationWorkSheet, value=u"Completed Count of Engagement"),
-                     WriteOnlyCell(
-                         validationWorkSheet, value=u"Sum of Nr of VFs"),
-                     WriteOnlyCell(
-                         validationWorkSheet, value=u"Total Count of Engagement"),
-                     WriteOnlyCell(validationWorkSheet, value=u"Total Sum of Nr of VFs")]
+        headlines = [
+            WriteOnlyCell(validationWorkSheet, value=u"AIC/ECOMP"),
+            WriteOnlyCell(
+                validationWorkSheet, value=u"Active Count of Engagement"),
+            WriteOnlyCell(
+                validationWorkSheet, value=u"Sum of Nr of VFs"),
+            WriteOnlyCell(
+                validationWorkSheet, value=u"Intake Count of Engagement"),
+            WriteOnlyCell(
+                validationWorkSheet, value=u"Sum of Nr of VFs"),
+            WriteOnlyCell(
+                validationWorkSheet, value=u"Completed Count of Engagement"),
+            WriteOnlyCell(
+                validationWorkSheet, value=u"Sum of Nr of VFs"),
+            WriteOnlyCell(
+                validationWorkSheet, value=u"Total Count of Engagement"),
+            WriteOnlyCell(validationWorkSheet,
+                          value=u"Total Sum of Nr of VFs")]
         for headline in headlines:
             headline.font = Font(name='Courier', size=16, bold=True)
         overviewWorkSheet.append(headlines)
@@ -196,10 +204,12 @@ class ExportEngagements(VvpApiView):
         for deployment_target in deployment_targets:
             overviewWorkSheet.append(deployment_target)
 
-        # We are using HttpResponse and not Rest Response since we couldnt find
+        # We are using HttpResponse and not
+        # Rest Response since we couldnt find
         # support for content diposition
         response = HttpResponse(
-            content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
+            content_type='application/vnd.openxmlformats-officedocument.\
+            spreadsheetml.sheet')
         response['Content-Disposition'] = 'attachment; filename=D2ICE.xlsx'
 
         workbook.save(response)
@@ -215,12 +225,15 @@ class GetEngByUser(VvpApiView):
         user = request_data_mgr.get_user()
         vf_list = []
 
-        engStageList = [EngagementStage.Intake.name, EngagementStage.Active.name,
-                        EngagementStage.Validated.name, EngagementStage.Completed.name]  # @UndefinedVariable
+        engStageList = [
+            EngagementStage.Intake.name, EngagementStage.Active.name,
+            EngagementStage.Validated.name, EngagementStage.Completed.name]
 
         # @UndefinedVariable
-        if (user.role.name == Roles.admin.name or user.role.name == Roles.admin_ro.name):
-            vf_list = VF.objects.filter(engagement__engagement_stage__in=engStageList)\
+        if (user.role.name == Roles.admin.name or
+                user.role.name == Roles.admin_ro.name):
+            vf_list = VF.objects.filter(
+                engagement__engagement_stage__in=engStageList)\
                 .distinct().order_by('engagement__engagement_manual_id')\
                 .annotate(
                     engagement_manual_id=F('engagement__engagement_manual_id'),
@@ -238,8 +251,10 @@ class GetEngByUser(VvpApiView):
                     'engagement_stage',
             )
         else:
-            vf_list = VF.objects.filter(engagement__engagement_stage__in=engStageList).\
-                filter(Q(engagement__engagement_team__uuid=user.uuid)).distinct().order_by('engagement__engagement_manual_id')\
+            vf_list = VF.objects.filter(
+                engagement__engagement_stage__in=engStageList).\
+                filter(Q(engagement__engagement_team__uuid=user.uuid))\
+                .distinct().order_by('engagement__engagement_manual_id')\
                 .annotate(
                     engagement_manual_id=F('engagement__engagement_manual_id'),
                     engagement_uuid=F('engagement__uuid'),
@@ -282,7 +297,8 @@ class SingleEngByUser(VvpApiView):
         engagement = None
 
         # @UndefinedVariable
-        if (user.role.name == Roles.admin.name or user.role.name == Roles.admin_ro.name):
+        if (user.role.name == Roles.admin.name or
+                user.role.name == Roles.admin_ro.name):
             engagement = Engagement.objects.get(uuid=eng_uuid)
         else:
             try:
@@ -292,7 +308,7 @@ class SingleEngByUser(VvpApiView):
                 try:
                     engagement = Engagement.objects.get(
                         engagement_team__uuid=user.uuid, uuid=eng_uuid)
-                except:
+                except BaseException:
                     msg = "Eng for the User with uuid " + \
                         user.uuid + " doesn't exist."
                     self.logger.error(msg)
@@ -300,7 +316,8 @@ class SingleEngByUser(VvpApiView):
                     return Response(msg, status=HTTP_500_INTERNAL_SERVER_ERROR)
         vfObj = VF.objects.get(engagement__uuid=engagement.uuid)
         eng_svc.update_or_insert_to_recent_engagements(
-            user.uuid, vfObj, RecentEngagementActionType.NAVIGATED_INTO_ENGAGEMENT.name)  # @UndefinedVariable
+            user.uuid, vfObj, RecentEngagementActionType.
+            NAVIGATED_INTO_ENGAGEMENT.name)
 
         vfList = VF.objects.filter(engagement__uuid=engagement.uuid)
         formated_vf_list = VFModelSerializer(vfList, many=True).data
@@ -342,11 +359,12 @@ class StarredEngagements(VvpApiView):
     @auth(Permissions.star_an_engagement)
     def get(self, request):
         user = request_data_mgr.get_user()
-        if (user == None):
+        if (not user):
             msg = "User with uuid " + user.uuid + \
                 " doesn't exist. Can't fetch their engagements"
             self.logger.error(logEncoding(msg))
-            msg = "You are not registered as a user, please sign up in order to perform this action"
+            msg = "You are not registered as a user, please sign\
+             up in order to perform this action"
             return Response(msg, status=HTTP_400_BAD_REQUEST)
 
         vf_list = eng_svc.vf_retreiver(user, True)
@@ -360,17 +378,29 @@ class StarredEngagements(VvpApiView):
         for vf_data in vf_list:
 
             # @UndefinedVariable
-            if (user.role.name == Roles.el.name or user.role.name == Roles.admin.name or user.role.name == Roles.admin_ro.name):
+            if (
+                    user.role.name == Roles.el.name or
+                    user.role.name == Roles.admin.name or
+                    user.role.name == Roles.admin_ro.name):
                 if (vf_data['engagement__reviewer__uuid'] == user.uuid):
-                    checklist_lists = Checklist.objects.filter(Q(engagement__uuid=vf_data['engagement__uuid']), Q(engagement__reviewer=user), ~Q(
-                        state=CheckListState.archive.name)).values('uuid', 'name', 'state', 'owner__uuid')  # @UndefinedVariable
+                    checklist_lists = Checklist.objects.filter(
+                        Q(engagement__uuid=vf_data['engagement__uuid']),
+                        Q(engagement__reviewer=user), ~Q(
+                            state=CheckListState.archive.name)).values(
+                                'uuid', 'name', 'state', 'owner__uuid')
                 # @UndefinedVariable
-                elif (user.role.name == Roles.admin.name or user.role.name == Roles.admin_ro.name):
-                    checklist_lists = Checklist.objects.filter(Q(engagement__uuid=vf_data['engagement__uuid']), ~Q(
-                        state=CheckListState.archive.name)).values('uuid', 'name', 'state', 'owner__uuid')   # @UndefinedVariable
+                elif (user.role.name == Roles.admin.name or
+                      user.role.name == Roles.admin_ro.name):
+                    checklist_lists = Checklist.objects.filter(
+                        Q(engagement__uuid=vf_data['engagement__uuid']),
+                        ~Q(state=CheckListState.archive.name)).values(
+                        'uuid', 'name', 'state', 'owner__uuid')
                 else:
-                    checklist_lists = Checklist.objects.filter(Q(engagement__uuid=vf_data['engagement__uuid']), Q(owner=user), ~Q(
-                        state=CheckListState.archive.name)).values('uuid', 'name', 'state', 'owner__uuid')  # @UndefinedVariable
+                    checklist_lists = Checklist.objects.filter(
+                        Q(engagement__uuid=vf_data['engagement__uuid']),
+                        Q(owner=user), ~Q(
+                            state=CheckListState.archive.name)).values(
+                                'uuid', 'name', 'state', 'owner__uuid')
                 vf_data['checklists'] = checklist_lists
             else:
                 vf_data['checklists'] = None
@@ -391,11 +421,12 @@ class StarredEngagements(VvpApiView):
             return Response(msg, status=HTTP_400_BAD_REQUEST)
 
         eng_uuid = data['engagement_uuid']
-        if (user == None):
+        if (not user):
             msg = "User with uuid " + user.uuid + \
                 " doesn't exist. Can't fetch their engagements"
             self.logger.error(logEncoding(msg))
-            msg = "You are not registered as a user, please sign up in order to perform this action"
+            msg = "You are not registered as a user, please sign up in order \
+            to perform this action"
             return Response(msg, status=HTTP_400_BAD_REQUEST)
 
         msg = eng_svc.star_an_engagement(user, eng_uuid)
@@ -409,11 +440,12 @@ class GetRecentEngagements(VvpApiView):
     @auth(Permissions.eng_membership)
     def get(self, request, format=None, **kwargs):
         user = request_data_mgr.get_user()
-        if (user == None):
+        if (not user):
             msg = "User with uuid " + user.uuid + \
                 " doesn't exist. Can't fetch their engagements"
             self.logger.error(logEncoding(msg))
-            msg = "You are not registered as a user, please sign up in order to perform this action"
+            msg = "You are not registered as a user, please sign up in order \
+            to perform this action"
             return Response(msg, status=HTTP_400_BAD_REQUEST)
 
         stared_list = eng_svc.vf_retreiver(user, True)
@@ -431,17 +463,27 @@ class GetRecentEngagements(VvpApiView):
             if (idx == recentList):
                 break
             # @UndefinedVariable
-            if (user.role.name == Roles.el.name or user.role.name == Roles.admin.name or user.role.name == Roles.admin_ro.name):
+            if (user.role.name == Roles.el.name or
+                user.role.name == Roles.admin.name or
+                    user.role.name == Roles.admin_ro.name):
                 if (vf_data['vf__engagement__reviewer__uuid'] == user.uuid):
-                    checklist_lists = Checklist.objects.filter(Q(engagement__uuid=vf_data['vf__engagement__uuid']), Q(engagement__reviewer=user), ~Q(
-                        state=CheckListState.archive.name)).values('uuid', 'name', 'state', 'owner__uuid')  # @UndefinedVariable
+                    checklist_lists = Checklist.objects.filter(
+                        Q(engagement__uuid=vf_data['vf__engagement__uuid']),
+                        Q(engagement__reviewer=user), ~Q(
+                            state=CheckListState.archive.name)).values(
+                                'uuid', 'name', 'state', 'owner__uuid')
                 # @UndefinedVariable
-                elif (user.role.name == Roles.admin.name or user.role.name == Roles.admin_ro.name):
-                    checklist_lists = Checklist.objects.filter(Q(engagement__uuid=vf_data['vf__engagement__uuid']), ~Q(
-                        state=CheckListState.archive.name)).values('uuid', 'name', 'state', 'owner__uuid')   # @UndefinedVariable
+                elif (user.role.name == Roles.admin.name or
+                      user.role.name == Roles.admin_ro.name):
+                    checklist_lists = Checklist.objects.filter(
+                        Q(engagement__uuid=vf_data['vf__engagement__uuid']),
+                        ~Q(state=CheckListState.archive.name)).values(
+                            'uuid', 'name', 'state', 'owner__uuid')
                 else:
-                    checklist_lists = Checklist.objects.filter(Q(engagement__uuid=vf_data['vf__engagement__uuid']), Q(owner=user), ~Q(
-                        state=CheckListState.archive.name)).values('uuid', 'name', 'state', 'owner__uuid')  # @UndefinedVariable
+                    checklist_lists = Checklist.objects.filter(
+                        Q(engagement__uuid=vf_data['vf__engagement__uuid']),
+                        Q(owner=user), ~Q(state=CheckListState.archive.name))\
+                        .values('uuid', 'name', 'state', 'owner__uuid')
                 vf_data['checklists'] = checklist_lists
             else:
                 vf_data['checklists'] = None
@@ -457,7 +499,8 @@ class EngagementProgressBar(VvpApiView):
         data = request.data
         msg = "OK"
 
-        if ('progress' not in data or not data['progress'] or data['progress'] == ''):
+        if ('progress' not in data or not data['progress'] or
+                data['progress'] == ''):
             msg = "progress parameter is missing or empty"
             self.logger.error(msg)
             msg = "Action has failed due to bad request."
@@ -472,7 +515,8 @@ class EngagementProgressBar(VvpApiView):
         eng = self.get_entity(Engagement, request_data_mgr.get_eng_uuid())
         msg = "OK"
 
-        if ('target_date' not in data or not data['target_date'] or data['target_date'] == ''):
+        if ('target_date' not in data or not data['target_date'] or
+                data['target_date'] == ''):
             msg = "target_date parameter is missing or empty"
             self.logger.error(msg)
             msg = "Action has failed due to bad request."
@@ -494,7 +538,8 @@ class ChangeTargetLabEntryDate(VvpApiView):
         eng = self.get_entity(Engagement, request_data_mgr.get_eng_uuid())
         msg = "OK"
         vf = VF.objects.get(engagement__uuid=eng.uuid)
-        if ('target_date' not in data or not data['target_date'] or data['target_date'] == ''):
+        if ('target_date' not in data or not data['target_date']
+                or data['target_date'] == ''):
             msg = "target_date parameter is missing or empty"
             self.logger.error(msg)
             msg = "Action has failed due to bad request."
@@ -535,11 +580,13 @@ class Status(VvpApiView):
         if not description:
             msg = "Not description sent"
             self.logger.error(msg)
-            msg = "You are not registered as a user, please sign up in order to perform this action"
+            msg = "You are not registered as a user, please sign \
+            up in order to perform this action"
             return Response(msg, status=HTTP_400_BAD_REQUEST)
 
         # @UndefinedVariable
-        if (user.role.name != Roles.admin.name and user.role.name != Roles.el.name):
+        if (user.role.name != Roles.admin.name and
+                user.role.name != Roles.el.name):
             msg = "User not authorized"
             self.logger.error(msg)
             msg = "Internal error."
@@ -569,7 +616,8 @@ class Status(VvpApiView):
             return Response(msg, status=HTTP_400_BAD_REQUEST)
 
         # @UndefinedVariable
-        if (user.role.name != Roles.admin.name and user.role.name != Roles.el.name):
+        if (user.role.name != Roles.admin.name and
+                user.role.name != Roles.el.name):
             msg = "User not authorized"
             self.logger.error(msg)
             msg = "Internal error."
@@ -598,7 +646,8 @@ class EngagementOps(VvpApiView):
                 user = request_data_mgr.get_user()
                 created_eng_status = eng_svc.insert_engagement_status(
                     user, data['status'], engagement)
-                return Response(EngagementStatusModelSerializer(created_eng_status).data)
+                return Response(
+                    EngagementStatusModelSerializer(created_eng_status).data)
             else:
                 return Response()
 
@@ -613,7 +662,7 @@ class EngagementTeamUsers(VvpApiView):
         data = request.data
         if (data['user_uuid']):
             requested_user_uuid = data['user_uuid']
-        if (eng_uuid is not None and user is not None and data['user_uuid'] is not None):
+        if (eng_uuid and user and data['user_uuid']):
             eng_svc.remove_user_from_engagement_team(
                 eng_uuid, user, requested_user_uuid)
         return Response(status=HTTP_204_NO_CONTENT)
index b8075b8..146cb29 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -57,7 +57,8 @@ class Feedback(VvpApiView):
     @auth(Permissions.add_feedback)
     def post(self, request):
         user = request_data_mgr.get_user()
-        if ('description' not in request.data or not request.data['description']):
+        if ('description' not in request.data or
+                not request.data['description']):
             raise KeyError("One of the input parameters are missing")
         new_description = request.data['description']
         new_feedback = FeedbackModal(
@@ -65,6 +66,7 @@ class Feedback(VvpApiView):
             description=new_description
         )
         new_feedback.save()
-        self.slack_client.send_slack_notifications_for_new_feedback(new_feedback, user)
+        self.slack_client.send_slack_notifications_for_new_feedback(
+            new_feedback, user)
 
         return Response(status.HTTP_200_OK)
index 8060a69..e5e1505 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -36,7 +36,6 @@
 # ============LICENSE_END============================================
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
-import json
 
 from rest_framework import status
 from rest_framework.response import Response
@@ -59,15 +58,18 @@ class InviteTeamMember(VvpApiView):
         inviterUser = request_data_mgr.get_user()
         msg = "OK"
         sts = status.HTTP_200_OK
-        if (inviterUser != None):
+        if (inviterUser):
             dataList = []
             dataList = request.data
 
             for data in dataList:
-                if 'eng_uuid' in data and data['eng_uuid'] and 'email' in data and data['email']:
-                    inviteUserToSignUpOrLogin(inviterUser, data, is_contact_user=False)
+                if 'eng_uuid' in data and data['eng_uuid'] and \
+                        'email' in data and data['email']:
+                    inviteUserToSignUpOrLogin(
+                        inviterUser, data, is_contact_user=False)
                 else:
-                    msg = "No eng_uuid or no email found on the request body to invite-team-members. data=" + str(data)
+                    msg = "No eng_uuid or no email found on the request \
+                    body to invite-team-members. data=" + str(data)
                     self.logger.error(logEncoding(msg))
                     sts = status.HTTP_500_INTERNAL_SERVER_ERROR
 
@@ -84,9 +86,9 @@ class InviteContact(VvpApiView):
         data = request.data
 
         if ('full_name' not in data or not data['full_name'] or
-           'email' not in data or not data['email'] or
-           'phone_number' not in data or not data['phone_number'] or
-           'eng_uuid' not in data or not data['eng_uuid']):
+            'email' not in data or not data['email'] or
+            'phone_number' not in data or not data['phone_number'] or
+                'eng_uuid' not in data or not data['eng_uuid']):
             msg = "One of the input parameters is missing"
             self.logger.error(msg)
             return Response(msg, status=status.HTTP_400_BAD_REQUEST)
index 53b906b..ddc5df4 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -36,7 +36,6 @@
 # ============LICENSE_END============================================
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
-import json
 
 from rest_framework.permissions import AllowAny
 from rest_framework.response import Response
@@ -64,7 +63,9 @@ class Login(VvpApiView):
         if param:
             reset_password_param = param
 
-        reset_password_email, is_reset_pwd_flow = login_svc.identify_reset_password(jwt_obj, reset_password_param)
+        reset_password_email, is_reset_pwd_flow = login_svc.\
+            identify_reset_password(
+                jwt_obj, reset_password_param)
 
         if not user_profile.user.is_active:
             msg = login_svc.render_user_not_active_message(data['email'])
@@ -82,7 +83,9 @@ class Login(VvpApiView):
             if 'invitation' in data:
                 login_svc.handle_invite_token(data, msg, user_profile)
 
-            self.logger.debug("login has passed successfully for [email=" + data['email'] + "]")
+            self.logger.debug(
+                "login has passed successfully for [email=" + data['email']
+                + "]")
             login_svc.update_last_login(user_profile)
 
         return Response(msg)
index 7d4f850..0c93f20 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -41,7 +41,8 @@ import json
 from rest_framework.response import Response
 from rest_framework.status import HTTP_400_BAD_REQUEST, HTTP_204_NO_CONTENT
 
-from engagementmanager.bus.messages.activity_event_message import ActivityEventMessage
+from engagementmanager.bus.messages.activity_event_message import \
+    ActivityEventMessage
 from engagementmanager.decorator.auth import auth
 from engagementmanager.decorator.class_decorator import classDecorator
 from engagementmanager.decorator.log_func_entry import logFuncEntry
@@ -82,16 +83,20 @@ class NextSteps(VvpApiView):
         data = NextStepSvc().addNextStep(dataList)
 
         for next_step in data:
-            if (next_step['files'] != None):
+            if next_step['files']:
                 next_step['files'] = json.loads(next_step['files'])
 
-        self.logger.debug("Successfully added a Next Step to engagement_uuid=" +
-                          eng_uuid + " for creator with uuid=" + str(user))
+        self.logger.debug(
+            "Successfully added a Next Step to engagement_uuid=" +
+            eng_uuid +
+            " for creator with uuid=" +
+            str(user))
         return Response(data)
 
     @auth(Permissions.eng_membership)
     def get(self, request, **kwargs):
-        next_steps_data = NextStepSvc().get_next_steps(eng_stage=kwargs['eng_stage'])
+        next_steps_data = NextStepSvc().get_next_steps(
+            eng_stage=kwargs['eng_stage'])
         return Response(next_steps_data.data)
 
     @auth(Permissions.update_personal_next_step)
@@ -129,7 +134,8 @@ class EditNextSteps(VvpApiView):
         ns = self.get_entity(NextStep, request_data_mgr.get_ns_uuid())
         ns.delete()
 
-        activity_data = DeleteNextStepsActivityData(request_data_mgr.get_user(), ns.engagement)
+        activity_data = DeleteNextStepsActivityData(
+            request_data_mgr.get_user(), ns.engagement)
         bus_service.send_message(ActivityEventMessage(activity_data))
 
         return Response(status=HTTP_204_NO_CONTENT)
@@ -144,20 +150,23 @@ class ChecklistNextStep(VvpApiView):
         dataList = json.loads(body_unicode)
         msg = "OK"
 
-        if (request_data_mgr.get_cl_uuid() == None or request_data_mgr.get_eng_uuid() == None):
-            msg = "check list uuid or engagement uuid is missing from the url path parameters"
+        if (not request_data_mgr.get_cl_uuid() or not
+                request_data_mgr.get_eng_uuid()):
+            msg = "check list uuid or engagement uuid is missing from the " +\
+                "url path parameters"
             self.logger.error(msg)
             return Response(msg, status=HTTP_400_BAD_REQUEST)
 
         for data in dataList:
             if ('assigneesUuids' not in data or not data['assigneesUuids'] or
-               'description' not in data or not data['description'] or
-               'duedate' not in data or not data['duedate']):
+                'description' not in data or not data['description'] or
+                    'duedate' not in data or not data['duedate']):
                 msg = "One of the CheckList's input parameters is missing"
                 self.logger.error(msg)
                 return Response(msg, status=HTTP_400_BAD_REQUEST)
 
         data = NextStepSvc().addNextStep(
-            dataList, desc="Checklist is denied due to a creation of a new NextStep")
+            dataList, desc="Checklist is denied due to a creation " +
+            "of a new NextStep")
 
         return Response(data)
index 34c4a7b..53acb30 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -44,7 +44,8 @@ from engagementmanager.decorator.auth import auth
 from engagementmanager.decorator.class_decorator import classDecorator
 from engagementmanager.decorator.log_func_entry import logFuncEntry
 import engagementmanager.models
-from engagementmanager.notifications import num_of_notifications_for_user, reset_num_of_notifications_for_user,\
+from engagementmanager.notifications import num_of_notifications_for_user, \
+    reset_num_of_notifications_for_user,\
     pull_recent_notifications
 from engagementmanager.rest.vvp_api_view import VvpApiView
 from engagementmanager.service.authorization_service import Permissions
@@ -75,12 +76,15 @@ class NotificationOps(VvpApiView):
     # PullRecentNotif4User
     def get(self, request, user_uuid, offset, limit):
         user = request_data_mgr.get_user()
-        serilizedActivitySet, num_of_objects = pull_recent_notifications(user.uuid, offset, limit)
+        serilizedActivitySet, num_of_objects = pull_recent_notifications(
+            user.uuid, offset, limit)
         if serilizedActivitySet is not None:
-            data = {'serilizedActivitySet': serilizedActivitySet, 'num_of_objects': num_of_objects}
+            data = {'serilizedActivitySet': serilizedActivitySet,
+                    'num_of_objects': num_of_objects}
             return Response(data)
         else:
-            return Response("Activity set wasn't found", status=HTTP_400_BAD_REQUEST)
+            return Response("Activity set wasn't found",
+                            status=HTTP_400_BAD_REQUEST)
 
     # Reset the number of an unread notifications
     def put(self, request):
index fce516a..9c778e7 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -47,10 +47,10 @@ sanitizer = Cleaner(
     styles=[
         'color', 'font-family', 'font-style', 'font-weight',
         'text-decoration-line',
-        ],
+    ],
     protocols=['http'],
     strip=True,
-    )
+)
 
 
 def clean_r(obj):
@@ -94,6 +94,7 @@ class XSSParserMixin(parsers.BaseParser):
     cause clean_r() to be run against the parsed data.
 
     """
+
     def parse(self, stream, media_type=None, parser_context=None):
         return clean_r(
             super().parse(
index 85d63cd..ee875ab 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -51,10 +51,10 @@ from engagementmanager.decorator.log_func_entry import logFuncEntry
 from engagementmanager.models import Vendor, Engagement, Role, Invitation, \
     IceUserProfile, CustomUser
 from engagementmanager.rest.vvp_api_view import VvpApiView
-from engagementmanager.serializers import SuperThinIceUserProfileModelSerializer
+from engagementmanager.serializers import\
+    SuperThinIceUserProfileModelSerializer
 from engagementmanager.service.invite_service import markInvitationAsAccepted
 from engagementmanager.service.user_service import UserService
-from engagementmanager.utils.authentication import JWTAuthentication
 from engagementmanager.utils.constants import Constants, Roles
 from engagementmanager.utils.validator import Validator, logEncoding
 from engagementmanager.views_helper import generateActivationLink, \
@@ -70,11 +70,11 @@ class SignUp(VvpApiView):
         data_dont_save = JSONParser().parse(request)
 
         if ('company' not in data or not data['company'] or
-           'full_name' not in data or not data['full_name'] or
-           'email' not in data or not data['email'] or
-           'password' not in data or not data['password'] or
-           'phone_number' not in data or not data['phone_number'] or
-           'regular_email_updates' not in data):
+            'full_name' not in data or not data['full_name'] or
+            'email' not in data or not data['email'] or
+            'password' not in data or not data['password'] or
+            'phone_number' not in data or not data['phone_number'] or
+                'regular_email_updates' not in data):
             msg = "One of the input parameters is missing"
             self.logger.error(msg)
             return Response(msg, status=status.HTTP_400_BAD_REQUEST)
@@ -97,12 +97,15 @@ class SignUp(VvpApiView):
 
         Validator.validateEmail(i_email)
 
-        if data_dont_save['company'] == Constants.service_provider_company_name:
+        if data_dont_save['company'] == \
+                Constants.service_provider_company_name:
             i_is_service_provider_contact = True
 
         mailTokens = i_email.split("@")
-        if mailTokens[1] not in Constants.service_provider_mail_domain and i_is_service_provider_contact:
-            msg = "Email address should be with service provider domain for signees that their company =" + \
+        if mailTokens[1] not in Constants.service_provider_mail_domain and \
+                i_is_service_provider_contact:
+            msg = "Email address should be with service provider domain for \
+            signees that their company =" + \
                 Constants.service_provider_company_name
             self.logger.error(logEncoding(msg))
             return Response(msg, status=status.HTTP_400_BAD_REQUEST)
@@ -114,46 +117,62 @@ class SignUp(VvpApiView):
             activationToken = str(uuid.uuid4().hex)
             i_company = Vendor.objects.get(name=data_dont_save['company'])
 
-            user_object = CustomUser.objects.create_user(username=i_email, email=i_email, password=i_password,
-                                                         activation_token=activationToken, activation_token_create_time=timezone.now(), is_active=False)
-            info = createUserTemplate(i_company, i_full_name, roleObj, i_phone_number,
-                                      i_is_service_provider_contact, None, i_regular_email_updates, user_object)
-            newUserObj, is_profile_created = IceUserProfile.objects.update_or_create(
-                email=user_object.email, defaults=info)
+            user_object = CustomUser.objects.create_user(
+                username=i_email, email=i_email, password=i_password,
+                activation_token=activationToken,
+                activation_token_create_time=timezone.now(), is_active=False)
+            info = createUserTemplate(
+                i_company, i_full_name, roleObj, i_phone_number,
+                i_is_service_provider_contact,
+                None, i_regular_email_updates, user_object)
+            newUserObj, is_profile_created = \
+                IceUserProfile.objects.update_or_create(
+                    email=user_object.email, defaults=info)
 
             self.logger.debug(
                 "Creating Non activated User: " + str(newUserObj))
             userData = SuperThinIceUserProfileModelSerializer(newUserObj).data
-            # If we eng_uuid and inviter_uuid is supplied it means that this user was
-            # invited. We want to add them to the engagement team of the inviter
+            # If we eng_uuid and inviter_uuid is supplied it means that this
+            # user was invited. We want to add them to the engagement team
+            # of the inviter
 
             if 'invitation' in data:
                 invitation = Invitation.objects.get(
                     invitation_token=data['invitation'])
-                self.logger.debug("Looks like user " + i_full_name + " has arrived to the sign-up page from an invite email initiated by user with uuid=" +
-                                  invitation.invited_by_user_uuid + ". Adding them to the inviter's engagement_team...")
+                self.logger.debug(
+                    "Looks like user " + i_full_name +
+                    " has arrived to the sign-up page from an invite email \
+                    initiated by user with uuid=" +
+                    invitation.invited_by_user_uuid + ". Adding them to the \
+                    inviter's engagement_team...")
 
                 userData['eng_uuid'] = invitation.engagement_uuid
                 if data["is_contact_user"] == "true":
                     engObj = Engagement.objects.get(
                         uuid=invitation.engagement_uuid)
                     engObj.contact_user = newUserObj
-                    self.logger.debug("Attaching the user (" + newUserObj.full_name +
-                                      ") to the engagement's (" + engObj.uuid + ") contact_user")
+                    self.logger.debug(
+                        "Attaching the user (" + newUserObj.full_name +
+                        ") to the engagement's (" + engObj.uuid +
+                        ") contact_user")
                     engObj.save()
 
                 user_svc.addUserToEngAndFireProvisionVfSig(
                     newUserObj, invitation)
 
                 otherInviteObj = Invitation.objects.filter(
-                    accepted=False, email=i_email).exclude(uuid=invitation.uuid)
+                    accepted=False, email=i_email).exclude(
+                    uuid=invitation.uuid)
 
-                if data['is_contact_user'] == "true" or data['is_contact_user'] == "True":
+                if data['is_contact_user'] == "true" or \
+                        data['is_contact_user'] == "True":
                     engObj = Engagement.objects.get(
                         uuid=invitation.engagement_uuid)
                     engObj.contact_user = newUserObj
-                    self.logger.debug("Attaching the user (" + newUserObj.full_name +
-                                      ") to the engagement's (" + engObj.uuid + ") contact_user")
+                    self.logger.debug(
+                        "Attaching the user (" + newUserObj.full_name +
+                        ") to the engagement's (" +
+                        engObj.uuid + ") contact_user")
                     engObj.save()
 
                 markInvitationAsAccepted(data['invitation'])
@@ -171,10 +190,12 @@ class SignUp(VvpApiView):
                 self.logger.debug(
                     "Activation Link: " + data['activation_link'])
 
-                body = get_template("{activate_template_dir}activate_mail_body.html".format(
-                    activate_template_dir=Constants.activate_template_dir))
-                subject = get_template("{activate_template_dir}activate_mail_subject.html".format(
-                    activate_template_dir=Constants.activate_template_dir))
+                body = get_template(
+                    "{activate_template_dir}activate_mail_body.html".format(
+                        activate_template_dir=Constants.activate_template_dir))
+                subject = get_template(
+                    "{activate_template_dir}activate_mail_subject.html".format(
+                        activate_template_dir=Constants.activate_template_dir))
                 mail.sendMail(i_email, data, body, subject)
 
             self.logger.debug(
index 13fc916..7f9acb2 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -36,7 +36,6 @@
 # ============LICENSE_END============================================
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
-import json
 import uuid
 
 from django.conf import settings
@@ -91,7 +90,8 @@ class UpdatePassword(VvpApiView):
         user.user.set_password(data['password'])
         user.user.temp_password = None
         user.user.save()
-        self.logger.info("Reset Password finished successfully for user with uuid=" +
+        self.logger.info("Reset Password finished successfully " +
+                         "for user with uuid=" +
                          user.uuid + " Redirecting to Login")
         return Response(msg)
 
@@ -122,12 +122,13 @@ class SendResetPasswordInstructionMail(VvpApiView):
         self.logger.debug(
             "The login link to reset Password: " + str(data['login_link']))
 
-        if (user != None):
-            body = get_template("{reset_pwd_template_dir}reset_pwd_instructions_mail_body.html"   .format(
-                reset_pwd_template_dir=Constants.reset_pwd_template_dir))
-            subject = get_template("{reset_pwd_template_dir}reset_pwd_instructions_mail_subject.html".format(
-                reset_pwd_template_dir=Constants.reset_pwd_template_dir))
-
+        if (user):
+            body = get_template(
+                Constants.reset_pwd_template_dir +
+                "reset_pwd_instructions_mail_body.html")
+            subject = get_template(
+                Constants.reset_pwd_template_dir +
+                "reset_pwd_instructions_mail_subject.html")
             user.user.temp_password = make_password(data['tempPassword'])
             user.user.save()
             user.save()
@@ -135,8 +136,9 @@ class SendResetPasswordInstructionMail(VvpApiView):
             try:
                 mail.sendMail(data['email'], data, body, subject)
             except Exception as e:
-                msg = "Something went wrong while trying to send reset-password mail to " + \
-                    data['email'] + "\n error: " + e.message
+                msg = "Something went wrong while trying to send \
+                reset-password mail to " \
+                + data['email'] + "\n error: " + e.message
                 self.logger.error(
                     msg + " rolling back the temporary password from the DB")
                 user.user.temp_password = None
@@ -162,7 +164,8 @@ class User(VvpApiView):
         user.phone_number = data['phone_number']
         user.full_name = data['full_name']
         if len(user.full_name) > 30:
-            return Response("first name should be up to 30 characters", status=HTTP_400_BAD_REQUEST)
+            return Response("first name should be up to 30 characters",
+                            status=HTTP_400_BAD_REQUEST)
 
         self.handle_password_change(data, user)
 
@@ -238,4 +241,5 @@ class EngagementLeads(VvpApiView):
 class RGWAAccessKey(VvpApiView):
 
     def get(self, request):
-        return Response({"rgwa_secret_key": UserService().get_user_rgwa_secret()})
+        return Response(
+            {"rgwa_secret_key": UserService().get_user_rgwa_secret()})
index 1f1a929..ebb527e 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index b6ae351..1c5f5f6 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -68,9 +68,6 @@ class VendorREST(VvpApiView):
         data = request.data
 
         vendor = None
-        public = False
-        if 'public' in data:
-            public = data['public']
         try:
             vendor = Vendor.objects.get(name=data['name'])
             msg = "Company: " + vendor.name + " already exist"
@@ -91,5 +88,5 @@ class VendorREST(VvpApiView):
     def delete(self, request, uuid):
         msg = ""
         sts = HTTP_204_NO_CONTENT
-        vendor = Vendor.objects.get(uuid=uuid).delete()
+        Vendor.objects.get(uuid=uuid).delete()
         return Response(msg, status=sts)
index 23ee5b9..0288c14 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 9ebf3bc..245e936 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -36,7 +36,6 @@
 # ============LICENSE_END============================================
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
-import json
 
 from rest_framework.response import Response
 from rest_framework.status import HTTP_204_NO_CONTENT
@@ -64,10 +63,13 @@ class VFCRest(VvpApiView):
         return Response(serializer.data)
 
     """
-    expecting: VF object uuid, VFC relevant fields(excluding the ones with default field)
-    result: addition of a VFC to the DB and concatenating them with the VF object
+    expecting: VF object uuid, VFC relevant fields
+    (excluding the ones with default field)
+    result: addition of a VFC to the DB and concatenating
+    them with the VF object
     """
-    # This method doesn't need to be decorated with auth since it doesn't pass any engagement data from the front-end
+    # This method doesn't need to be decorated with auth since it doesn't pass
+    # any engagement data from the front-end
 
     @auth(Permissions.add_vfc)
     def post(self, request):
index 4abe086..3163fe9 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -40,7 +40,8 @@ from abc import ABCMeta
 from rest_framework.views import APIView
 from engagementmanager.decorator.class_decorator import classDecorator
 from engagementmanager.decorator.log_func_entry import logFuncEntry
-from engagementmanager.service.authorization_service import AuthorizationService
+from engagementmanager.service.authorization_service import \
+    AuthorizationService
 from engagementmanager.service.logging_service import LoggingServiceFactory
 
 
index 9430ff6..02e0db6 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
 from apscheduler.schedulers.background import BackgroundScheduler
 from django.conf import settings
-from engagementmanager.bus.messages.daily_scheduled_message import DailyScheduledMessage
-from engagementmanager.bus.messages.hourly_scheduled_message import HourlyScheduledMessage
+from engagementmanager.bus.messages.daily_scheduled_message\
+    import DailyScheduledMessage
+from engagementmanager.bus.messages.hourly_scheduled_message\
+    import HourlyScheduledMessage
 from engagementmanager.service.logging_service import LoggingServiceFactory
 
 logger = LoggingServiceFactory.get_logger()
@@ -57,11 +59,13 @@ class ScheduledJobs:
 
     def setup_daily_job(self):
         self.background_scheduler.add_job(self.__daily_scheduled_job, 'cron',
-                                          hour=settings.DAILY_SCHEDULED_JOB_HOUR, day='*')
+                                          hour=settings.
+                                          DAILY_SCHEDULED_JOB_HOUR, day='*')
 
     def __hourly_scheduled_job(self):
         logger.debug("Hourly scheduled job is about to start.")
         self.bus_service.send_message(HourlyScheduledMessage())
 
     def setup_hourly_job(self):
-        self.background_scheduler.add_job(self.__hourly_scheduled_job, 'cron', minute=0, hour='*', day='*')
+        self.background_scheduler.add_job(
+            self.__hourly_scheduled_job, 'cron', minute=0, hour='*', day='*')
index e3e88b0..154884e 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -37,7 +37,9 @@
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
 '''
-Each entity has a model serializer that save/update the object in its create()/update() methods and a regular dictionary (map) serializer that return a new/updated instance of the object
+Each entity has a model serializer that save/update the object in its \
+create()/update() methods and a regular dictionary (map) serializer that \
+return a new/updated instance of the object
 
 '''
 from rest_framework import serializers
@@ -47,7 +49,8 @@ from engagementmanager.models import NextStep, Notification, Activity, \
     ChecklistLineItem, ECOMPRelease, EngagementStatus, CustomUser, \
     ChecklistSection
 
-from .models import IceUserProfile, VFC, Engagement, VF, DeploymentTarget, Role, Vendor, DeploymentTargetSite
+from .models import IceUserProfile, VFC, Engagement, VF, \
+    DeploymentTarget, Role, Vendor, DeploymentTargetSite
 
 
 class RoleModelSerializer(serializers.ModelSerializer):
@@ -106,7 +109,8 @@ class SuperThinIceUserProfileModelSerializer(serializers.ModelSerializer):
                   'user', 'company', 'phone_number')
 
 
-class SuperThinIceUserProfileModelSerializerForSignals(serializers.ModelSerializer):
+class SuperThinIceUserProfileModelSerializerForSignals(
+        serializers.ModelSerializer):
     role = RoleModelSerializer(many=False)
 
     class Meta:
@@ -121,8 +125,10 @@ class ThinIceUserProfileModelSerializer(serializers.ModelSerializer):
 
     class Meta:
         model = IceUserProfile
-        fields = ('email', 'full_name', 'user', 'is_service_provider_contact', 'phone_number', 'role', 'uuid', 'company',
-                  'ssh_public_key', 'regular_email_updates', 'email_updates_on_every_notification',
+        fields = ('email', 'full_name', 'user', 'is_service_provider_contact',
+                  'phone_number', 'role', 'uuid', 'company',
+                  'ssh_public_key', 'regular_email_updates',
+                  'email_updates_on_every_notification',
                   'email_updates_daily_digest', 'rgwa_access_key')
 
 
@@ -179,7 +185,8 @@ class ThinVFModelSerializer(serializers.ModelSerializer):
     class Meta:
         model = VF
         fields = (
-            'uuid', 'name', 'engagement', 'is_service_provider_internal', 'ecomp_release')
+            'uuid', 'name', 'engagement',
+            'is_service_provider_internal', 'ecomp_release')
 
 
 class ThinDeploymentTargetSiteModelSerializer(serializers.ModelSerializer):
@@ -304,7 +311,8 @@ class UserNextStepModelSerializer(serializers.ModelSerializer):
     class Meta:
         model = NextStep
         fields = ('due_date', 'engagement_manual_id', 'description',
-                  'create_time', 'creator_full_name', 'vf_name', 'engagement_uuid')
+                  'create_time', 'creator_full_name',
+                  'vf_name', 'engagement_uuid')
 
 
 class NextStepModelSerializer(serializers.ModelSerializer):
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index b7edca4..36ecaa7 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -38,7 +38,8 @@
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
 import json
 from django.utils import timezone
-from engagementmanager.bus.messages.new_notification_message import NewNotificationMessage
+from engagementmanager.bus.messages.new_notification_message \
+    import NewNotificationMessage
 from engagementmanager.models import IceUserProfile, Activity, Notification
 from engagementmanager.utils import activities_data
 from engagementmanager.utils.constants import Constants
@@ -55,7 +56,8 @@ class ActivitiesSvc:
         if hasattr(activity_data, "users_list") and activity_data.users_list:
             for user in activity_data.users_list:
                 activity_data.user = user
-                if hasattr(activity_data, "multiple_users_as_owners") and activity_data.multiple_users_as_owners:
+                if hasattr(activity_data, "multiple_users_as_owners") and \
+                        activity_data.multiple_users_as_owners:
                     activity_data.owner = activity_data.user
                 self.set_description(activity_data)
                 self.set_metadata(activity_data)
@@ -67,13 +69,17 @@ class ActivitiesSvc:
 
     def __create_activity(self, activity_data):
         if activity_data.engagement is None:
-            msg = "Engagement provided is a None object, be careful not to generate " \
-                  "description and metadata with engagement properties."
+            msg = "Engagement provided is a None object, " +\
+                "be careful not to generate description and metadata " +\
+                "with engagement properties."
             logger.warn(msg)
-        if activity_data.owner and not isinstance(activity_data.owner, IceUserProfile):
-            raise ValueError("owner should be IceUserProfile, was %r", activity_data.owner)
+        if activity_data.owner and not isinstance(activity_data.owner,
+                                                  IceUserProfile):
+            raise ValueError(
+                "owner should be IceUserProfile, was %r", activity_data.owner)
         if activity_data.description is None:
-            logger.warn('createActivity called with description=None; setting to ""')
+            logger.warn(
+                'createActivity called with description=None; setting to ""')
             activity_data.description = ''
 
         new_activity = Activity.objects.create(
@@ -93,50 +99,75 @@ class ActivitiesSvc:
 
             if activity_data.owner is None:
                 if activity_data.engagement:
-                    users_to_notify = activity_data.engagement.engagement_team.all()
+                    users_to_notify = activity_data.engagement.\
+                        engagement_team.all()
             else:
                 users_to_notify.append(activity_data.owner)
 
             for user_to_notify in users_to_notify:
-                new_notification = Notification.objects.create(user=user_to_notify, activity=new_activity)
+                new_notification = Notification.objects.create(
+                    user=user_to_notify, activity=new_activity)
                 new_activity.notification_set.add(new_notification)
                 user_to_notify.notification_set.add(new_notification)
                 new_notification.save()
                 from engagementmanager.apps import bus_service
-                bus_service.send_message(NewNotificationMessage(new_notification))
+                bus_service.send_message(
+                    NewNotificationMessage(new_notification))
 
     def pull_recent_activities(self, engagement, recent_activities_limit):
-        """ expected: engagement object (Activity), recent_activities_limit (integer) - number of recent activities
+        """ expected: engagement object (Activity), recent_activities_limit
+        (integer) - number of recent activities
         result: Top-X Dict Activity objects (sort by create_time) """
         logger.debug("Pulling top X activities from DB")
         activities = Activity.objects.filter(
-            engagement=engagement, activity_owner=None).order_by('-create_time')[:recent_activities_limit]
+            engagement=engagement, activity_owner=None).order_by(
+                '-create_time')[:recent_activities_limit]
         return activities
 
     def set_description(self, activity_data):
         dt = timezone.now()
         description = ''
 
-        if isinstance(activity_data, activities_data.UserJoinedEngagementActivityData):
+        if isinstance(activity_data, activities_data.
+                      UserJoinedEngagementActivityData):
             description = "##user_name## joined ##vf_name## "
-        elif isinstance(activity_data, activities_data.UpdateNextStepsActivityData):
-            description = "##user_name## " + activity_data.update_type.lower() + " a next step"
-        elif isinstance(activity_data, activities_data.VFProvisioningActivityData):
-            description = "Failed Gitlab and/or Jenkins Provision ##vf_name##: " + activity_data.description
-        elif isinstance(activity_data, activities_data.TestFinishedActivityData):
-            description = "Failure in Jenkins Job: " + activity_data.description
-        elif isinstance(activity_data, activities_data.ChangeEngagementStageActivityData):
-            description = "Engagement stage is now " + activity_data.stage + " for the following VF: ##vf_name##"
-        elif isinstance(activity_data, activities_data.DeleteNextStepsActivityData):
+        elif isinstance(activity_data, activities_data.
+                        UpdateNextStepsActivityData):
+            description = "##user_name## " + activity_data.\
+                update_type.lower() + " a next step"
+        elif isinstance(activity_data, activities_data.
+                        VFProvisioningActivityData):
+            description = "Failed Gitlab and/or Jenkins Provision " +\
+                "##vf_name##: " + activity_data.description
+        elif isinstance(activity_data, activities_data.
+                        TestFinishedActivityData):
+            description = "Failure in Jenkins Job: "\
+                + activity_data.description
+        elif isinstance(activity_data, activities_data.
+                        ChangeEngagementStageActivityData):
+            description = "Engagement stage is now " + \
+                activity_data.stage + " for the following VF: ##vf_name##"
+        elif isinstance(activity_data, activities_data.
+                        DeleteNextStepsActivityData):
+            description = activity_data.user.full_name + \
+                " has deleted a next step at " + \
+                dt.strftime("%Y-%m-%d %H:%M:%S")
+        elif isinstance(activity_data, activities_data.
+                        NoticeEmptyEngagementData):
+            description = "You have not added any parts of the VNF package " +\
+                "to your engagement ##vf_name## since it was created " \
+                + activity_data.delta_days_from_creation + \
+                " days ago. Do note that if you have not added any " +\
+                "parts of the VNF package by " + \
+                activity_data.max_empty_time + ", we will be automatically " +\
+                "archive it."
+        elif isinstance(activity_data, activities_data.
+                        AddNextStepsActivityData):
             description = activity_data.user.full_name + \
-                " has deleted a next step at " + dt.strftime("%Y-%m-%d %H:%M:%S")
-        elif isinstance(activity_data, activities_data.NoticeEmptyEngagementData):
-            description = "You have not added any parts of the VNF package to your engagement ##vf_name## since it was created " + activity_data.delta_days_from_creation +\
-                " days ago. Do note that if you have not added any parts of the VNF package by " + \
-                activity_data.max_empty_time + ", we will be automatically archive it."
-        elif isinstance(activity_data, activities_data.AddNextStepsActivityData):
-            description = activity_data.user.full_name + " has added a next step at " + dt.strftime("%Y-%m-%d %H:%M:%S")
-        elif isinstance(activity_data, activities_data.SSHKeyAddedActivityData):
+                " has added a next step at " + dt.strftime(
+                    "%Y-%m-%d %H:%M:%S")
+        elif isinstance(activity_data, activities_data.
+                        SSHKeyAddedActivityData):
             if activity_data.action == 'add':
                 description = "You have added an SSH key to your profile"
             elif activity_data.action == 'set':
@@ -150,11 +181,15 @@ class ActivitiesSvc:
         dt = timezone.now()
         metadata = {}
 
-        if isinstance(activity_data, activities_data.UserJoinedEngagementActivityData):
+        if isinstance(activity_data, activities_data.
+                      UserJoinedEngagementActivityData):
             activity_data.is_notification = True
-            metadata['notification_subject'] = "Someone has joined the " + activity_data.vf.name + " team"
-            metadata['notification_message'] = activity_data.user.full_name + " joined the " + activity_data.vf.name + \
-                " team. You can reach the dashboard by going to this link: " + \
+            metadata['notification_subject'] = "Someone has joined the " + \
+                activity_data.vf.name + " team"
+            metadata['notification_message'] = activity_data.user.full_name +\
+                " joined the " + activity_data.vf.name + \
+                " team. You can reach the dashboard by " +\
+                "going to this link: " + \
                 Constants.dashboard_href
             metadata['macros'] = {
                 '##vf_name##': {
@@ -168,7 +203,8 @@ class ActivitiesSvc:
                     'long': activity_data.user.email,
                 }
             }
-        elif isinstance(activity_data, activities_data.UpdateNextStepsActivityData):
+        elif isinstance(activity_data, activities_data.
+                        UpdateNextStepsActivityData):
             metadata['macros'] = {
                 '##user_name##': {
                     'type': 'popover',
@@ -176,15 +212,24 @@ class ActivitiesSvc:
                     'long': activity_data.user.email,
                 }
             }
-        elif isinstance(activity_data, activities_data.NoticeEmptyEngagementData):
+        elif isinstance(activity_data, activities_data.
+                        NoticeEmptyEngagementData):
             activity_data.is_notification = True
-            metadata['notification_subject'] = "Inactive Engagement Alert - " + activity_data.vf_name
+            metadata['notification_subject'] = "Inactive Engagement Alert - "\
+                + activity_data.vf_name
 
-            metadata['notification_message'] = "We have noticed that you have not added any parts of the VNF package to your engagement <em>" +\
-                activity_data.engagement.engagement_manual_id + ": " + activity_data.vf_name + "</em> since it was created " + activity_data.delta_days_from_creation +\
-                " days ago. If you have any questions around how you add your VNF package please check the relevant parts of the online documentation.<br/><br/>" +\
-                "Do note that if you have not added any parts of the VNF package by " + \
-                activity_data.max_empty_time + ", we will be automatically archive it."
+            metadata['notification_message'] = "We have noticed that " +\
+                "you have not added any parts of the VNF " +\
+                "package to your engagement <em>"\
+                + activity_data.engagement.engagement_manual_id + ": "\
+                + activity_data.vf_name + "</em> since it was created "\
+                + activity_data.delta_days_from_creation +\
+                " days ago. If you have any questions around how you add " +\
+                "your VNF package please check the relevant parts of the " +\
+                "online documentation.<br/><br/>" +\
+                "Do note that if you have not added any parts of the VNF " +\
+                "package by " + activity_data.max_empty_time + ", we will " +\
+                "be automatically archive it."
 
             metadata['macros'] = {
                 '##vf_name##': {
@@ -194,9 +239,11 @@ class ActivitiesSvc:
                 },
             }
 
-        elif isinstance(activity_data, activities_data.VFProvisioningActivityData):
+        elif isinstance(activity_data, activities_data.
+                        VFProvisioningActivityData):
             activity_data.is_notification = True
-            metadata['notification_subject'] = "Failed Gitlab and/or Jenkins Provision: " + activity_data.vf.name
+            metadata['notification_subject'] = "Failed Gitlab and/or " +\
+                "Jenkins Provision: " + activity_data.vf.name
             metadata['notification_message'] = activity_data.description
             metadata['macros'] = {
                 '##vf_name##': {
@@ -205,16 +252,19 @@ class ActivitiesSvc:
                     'eng_uuid': activity_data.vf.engagement.uuid,
                 },
             }
-        elif isinstance(activity_data, activities_data.TestFinishedActivityData):
+        elif isinstance(activity_data, activities_data.
+                        TestFinishedActivityData):
             activity_data.is_notification = True
             metadata['notification_subject'] = "Failed test_finished signal "
             metadata['notification_message'] = activity_data.description
-        elif isinstance(activity_data, activities_data.ChangeEngagementStageActivityData):
+        elif isinstance(activity_data, activities_data.
+                        ChangeEngagementStageActivityData):
             activity_data.is_notification = True
-            metadata['notification_subject'] = "Engagement stage was changed for the following VF: " + \
-                                               activity_data.vf.name
-            metadata['notification_message'] = "Engagement stage is now " + activity_data.stage +\
-                                               " for the following VF: " + activity_data.vf.name
+            metadata['notification_subject'] = "Engagement stage was " +\
+                "changed for the following VF: " + activity_data.vf.name
+            metadata['notification_message'] = "Engagement stage is now " \
+                + activity_data.stage + " for the following VF: " \
+                + activity_data.vf.name
             metadata['macros'] = {
                 '##vf_name##': {
                     'type': 'select_engagement',
@@ -222,17 +272,22 @@ class ActivitiesSvc:
                     'eng_uuid': activity_data.engagement.uuid,
                 }
             }
-        elif isinstance(activity_data, activities_data.AddNextStepsActivityData):
+        elif isinstance(activity_data,
+                        activities_data.AddNextStepsActivityData):
             activity_data.is_notification = True
-            metadata['notification_subject'] = "New next-step was added to the following VF: " + activity_data.vf.name
-            metadata['notification_message'] = activity_data.user.full_name + " has added a next step at " +\
+            metadata['notification_subject'] = "New next-step was " +\
+                "added to the following VF: " + activity_data.vf.name
+            metadata['notification_message'] = activity_data.user.full_name \
+                + " has added a next step at " +\
                 dt.strftime("%Y-%m-%d %H:%M:%S") + \
                 ", You can reach the dashboard by going to this link: " \
                 + Constants.dashboard_href
-        elif isinstance(activity_data, activities_data.SSHKeyAddedActivityData):
+        elif isinstance(
+                activity_data, activities_data.SSHKeyAddedActivityData):
             activity_data.is_notification = True
             metadata['notification_subject'] = "You have set an SSH key"
-            metadata['notification_message'] = "You have set an SSH key to your profile. Please allow some time for" \
-                                               " it to propagate across the system."
+            metadata['notification_message'] = "You have set an SSH key to " +\
+                "your profile. Please allow some time for it to propagate " +\
+                "across the system."
 
         activity_data.metadata = metadata
index c850b4a..7a30d0e 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -39,8 +39,8 @@
 import json
 from enum import Enum
 import rest_framework
-from engagementmanager.models import Role, Engagement, Checklist, NextStep, VFC, \
-    VF, ChecklistDecision, Notification
+from engagementmanager.models import Role, Engagement, Checklist, NextStep, \
+    VFC, VF, ChecklistDecision, Notification
 from engagementmanager.utils.constants import Roles
 from engagementmanager.utils.request_data_mgr import request_data_mgr
 from engagementmanager.service.logging_service import LoggingServiceFactory
@@ -119,8 +119,10 @@ class Permissions(Enum):
 
 class AuthorizationService:
     """
-    The Authorization Service detemines whether a given action is authorized for a specific user.
-    The method: is_user_able_to performs the authorization check given a user and an action (from Permissions ENUM)
+    The Authorization Service detemines whether a given action is authorized
+    for a specific user.
+    The method: is_user_able_to performs the authorization check given a user
+    and an action (from Permissions ENUM)
     """
     role_standard_user = None
     role_el = None
@@ -129,8 +131,10 @@ class AuthorizationService:
 
     def __get_role_checks(self, user, action):
         """
-        Returns the list of auth checks that should be performed per user action.
-        Returns None if the action is not listed in the authorized actions of the given user.
+        Returns the list of auth checks that should be \
+        performed per user action.
+        Returns None if the action is not listed in the \
+        authorized actions of the given user.
         """
         result = None
 
@@ -138,33 +142,40 @@ class AuthorizationService:
         if (user.role == self.role_el) and (action in self.el_permissions):
             result = self.el_permissions[action]
         # ADMIN #
-        elif user.role == self.role_admin and action in self.admin_permissions:
+        elif user.role == self.role_admin and action in \
+                self.admin_permissions:
             result = self.admin_permissions[action]
         # ADMIN Read only #
-        elif user.role == self.role_admin_ro and action in self.admin_ro_permissions:
+        elif user.role == self.role_admin_ro and action in \
+                self.admin_ro_permissions:
             result = self.admin_ro_permissions[action]
         # STANDRARD_USER #
-        if user.role == self.role_standard_user and action in self.standard_user_permissions:
+        if user.role == self.role_standard_user and \
+                action in self.standard_user_permissions:
             result = self.standard_user_permissions[action]
 
         return result
 
     def __require_eng_membership(self, user, action, **kwargs):
         """
-        Determines whether a given user is part of engagement team by the eng uuid
+        Determines whether a given user is part of engagement \
+        team by the eng uuid.
         user = IceUser
         eng = UUID as a string
 
         :param user: user for auth check
         :param action: action for auth check
         :param kwargs: eng_uuid, checklist_uuid, ...
-        :return: Boolean, Message -> True/False if auth check succeeds/fails and a message describing auth failure
+        :return: Boolean, Message -> True/False if auth check \
+        succeeds/fails and a message describing auth failure
         """
         eng = kwargs['eng']
 
         try:
             # @UndefinedVariable
-            if (user.email == eng.reviewer.email or user.email == eng.peer_reviewer.email or user.role.name == Roles.admin.name):
+            if (user.email == eng.reviewer.email or
+                user.email == eng.peer_reviewer.email or
+                    user.role.name == Roles.admin.name):
                 return True, 'OK'
             else:
                 # validate if user in Team
@@ -173,33 +184,39 @@ class AuthorizationService:
                 else:
                     return False, ""
         except Engagement.DoesNotExist:
-            msg = 'User ' + user.email + ' is not a member of engagement: ' + eng.uuid + \
-                ' / User is a not peer reviewer / admin of the engagement / Engagement wasnt found while fetching from DB'
+            msg = 'User ' + user.email + ' is not a member of engagement: ' + \
+                eng.uuid + \
+                ' / User is a not peer reviewer / admin of the ' +\
+                'engagement / Engagement wasnt found while fetching from DB'
             logger.info(msg)
             return False, msg
         except Exception as e:
             print(e)
-            msg = 'A general error occurred while trying to validate that User ' + \
-                user.email + ' is a member of engagement '
+            msg = 'A general error occurred while trying to validate ' +\
+                'that User ' + user.email + ' is a member of engagement '
             logger.info(msg + " Error: " + str(e))
             return False, msg
 
     def __require_peer_review_ownership(self, user, action, **kwargs):
         """
-        Determines whether the given user is the peer reviewer of the checklist
+        Determines whether the given user is \
+        the peer reviewer of the checklist
         """
 
         cl = kwargs['cl']
         eng = kwargs['eng']
         if cl and eng:
             # @UndefinedVariable
-            if (eng.peer_reviewer == user and cl.owner == user) or (user.role.name == Roles.admin.name):
+            if (eng.peer_reviewer == user and cl.owner == user) or \
+                    (user.role.name == Roles.admin.name):
                 return True, 'OK'
             else:
-                return False, 'User is either not the owner of the checklist or not a peer reviewer of the checklist'
+                return False, 'User is either not the owner of ' +\
+                    'the checklist or not a peer reviewer of the checklist'
         else:
             logger.error(
-                'Internal Error - Checklist/Engagement not found while trying to check permissions for user ' + user.email)
+                'Internal Error - Checklist/Engagement not found while ' +
+                'trying to check permissions for user ' + user.email)
             return False, 'Internal Error - Checklist not found'
 
     def __require_cl_ownership(self, user, action, **kwargs):
@@ -216,7 +233,8 @@ class AuthorizationService:
                 return False, 'User is not the owner of the checklist'
         else:
             logger.error(
-                'Internal Error - Checklist not found while trying to check permissions for user ' + user.email)
+                'Internal Error - Checklist not found while trying to ' +
+                'check permissions for user ' + user.email)
             return False, 'Internal Error - Checklist not found'
 
     def __require_el_of_engagement(self, user, action, **kwargs):
@@ -234,7 +252,8 @@ class AuthorizationService:
             return False, 'Role Not authorized'
         else:
             logger.error(
-                'Internal Error - Engagement not found while trying to check permissions for user ' + user.email)
+                'Internal Error - Engagement not found while trying to ' +
+                'check permissions for user ' + user.email)
             return False, 'Internal Error - Checklist not found'
 
     def __noop(self, user, action, **kwargs):
@@ -266,7 +285,8 @@ class AuthorizationService:
     ######################
     """
     Each Permission Map is composed of the following key-val pairs:
-    Key='Action (Permission ENUM)' --> Value='Set of Checks to perform on this action.'
+    Key='Action (Permission ENUM)' --> Value='Set of Checks to
+    perform on this action.'
     """
     el_permissions = {
         Permissions.add_vf: {__noop},
@@ -289,16 +309,20 @@ class AuthorizationService:
         Permissions.set_checklist_decision: {__require_cl_ownership},
         Permissions.add_checklist_audit_log: {__require_cl_ownership},
         Permissions.delete_checklist_audit_log: {__require_cl_ownership},
-        Permissions.el_review_checklist: {__require_cl_ownership, __require_eng_membership},
+        Permissions.el_review_checklist: {__require_cl_ownership,
+                                          __require_eng_membership},
         Permissions.peer_review_checklist: {__require_peer_review_ownership},
-        Permissions.handoff_checklist: {__require_cl_ownership, __require_eng_membership},
-        Permissions.add_checklist_nextstep: {__require_cl_ownership, __require_eng_membership},
+        Permissions.handoff_checklist: {__require_cl_ownership,
+                                        __require_eng_membership},
+        Permissions.add_checklist_nextstep: {__require_cl_ownership,
+                                             __require_eng_membership},
         Permissions.edit_nextstep: {__require_eng_membership},
         Permissions.is_el_of_eng: {__require_el_of_engagement},
         Permissions.update_personal_next_step: {__noop},
         Permissions.create_checklist_audit_log: {__require_eng_membership},
         Permissions.create_checklist_decision: {__require_eng_membership},
-        Permissions.update_checklist_state: {__require_cl_ownership, __require_eng_membership},
+        Permissions.update_checklist_state: {__require_cl_ownership,
+                                             __require_eng_membership},
         Permissions.create_deployment_target_site: {__require_eng_membership},
         Permissions.star_an_engagement: {__noop},
         Permissions.invite: {__require_eng_membership},
@@ -338,7 +362,8 @@ class AuthorizationService:
         Permissions.update_vf: {__require_eng_membership},
         Permissions.reset_nextstep: {__require_eng_membership},
         Permissions.update_personal_next_step: {__noop},
-        Permissions.update_checklist_state: {__require_cl_ownership, __require_eng_membership},
+        Permissions.update_checklist_state: {__require_cl_ownership,
+                                             __require_eng_membership},
         Permissions.create_deployment_target_site: {__require_eng_membership},
         Permissions.star_an_engagement: {__noop},
         Permissions.invite: {__require_eng_membership},
@@ -368,7 +393,8 @@ class AuthorizationService:
     admin_permissions.update(  # Add Extra permissions to admin
         {
             Permissions.admin_approve_checklist: {__require_cl_ownership},
-            Permissions.remove_from_engagement_team: {__require_eng_membership},
+            Permissions.remove_from_engagement_team: {
+                __require_eng_membership},
             Permissions.view_checklist_template: {__noop},
             Permissions.edit_checklist_template: {__noop},
             Permissions.archive_engagement: {__noop},
@@ -403,7 +429,8 @@ class AuthorizationService:
     )
 
     def __init__(self):
-        self.role_standard_user = self.role_el = self.role_admin = self.role_admin_ro = None
+        self.role_standard_user = self.role_el = self.role_admin = \
+            self.role_admin_ro = None
         self.__load_roles_from_db()
 
     def check_permissions(self, user, action, eng_uuid, role, eng, cl):
@@ -411,7 +438,8 @@ class AuthorizationService:
         # role and action
         perm_checks = self.__get_role_checks(user, action)
         if not perm_checks:
-            # Permission Checks were not found, it means that the action is not listed in the permitted
+            # Permission Checks were not found, it means that the action is
+            # not listed in the permitted
             # actions for the role of the user
             ret = False, 'Role ' + str(role.name) + ' is not permitted to ' + \
                 str(action.name) + '/ Engagement: ' + \
@@ -456,7 +484,8 @@ class AuthorizationService:
                 eng = Engagement.objects.get(uuid=eng_uuid)
         except Engagement.DoesNotExist:
             logger.error(
-                'ENG was not found while checking permissions... returning 500')
+                'ENG was not found while checking permissions... ' +
+                'returning 500')
             return None, None
 
         try:
@@ -490,7 +519,7 @@ class AuthorizationService:
         else:
             # Extract eng_uuid from request body
             for arg in args:
-                if eng_uuid != None:
+                if eng_uuid:
                     break
                 if isinstance(arg, rest_framework.request.Request):
                     try:
@@ -512,7 +541,8 @@ class AuthorizationService:
                                 if 'eng_uuid' in data and data['eng_uuid']:
                                     eng_uuid = data['eng_uuid']
 
-                                elif 'engagement_uuid' in data and data['engagement_uuid']:
+                                elif 'engagement_uuid' in data and \
+                                        data['engagement_uuid']:
                                     eng_uuid = data['engagement_uuid']
                     except Exception as e:
                         print(e)
@@ -523,80 +553,88 @@ class AuthorizationService:
         # Extract CHECKLIST_UUID #
         if 'checklistUuid' in kwargs:
             request_data_mgr.set_cl_uuid(kwargs['checklistUuid'])
-            if (eng_uuid == None):
+            if not eng_uuid:
                 try:
                     eng_uuid = Checklist.objects.get(
                         uuid=request_data_mgr.get_cl_uuid()).engagement.uuid
                     request_data_mgr.set_eng_uuid(eng_uuid)
                 except Checklist.DoesNotExist:
-                    raise Exception("auth service couldn't fetch Checklist by checklist uuid=" +
+                    raise Exception("auth service couldn't fetch Checklist " +
+                                    "by checklist uuid=" +
                                     request_data_mgr.get_cl_uuid())
                 except Exception as e:
                     raise Exception(
-                        "Failed fetching engagement uuid from checklist " + request_data_mgr.get_cl_uuid())
+                        "Failed fetching engagement uuid from checklist "
+                        + request_data_mgr.get_cl_uuid())
 
         # Extract engagement by NEXTSTEP_UUID #
         if 'ns_uuid' in kwargs:
             request_data_mgr.set_ns_uuid(kwargs['ns_uuid'])
-            if (eng_uuid == None):
+            if not eng_uuid:
                 next_step = None
                 try:
                     next_step = NextStep.objects.get(
                         uuid=request_data_mgr.get_ns_uuid())
                 except NextStep.DoesNotExist:
-                    raise Exception("auth service couldn't fetch NextStep by nextstep uuid=" +
+                    raise Exception("auth service couldn't" +
+                                    "fetch NextStep by nextstep uuid=" +
                                     request_data_mgr.get_ns_uuid())
 
                 try:
                     eng_uuid = next_step.engagement.uuid
                     request_data_mgr.set_eng_uuid(eng_uuid)
-                except:
-                    # If we've gotten here it means that the next_step doesn't have attached
+                except BaseException:
+                    # If we've gotten here it means that the next_step
+                    # doesn't have attached
                     # engagement (e.g personal next_step)
                     pass
 
         # Extract engagement by VFC
         if ('uuid' in kwargs):
             from engagementmanager.rest.vfc import VFCRest
-            if (isinstance(args[0], VFCRest) == True):
+            if (isinstance(args[0], VFCRest)):
                 try:
                     vfc = VFC.objects.get(uuid=kwargs['uuid'])
-                    if (eng_uuid == None):
+                    if not eng_uuid:
                         eng_uuid = vfc.vf.engagement.uuid
                         request_data_mgr.set_eng_uuid(eng_uuid)
                 except VFC.DoesNotExist:
                     raise Exception(
-                        "auth service couldn't fetch vfc by vfc uuid=" + kwargs['uuid'])
+                        "auth service couldn't fetch vfc by vfc uuid="
+                        + kwargs['uuid'])
 
         # Extract engagement by VF (unfortunately the url exposed by the server
         # get uuid as a parameter and serve both vf and vfc APIs) #
-        if 'vf_uuid' in kwargs and eng_uuid == None:
+        if 'vf_uuid' in kwargs and not eng_uuid:
             try:
                 eng_uuid = VF.objects.get(
                     uuid=kwargs['vf_uuid']).engagement.uuid
                 request_data_mgr.set_eng_uuid(eng_uuid)
             except VF.DoesNotExist:
                 logger.error(
-                    "Prepare_data_for_auth: Couldn't fetch engagement object from VF, trying to fetch from VFC...")
+                    "Prepare_data_for_auth: Couldn't fetch engagement " +
+                    "object from VF, trying to fetch from VFC...")
                 vfc = None
                 try:
                     vfc = VFC.objects.get(uuid=kwargs['vf_uuid'])
-                    if (vfc != None):
+                    if vfc:
                         eng_uuid = vfc.vf.engagement.uuid
                         request_data_mgr.set_eng_uuid(eng_uuid)
                 except VFC.DoesNotExist:
                     logger.error(
-                        "Prepare_data_for_auth: Couldn't fetch engagement object from VFC")
+                        "Prepare_data_for_auth: Couldn't fetch engagement " +
+                        "object from VFC")
 
         # Extract engagement by ChecklistDecision
-        if 'decision_uuid' in kwargs and eng_uuid == None:
+        if 'decision_uuid' in kwargs and not eng_uuid:
             try:
                 eng_uuid = ChecklistDecision.objects.get(
                     uuid=kwargs['decision_uuid']).checklist.engagement.uuid
                 request_data_mgr.set_eng_uuid(eng_uuid)
             except ChecklistDecision.DoesNotExist:
                 logger.error(
-                    "Prepare_data_for_auth: Couldn't fetch engagement object from ChecklistDecision")
+                    "Prepare_data_for_auth: Couldn't fetch " +
+                    "engagement object from ChecklistDecision")
 
         # Extract notification uuid for permission check
         if 'notif_uuid' in kwargs:
index 93e48f8..b6b34e6 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -43,7 +43,8 @@ from engagementmanager.service.logging_service import LoggingServiceFactory
 
 class BaseSvc():
     '''
-    classdocs This is the base abstract class of all ice Services delegated from the Rest layer
+    classdocs This is the base abstract class of all ice Services \
+    delegated from the Rest layer
     '''
     __metaclass__ = ABCMeta
 
index 5096fbb..0595c7b 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -36,7 +36,8 @@
 # ============LICENSE_END============================================
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
-from engagementmanager.bus.handlers.service_bus_base_handler import ServiceBusBaseHandler
+from engagementmanager.bus.handlers.service_bus_base_handler \
+    import ServiceBusBaseHandler
 
 from engagementmanager.utils.vvp_exceptions import VvpGeneralException
 
@@ -49,7 +50,9 @@ class BusService:
 
     def register(self, handler, message_type):
         if not isinstance(handler, ServiceBusBaseHandler):
-            raise VvpGeneralException("You can't register handler which is not from type of ServiceBusBaseHandler")
+            raise VvpGeneralException(
+                "You can't register handler which is not from type " +
+                "of ServiceBusBaseHandler")
 
         handler_pair = self.__get_or_create_handler_pair(message_type)
         handler_pair["handlers"].append(handler)
index f726950..84f0d9b 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -37,7 +37,8 @@
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
 import json
-from engagementmanager.models import ChecklistDecision, ChecklistAuditLog, Checklist
+from engagementmanager.models import ChecklistDecision,\
+    ChecklistAuditLog, Checklist
 from engagementmanager.serializers import ThinChecklistAuditLogModelSerializer
 from engagementmanager.service.logging_service import LoggingServiceFactory
 
@@ -46,11 +47,14 @@ logger = LoggingServiceFactory.get_logger()
 
 def addAuditLogToDecision(decision, description, user, category=''):
     """
-    expected: decisionUuid(string), description(string), user(object), category is optional(string)
-    result: new auditlog object would be create and attached to a decision object.
+    expected: decisionUuid(string), description(string),\
+     user(object), category is optional(string)
+    result: new auditlog object would be create and \
+    attached to a decision object.
     """
     audit = ChecklistAuditLog.objects.create(decision=decision,
-                                             description=description, category=category, creator=user)
+                                             description=description,
+                                             category=category, creator=user)
     auditData = ThinChecklistAuditLogModelSerializer(audit).data
     return auditData
 
@@ -58,10 +62,11 @@ def addAuditLogToDecision(decision, description, user, category=''):
 def getAuditLogsWithDecision(decisionUuid, user):
     """
     expected: decisionUuid(string), user(object)
-    result: all audit logs objects that attached to a decision would be returned in a json.
+    result: all audit logs objects that attached to a decision \
+    would be returned in a json.
     """
     data = dict()
-    if checklistUuid == '' or not user:  # @UndefinedVariable
+    if decisionUuid == '' or not user:
         msg = "checklistUuid or user == None"
         logger.error(msg)
         msg = "AuditLogs were not retrieved due to bad parameters"
@@ -69,18 +74,22 @@ def getAuditLogsWithDecision(decisionUuid, user):
 
     decision = ChecklistDecision.objects.get(uuid=decisionUuid)
     audits = ChecklistAuditLog.objects.filter(decision=decision)
-    data['audits'] = ThinChecklistAuditLogModelSerializer(audits, many=True).data
+    data['audits'] = ThinChecklistAuditLogModelSerializer(
+        audits, many=True).data
     auditsData = json.dumps(data, ensure_ascii=False)
     return auditsData
 
 
 def addAuditLogToChecklist(checklist, description, user, category=''):
     """
-    expected: checklistUuid(string), description(string), user(object), category is optional(string)
-    result: new auditlog object would be create and attached to a checklist object.
+    expected: checklistUuid(string), description(string), user(object), \
+    category is optional(string)
+    result: new auditlog object would be create and attached \
+    to a checklist object.
     """
     audit = ChecklistAuditLog.objects.create(checklist=checklist,
-                                             description=description, category=category, creator=user)
+                                             description=description,
+                                             category=category, creator=user)
     auditData = ThinChecklistAuditLogModelSerializer(audit).data
     logger.debug("audit log was successfully updated")
     return auditData
@@ -89,7 +98,8 @@ def addAuditLogToChecklist(checklist, description, user, category=''):
 def getAuditLogsWithChecklist(checklistUuid, user):
     """
     expected: checklistUuid(string), user(object)
-    result: all audit logs objects that attached to a checklist would be returned in a json.
+    result: all audit logs objects that attached to a checklist \
+    would be returned in a json.
     """
     data = dict()
     if checklistUuid == '' or not user:  # @UndefinedVariable
@@ -100,6 +110,7 @@ def getAuditLogsWithChecklist(checklistUuid, user):
 
     checklist = Checklist.objects.get(uuid=checklistUuid)
     audits = ChecklistAuditLog.objects.filter(checklist=checklist)
-    data['audits'] = ThinChecklistAuditLogModelSerializer(audits, many=True).data
+    data['audits'] = ThinChecklistAuditLogModelSerializer(
+        audits, many=True).data
     auditsData = json.dumps(data, ensure_ascii=False)
     return auditsData
index e94c059..14007fe 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -52,7 +52,8 @@ logger = LoggingServiceFactory.get_logger()
 def setDecision(decisionUuid, user, value):
     logger.debug("attempting setDecision(user=%r, value=%r)...", user, value)
 
-    if not decisionUuid or not user or value not in CheckListDecisionValue.__members__:
+    if not decisionUuid or not user or value not in \
+            CheckListDecisionValue.__members__:
         msg = "decisionUuid or value are empty or invalid / user == None"
         logger.error(msg)
         msg = "decision wasn't change due to bad parameters"
@@ -61,48 +62,64 @@ def setDecision(decisionUuid, user, value):
     decision = ChecklistDecision.objects.get(uuid=decisionUuid)
     checklist = decision.checklist
 
-    # @UndefinedVariable
-    if (checklist.owner.email == user.email and user.role.name == Roles.el.name) or (user.role.name == Roles.admin.name):
-        if checklist.state == CheckListState.review.name:  # @UndefinedVariable
+    if (checklist.owner.email == user.email and
+            user.role.name == Roles.el.name) or \
+            (user.role.name == Roles.admin.name):
+        if checklist.state == CheckListState.review.name:
             if decision.review_value != value:
                 decision.review_value = value
                 decision.save()
-                msg = "review_value was successfully changed for decision: " + decision.uuid + " , value: " + value
+                msg = "review_value was successfully " +\
+                    "changed for decision: " + \
+                    decision.uuid + " , value: " + value
             else:
-                msg = "review_value was already the same: " + decision.uuid + " , value: " + value
+                msg = "review_value was already the same: " + \
+                    decision.uuid + " , value: " + value
             logger.debug(msg)
-        elif checklist.state == CheckListState.peer_review.name:  # @UndefinedVariable
+        elif checklist.state == CheckListState.peer_review.name:
             if decision.peer_review_value != value:
                 decision.peer_review_value = value
                 decision.save()
-                msg = "peer_review_value was successfully changed for decision: " + decision.uuid + " , value: " + value
+                msg = "peer_review_value was successfully " +\
+                    "changed for decision: " + decision.uuid +\
+                    " , value: " + value
             else:
-                msg = "review_value was already the same: " + decision.uuid + " , value: " + value
+                msg = "review_value was already the same: " + \
+                    decision.uuid + " , value: " + value
             logger.debug(msg)
-        elif checklist.state == CheckListState.automation.name:  # @UndefinedVariable
+        elif checklist.state == CheckListState.automation.name:
             if decision.review_value != value:
                 decision.peer_review_value = value
                 decision.save()
-                msg = "peer_review_value was successfully changed for decision: " + decision.uuid + " , value: " + value
+                msg = "peer_review_value was successfully " +\
+                    "changed for decision: " + decision.uuid +\
+                    " , value: " + value
             else:
-                msg = "review_value was already the same: " + decision.uuid + " , value: " + value
+                msg = "review_value was already the same: " + \
+                    decision.uuid + " , value: " + value
 
             if decision.review_value != value:
                 decision.review_value = value
                 decision.save()
-                msg = "review_value was successfully changed for decision: " + decision.uuid + " , value: " + value
+                msg = "review_value was successfully " +\
+                    "changed for decision: " + \
+                    decision.uuid + " , value: " + value
             else:
-                msg = "review_value was already the same: " + decision.uuid + " , value: " + value
+                msg = "review_value was already the same: " + \
+                    decision.uuid + " , value: " + value
             logger.debug(msg)
         else:
-            msg = "checklist's state is an invalid state for the decision change and should be different"
+            msg = "checklist's state is an invalid state for the decision " +\
+                "change and should be different"
             logger.error(msg)
-            msg = "decision wasn't change, Checklist's state is not allowed to change the decision"
+            msg = "decision wasn't change, " +\
+                "Checklist's state is not allowed to change the decision"
             raise MethodNotAllowed(msg)
         return msg
     else:
         msg = "user isn't an EL / The User (" + user.full_name + \
-            ") tried to change the decision while the current owner is " + checklist.owner.full_name
+            ") tried to change the decision while the current owner is " \
+            + checklist.owner.full_name
         logger.error(logEncoding(msg))
         msg = "Action is forbidden"
         raise PermissionDenied(msg)
@@ -110,13 +127,16 @@ def setDecision(decisionUuid, user, value):
 
 def getDecision(decisionUuid, user):
     data = dict()
-    if decisionUuid == '' or (not user and user.role.name == Roles.el.name):  # @UndefinedVariable
+    # @UndefinedVariable
+    if decisionUuid == '' or (not user and user.role.name == Roles.el.name):
         msg = "decisionUuid or (user == None / user.role != EL)"
         logger.error(msg)
-        msg = "decision wasn't retrieved due to bad parameters / you are not authorized"
+        msg = "decision wasn't retrieved due to bad parameters / " +\
+            "you are not authorized"
         raise KeyError(msg)
 
     decision = ChecklistDecision.objects.get(uuid=decisionUuid)
-    data['decision'] = ThinChecklistDecisionModelSerializer(decision, many=False).data
+    data['decision'] = ThinChecklistDecisionModelSerializer(
+        decision, many=False).data
     decisionData = json.dumps(data, ensure_ascii=False)
     return decisionData
index 0df7edd..9132a3c 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -43,12 +43,16 @@ from engagementmanager.apps import bus_service
 from engagementmanager.bus.messages.activity_event_message import \
     ActivityEventMessage
 from engagementmanager.git.git_manager import GitManager
-from engagementmanager.models import ChecklistTemplate, Checklist, Engagement, \
-    ChecklistAuditLog, ChecklistDecision, ChecklistLineItem, IceUserProfile, VF, \
+from engagementmanager.models import ChecklistTemplate, \
+    Checklist, Engagement, \
+    ChecklistAuditLog, ChecklistDecision, ChecklistLineItem, \
+    IceUserProfile, VF, \
     ChecklistSection, Role
 from engagementmanager.serializers import ThinChecklistModelSerializer, \
-    ThinChecklistAuditLogModelSerializer, ThinChecklistDecisionModelSerializer, \
-    ThinPostChecklistResponseModelSerializer, ChecklistTemplateModelSerializer, \
+    ThinChecklistAuditLogModelSerializer, \
+    ThinChecklistDecisionModelSerializer, \
+    ThinPostChecklistResponseModelSerializer, \
+    ChecklistTemplateModelSerializer, \
     ChecklistSectionModelSerializer, ChecklistLineItemModelSerializer
 from engagementmanager.service.checklist_audit_log_service import \
     addAuditLogToDecision, addAuditLogToChecklist
@@ -72,15 +76,19 @@ logger = LoggingServiceFactory.get_logger()
 
 
 class CheckListSvc(BaseSvc):
+
     def retreive_cl_files_for_engagment(self, eng_uuid):
         vf_associated_files_list = []
 
-        checklists_of_eng = Checklist.objects.filter(engagement__uuid=eng_uuid).exclude(
-            state=CheckListState.archive.name).exclude(state=CheckListState.closed.name)  # @UndefinedVariable
+        checklists_of_eng = Checklist.objects.filter(
+            engagement__uuid=eng_uuid).exclude(
+            state=CheckListState.archive.name).exclude(
+            state=CheckListState.closed.name)
 
         for checklistObj in checklists_of_eng:
             associated_files = json.loads(checklistObj.associated_files)
-            vf_associated_files_list = vf_associated_files_list + associated_files
+            vf_associated_files_list = \
+                vf_associated_files_list + associated_files
         return vf_associated_files_list
 
     def getDataForCreateNewChecklist(self, user, eng_uuid):
@@ -95,12 +103,14 @@ class CheckListSvc(BaseSvc):
         # Get all templates
         data = self.getChecklistTemplates()
 
-        data['checkListAssociatedFiles'] = self.gitManager.getRepoAssociatedFilesForUser(
+        data['checkListAssociatedFiles'] = \
+            self.gitManager.getRepoAssociatedFilesForUser(
             eng_uuid)
         return data
 
     def getChecklistTemplates(self, templateUuid=None):
-        """Return  checklist template with nested sections and their nested line items"""
+        """Return  checklist template with
+        nested sections and their nested line items"""
         data = dict()
         if not templateUuid:
             checkListTemplates = ChecklistTemplate.objects.all()
@@ -109,11 +119,11 @@ class CheckListSvc(BaseSvc):
                     checkListTemplates, many=True).data
             return data
         cl_template = ChecklistTemplate.objects.get(uuid=templateUuid)
-        if (cl_template != None):
+        if (cl_template is not None):
             data = ChecklistTemplateModelSerializer(
                 cl_template, many=False).data
             sections = ChecklistSection.objects.filter(template=cl_template)
-            if (sections != None):
+            if (sections is not None):
                 section_list = []
                 for sec in sections:
                     section_data = dict()
@@ -121,7 +131,8 @@ class CheckListSvc(BaseSvc):
                         sec, many=False).data
 
                     lineItems = ChecklistLineItem.objects.filter(section=sec)
-                    section_data['lineItems'] = ChecklistLineItemModelSerializer(
+                    section_data['lineItems'] = \
+                        ChecklistLineItemModelSerializer(
                         lineItems, many=True).data
                     section_list.append(section_data)
 
@@ -134,8 +145,10 @@ class CheckListSvc(BaseSvc):
         logger.debug(
             "Creating a new section. Section name = " + section['name'])
 
-        weight = int(ChecklistSection.objects.filter(template=templateObj).aggregate(
-            max_weight=Max('weight'))['max_weight'] or 0) + 1
+        weight = int(
+            ChecklistSection.objects.filter(
+                template=templateObj).aggregate(
+                max_weight=Max('weight'))['max_weight'] or 0) + 1
 
         newSection = ChecklistSection.objects.create(
             name=section.get('name', None),
@@ -147,11 +160,14 @@ class CheckListSvc(BaseSvc):
 
         return newSection
 
-    def createNewLineItemForSection(self, newSectionObj, listItem, templateObj):
+    def createNewLineItemForSection(
+            self, newSectionObj, listItem, templateObj):
         """Create new line item for a given section and template """
 
-        weight = int(ChecklistLineItem.objects.filter(section=newSectionObj).aggregate(
-            max_weight=Max('weight'))['max_weight'] or 0) + 1
+        weight = int(
+            ChecklistLineItem.objects.filter(
+                section=newSectionObj).aggregate(
+                max_weight=Max('weight'))['max_weight'] or 0) + 1
 
         ChecklistLineItem.objects.create(
             name=listItem['name'],
@@ -165,22 +181,27 @@ class CheckListSvc(BaseSvc):
             weight=weight)
 
     def delete(self, dict_structure, query_set, entity, isDirty):
-        """Generically find the xor result of the user input and the db data. Assumption: If entities exits in DB but not in user input they'll be deleted"""
-        uuid_client = [dict['uuid'] for dict in dict_structure]
+        """Generically find the xor result of the user input and the
+        db data. Assumption: If entities exits in DB but not in
+        user input they'll be deleted"""
+        uuid_client = [dictio['uuid'] for dictio in dict_structure]
         uuid_db = [record.uuid for record in query_set]
         uuids_to_delete = set(uuid_db) - set(uuid_client)
         for u_uid in uuids_to_delete:
             entity.objects.filter(uuid=u_uid).delete()
-            # Note: No need to delete ChecklistLineItem corresponding to this section
+            # Note: No need to delete ChecklistLineItem
+            # corresponding to this section
             # since there is a CASCADE operation on delete section
             isDirty[0] = True
 
     def editIfChanged(self, entity, uidict, fieldList):
-        """Generic function to check that set of fields are modified on a certain entity"""
+        """Generic function to check that set of fields
+        are modified on a certain entity"""
         isChanged = False
         for field in fieldList:
             if (field in uidict):
-                if (isChanged != True and entity.__dict__[field] == uidict[field]):
+                if (not isChanged and entity.__dict__[
+                        field] == uidict[field]):
                     isChanged = False
                 else:
                     entity.__dict__[field] = uidict[field]
@@ -198,13 +219,17 @@ class CheckListSvc(BaseSvc):
             isDirty[0] = True
 
     def updateLineItemFields(self, lineitem, li, isDirty):
-        if (self.editIfChanged(lineitem, li, ['name', 'description', 'validation_instructions', 'line_type'])):
+        if (self.editIfChanged(lineitem, li, [
+                'name', 'description',
+                'validation_instructions', 'line_type'])):
             lineitem.save()
             isDirty[0] = True
 
     def editChecklistTemplate(self, checklistTemplate):
         """edit the template+section+line-item of user input"""
-        NEW_ENTITY = "newEntity"  # this is an indication on top of the provided json to create the entity
+        # this is an indication on top of the provided json to create the
+        # entity
+        NEW_ENTITY = "newEntity"
         templateObj = None
         isDirty = [False]
         if ('uuid' in checklistTemplate):
@@ -239,7 +264,8 @@ class CheckListSvc(BaseSvc):
                             else:  # line-item was only updated
                                 lineitem = ChecklistLineItem.objects.get(
                                     uuid=li['uuid'])
-                                self.updateLineItemFields(lineitem, li, isDirty)
+                                self.updateLineItemFields(
+                                    lineitem, li, isDirty)
 
         executor.submit(self.decline_all_template_checklists,
                         isDirty[0], templateObj, request_data_mgr.get_user())
@@ -250,26 +276,36 @@ class CheckListSvc(BaseSvc):
 
         start = time.clock()
         try:
-            if (isDirty == True):
-                states_to_exclude = [CheckListState.archive.name, CheckListState.closed.name,
-                                     CheckListState.pending.name]  # @UndefinedVariable
+            if (isDirty):
+                states_to_exclude = [
+                    CheckListState.archive.name,
+                    CheckListState.closed.name,
+                    CheckListState.pending.name]  # @UndefinedVariable
                 checklists = Checklist.objects.filter(
                     template=templateObj).exclude(state__in=states_to_exclude)
                 logger.debug("Number of checklists=" +
-                                  str(len(checklists)))
+                             str(len(checklists)))
                 for checklist in checklists:
                     request_data_mgr.set_cl_uuid(checklist.uuid)
                     request_data_mgr.set_eng_uuid(checklist.engagement.uuid)
                     set_state(
-                        True,  # means that the checklist will be declined and a cloned one is created in PENDING status
+                        # means that the checklist will be declined and a
+                        # cloned one is created in PENDING status
+                        True,
                         checklist.uuid,
                         isMoveToAutomation=True,
-                        description="""Checklist {name} was rejected since its template ({template}) was edited/deleted""".format(
-                            name=checklist.name, template=templateObj.name),  # means the checklist will be triggered into automation cycle
+                        description="""Checklist {name} was rejected """ +\
+                        """since its template ({template}) was """ +\
+                        """edited/deleted""".format(
+                            name=checklist.name, template=templateObj.name),
+                        # means the checklist will be triggered into automation
+                        # cycle
                     )
         except Exception as e:
-            msg = """Something went wrong while trying to reject check-lists which its template was changed. template={template}. Error:""".format(
-                template=templateObj.name)
+            msg = """Something went wrong while trying to reject """ +\
+                """check-lists which its template was changed. """ +\
+                """template={template}. Error:""".format(
+                    template=templateObj.name)
             logger.error(msg + " " + str(e))
             raise e  # Don't remove try-except, it supports async invocation
         end = time.clock()
@@ -280,15 +316,17 @@ class CheckListSvc(BaseSvc):
         data = dict()
         checklist = None
 
-        if user.role.name == Roles.admin.name or user.role.name == Roles.admin_ro.name:  # @UndefinedVariable
+        if user.role.name == Roles.admin.name or \
+                user.role.name == Roles.admin_ro.name:
             checklist = Checklist.objects.get(uuid=checklistUuid)
         else:
             checklist = Checklist.objects.get(
                 Q(uuid=checklistUuid), Q(creator=user) | Q(owner=user))
 
         # CheckList
-        if checklist.state == CheckListState.archive.name:  # @UndefinedVariable
-            msg = "got a request for a checklist which is an archived one, might have been due to an admin edit of a checklist template."
+        if checklist.state == CheckListState.archive.name:
+            msg = "got a request for a checklist which is an archived one, " +\
+                "might have been due to an admin edit of a checklist template."
             logger.error(msg)
             msg = "Requested checklist is archived, reloading checklists list"
             raise VvpObjectNotAvailable(msg)
@@ -322,15 +360,18 @@ class CheckListSvc(BaseSvc):
             section_key = str(section_weight) + "_" + section_uuid
             if section_key not in checklistLineItems:
                 checklistLineItems[section_key] = {}
-                checklistLineItems[section_key]['section'] = checklistDecision['lineitem']['section']
+                checklistLineItems[section_key]['section'] = \
+                    checklistDecision['lineitem']['section']
                 checklistLineItems[section_key]['decisions'] = {}
                 checklistLineItems[section_key]['weight'] = section_weight
 
             decision_uuid = checklistDecision['uuid']
             line_item_weight = checklistDecision['lineitem']['weight']
             decision_key = str(line_item_weight) + "_" + decision_uuid
-            checklistLineItems[section_key]['decisions'][decision_key] = checklistDecision
-            checklistLineItems[section_key]['decisions'][decision_key]['weight'] = line_item_weight
+            checklistLineItems[section_key]['decisions'][decision_key] = \
+                checklistDecision
+            checklistLineItems[section_key]['decisions'][
+                decision_key]['weight'] = line_item_weight
 
         data['checklistDecisions'] = checklistLineItems
 
@@ -343,10 +384,16 @@ class CheckListSvc(BaseSvc):
             if decisionAuditLogs.count() > 0:
                 serializedAuditLogsData = ThinChecklistAuditLogModelSerializer(
                     decisionAuditLogs, many=True).data
-                data['decisionAuditLogs'][checklistDecision.uuid] = serializedAuditLogsData
+                data['decisionAuditLogs'][
+                    checklistDecision.uuid] = serializedAuditLogsData
 
-        logger.debug("get existing checklist has succeeded for checklist.uuid=" + str(checklist.uuid) +
-                          ", user.uuid=" + str(user.uuid) + ", checklist.uuid=" + str(checklistUuid))
+        logger.debug("get existing checklist has " +
+                     "succeeded for checklist.uuid=" +
+                     str(checklist.uuid) +
+                     ", user.uuid=" +
+                     str(user.uuid) +
+                     ", checklist.uuid=" +
+                     str(checklistUuid))
 
         return data
 
@@ -354,7 +401,12 @@ class CheckListSvc(BaseSvc):
         repo_files = self.gitManager.getRepoAssociatedFilesForUser(eng_uuid)
         return repo_files
 
-    def createOrUpdateChecklist(self, checkListName, checkListTemplateUuid, checkListAssociatedFiles, checklistUuid=None):
+    def createOrUpdateChecklist(
+            self,
+            checkListName,
+            checkListTemplateUuid,
+            checkListAssociatedFiles,
+            checklistUuid=None):
         template = None
         checklist = None
         user = request_data_mgr.get_user()
@@ -362,19 +414,18 @@ class CheckListSvc(BaseSvc):
 
         vf = VF.objects.get(engagement__uuid=eng_uuid)
 
-        if not send_jenkins_job_and_gitlab_repo_exists(vf):
-            msg = "Jenkins job or gitlab repo is still missing"
-            logger.error(msg)
-            msg = "Create or update checklist is not ready yet"
-            raise Exception(msg)
-
         # associated_files may be delivered in this format
-        #   [{"File": "bar"}, {"File": "baz"}, {"File": "foo"}, {"File": "quux"}]
+        #   [{"File": "bar"}, {"File": "baz"},
+        # {"File": "foo"}, {"File": "quux"}]
         # but we want to store it in this format
         #   ["bar", "baz", "foo", "quux"]
 
         repo_files = self.gitManager.getRepoAssociatedFilesForUser(eng_uuid)
-#         checklist_files_list = [f['File'] if isinstance(f, dict) else f for f in checkListAssociatedFiles]
+        if not send_jenkins_job_and_gitlab_repo_exists(vf):
+            msg = "Jenkins job or gitlab repo is still missing"
+            logger.error(msg)
+            msg = "Create or update checklist is not ready yet"
+            raise Exception(msg)
         checklist_files_list = []
         for file in checkListAssociatedFiles:
             if isinstance(file, dict):
@@ -384,7 +435,7 @@ class CheckListSvc(BaseSvc):
         for added_name in checklist_files_list:
             if added_name not in repo_files:
                 logger.error("Update checklist has failed. " +
-                                  added_name + " doesnt exist in repo")
+                             added_name + " doesnt exist in repo")
                 msg = "Failed to create checklist, please select valid file"
                 raise ValueError(msg)
 
@@ -393,19 +444,21 @@ class CheckListSvc(BaseSvc):
         engagement = Engagement.objects.get(uuid=eng_uuid)
         template = ChecklistTemplate.objects.get(uuid=checkListTemplateUuid)
 
-        if (checklistUuid != None):  # Update Checklist
+        if (checklistUuid is not None):  # Update Checklist
             checklist = Checklist.objects.get(uuid=checklistUuid)
             checklist.name = checkListName
             checklist.associated_files = associated_files
             checklist.template = template
             checklist.save()
-
-            if (associated_files != None and len(checklist_files_list) > 0):
+            if (associated_files and len(checklist_files_list) > 0):
                 set_state(
                     decline=True,
                     description="Checklist: " + checklist.name +
-                    "in Pending state will transition to Automation because it has associated files",
-                    isMoveToAutomation=True,  # means the checklist will be triggered into automation cycle
+                    "in Pending state will transition to \
+                    Automation because it has associated files",
+                    isMoveToAutomation=True,
+                    # means the checklist will be triggered into automation
+                    # cycle
                     checklist_uuid=checklist.uuid
                 )
         else:  # create ChcekList
@@ -416,35 +469,46 @@ class CheckListSvc(BaseSvc):
             vf = None
             vf = VF.objects.get(engagement=engagement)
 
-            if (vf.git_repo_url == None):
+            if (vf.git_repo_url is None):
                 msg = "Can't create checklist since the attached VF (" + \
                     vf.name + ") doesn't contain git_repo_url"
                 logger.error(
                     "Update checklist has failed. " + logEncoding(msg))
                 raise ObjectDoesNotExist(msg)
 
-            checklist = Checklist(name=checkListName, validation_cycle=1, associated_files=associated_files,
-                                  state=CheckListState.pending.name, engagement=engagement, template=template, creator=user, owner=incharge_personal)  # @UndefinedVariable
+            checklist = Checklist(
+                name=checkListName,
+                validation_cycle=1,
+                associated_files=associated_files,
+                state=CheckListState.pending.name,
+                engagement=engagement,
+                template=template,
+                creator=user,
+                owner=incharge_personal)  # @UndefinedVariable
             line_items_list = ChecklistLineItem.objects.filter(
                 template=template)
             checklist.save()
             for lineitem in line_items_list:
-                new_decision = ChecklistDecision(checklist=checklist,
-                                                 template=template, lineitem=lineitem)
+                new_decision = ChecklistDecision(
+                    checklist=checklist, template=template, lineitem=lineitem)
                 new_decision.save()
 
             # When Checklist is created with files move it it automation
-            if (associated_files != None and len(checklist_files_list) > 0):
+            if (associated_files and len(checklist_files_list) > 0):
                 set_state(
                     decline=False,
                     checklist_uuid=checklist.uuid,
                     description="Checklist: " + checklist.name +
-                    "in Pending state will transition to Automation because it has associated files",
-                    isMoveToAutomation=True  # means the checklist will be triggered into automation cycle
+                    "in Pending state will transition to \
+                    Automation because it has associated files",
+                    isMoveToAutomation=True
+                    # means the checklist will be triggered into automation
+                    # cycle
                 )
 
         logger.debug(
-            "Create/Update checklist has succeeded for checklist.uuid=" + str(checklist.uuid))
+            "Create/Update checklist has succeeded for checklist.uuid="
+            + str(checklist.uuid))
 
         return ThinPostChecklistResponseModelSerializer(checklist).data
 
@@ -453,14 +517,26 @@ class CheckListSvc(BaseSvc):
         checklist.delete()
 
         logger.debug(
-            "Delete checklist has succeeded for checklist.uuid=" + str(checklist_uuid))
-
-    def setChecklistDecisionsFromValMgr(self, user, checklist_uuid, decisions, checklist_results_from_jenkins):
-        checklist = Checklist.objects.get(uuid=checklist_uuid, owner=user,
-                                          state=CheckListState.automation.name)  # @UndefinedVariable
+            "Delete checklist has succeeded for checklist.uuid=" +
+            str(checklist_uuid))
+
+    def setChecklistDecisionsFromValMgr(
+            self,
+            user,
+            checklist_uuid,
+            decisions,
+            checklist_results_from_jenkins):
+        checklist = Checklist.objects.get(
+            uuid=checklist_uuid,
+            owner=user,
+            state=CheckListState.automation.name)
 
-        logger.debug("setChecklistDecisionsFromValMgr() checklist_uuid=%r, len(decisions)=%d",
-                          checklist_uuid, len(decisions),)
+        logger.debug(
+            "setChecklistDecisionsFromValMgr() " +
+            "checklist_uuid=%r, len(decisions)=%d",
+            checklist_uuid,
+            len(decisions),
+        )
 
         if ('error' in checklist_results_from_jenkins):
             el_role = Role.objects.get(name=Roles.el.name)
@@ -469,23 +545,24 @@ class CheckListSvc(BaseSvc):
                 Q(role=el_role) | Q(role=admin_role))
 
             activity_data = TestFinishedActivityData(
-                el_admin_list, checklist.engagement, checklist_results_from_jenkins['error'])
+                el_admin_list, checklist.engagement,
+                checklist_results_from_jenkins['error'])
             bus_service.send_message(ActivityEventMessage(activity_data))
 
-            msg = "test_finished signal from Jenkins has arrived with error: {}".format(
-                checklist_results_from_jenkins['error'])
+            msg = "test_finished signal from Jenkins has arrived with " +\
+                "error: {}".format(checklist_results_from_jenkins['error'])
             logger.error(msg)
             set_state(True, checklist_uuid, isMoveToAutomation=False,
                       description=checklist_results_from_jenkins['error'])
             raise Exception(msg)
 
         ChecklistLineItem.objects.filter(template=checklist.template).update(
-            line_type=CheckListLineType.manual.name)  # @UndefinedVariable
+            line_type=CheckListLineType.manual.name)
 
         for decision in decisions:
             lineitem_obj = ChecklistLineItem.objects.get(
                 uuid=decision['line_item_id'])
-            lineitem_obj.line_type = CheckListLineType.auto.name  # @UndefinedVariable
+            lineitem_obj.line_type = CheckListLineType.auto.name
             lineitem_obj.save()
 
             decision_obj = ChecklistDecision.objects.get(
@@ -493,16 +570,22 @@ class CheckListSvc(BaseSvc):
             setDecision(decisionUuid=decision_obj.uuid,
                         user=user, value=decision['value'])
 
-            if (decision['audit_log_text'] != '' and decision['audit_log_text'] != None):
-                addAuditLogToDecision(decision=decision_obj,
-                                      description=decision['audit_log_text'], user=user, category='')
+            if (decision['audit_log_text'] !=
+                    '' and decision['audit_log_text'] is not None):
+                addAuditLogToDecision(
+                    decision=decision_obj,
+                    description=decision['audit_log_text'],
+                    user=user,
+                    category='')
 
         desc = "The {} validation test suite has completed. The decisions " +\
-               "based on the test results have successfully been set in the " +\
+               "based on the test results \
+               have successfully been set in the " +\
                "checklist.".format(checklist.template.category)
         addAuditLogToChecklist(checklist=checklist, description=desc,
                                user=user, category='')
-        checklistData = ThinChecklistModelSerializer(checklist, many=False).data
+        checklistData = ThinChecklistModelSerializer(
+            checklist, many=False).data
         set_state(False, checklist.uuid,
                   isMoveToAutomation=True, description="")
 
index 1903c47..e20d673 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -60,7 +60,7 @@ logger = LoggingServiceFactory.get_logger()
 
 
 def insert_to_recent_engagements(owner=None, action=None, vf=None):
-    if vf == None:
+    if not vf:
         # If VF wasn't supplied let's fetch it using checklist and
         # checklist.engagement
         checkListObj = Checklist.objects.get(
@@ -75,28 +75,36 @@ def insert_to_recent_engagements(owner=None, action=None, vf=None):
 
 def description_creator(checklist, next_state, additional_comment=""):
     if additional_comment:
-        description = "The " + checklist.name + " checklist was changed to the " +\
+        description = "The " + checklist.name + " \
+        checklist was changed to the " +\
             next_state.lower() + " state. " + "\n" +\
             additional_comment
     else:
-        description = "The " + checklist.name + " checklist was changed to the " +\
+        description = "The " + checklist.name + \
+            " checklist was changed to the " +\
                       next_state.lower() + " state."
     return description
 
 
 '''
- If kwargs['isMoveToAutomation']==True than the CL will not be cloned but reverted to automation, else (False) will be cloned and returned in pending
+ If kwargs['isMoveToAutomation']==True than the CL will not be \
+ cloned but reverted to automation, else (False) will be cloned \
+ and returned in pending
 '''
 
 
-def set_state(decline, checklist_uuid, isMoveToAutomation=True, description=None):
-    logger.debug('set_state(decline=%r,checklist_uuid=%r,get_request_data_vars= %r)',
-                 decline, checklist_uuid, request_data_mgr.get_request_data_vars())
+def set_state(decline, checklist_uuid, isMoveToAutomation=True,
+              description=None):
+    logger.debug('set_state(decline=%r,checklist_uuid=%r,\
+    get_request_data_vars= %r)',
+                 decline, checklist_uuid,
+                 request_data_mgr.get_request_data_vars())
 
-    if checklist_uuid != None:  # was sent explicitly
+    if checklist_uuid:
         request_data_mgr.set_cl_uuid(checklist_uuid)
 
-    if any(x is None for x in [checklist_uuid, request_data_mgr.get_user(), description]):
+    if any(x is None for x in [checklist_uuid,
+                               request_data_mgr.get_user(), description]):
         msg = "checklist uuid or user or description is None"
         logger.error(msg)
         msg = "checklist state wasn't change due to bad parameters"
@@ -126,79 +134,97 @@ def set_state(decline, checklist_uuid, isMoveToAutomation=True, description=None
         raise KeyError(msg)
 
     # @UndefinedVariable
-    if checklist.state == CheckListState.closed.name or checklist.state == CheckListState.archive.name:
-        msg = "attempt to change state to the next one from 'closed'/'archive', no actions were made."
+    if checklist.state == CheckListState.closed.name or \
+            checklist.state == CheckListState.archive.name:
+        msg = "attempt to change state to the next one \
+        from 'closed'/'archive', no actions were made."
         logger.error(msg)
-        msg = "checklist's state is already closed/archive, can not move forward in states."
+        msg = "checklist's state is already closed/archive, \
+        can not move forward in states."
         raise FileExistsError(msg)
 
-    elif decline and checklist.state != CheckListState.pending.name:  # @UndefinedVariable
+    elif decline and checklist.state != CheckListState.pending.name:
         logger.debug(
-            'set_state: decline and not pending -< about to set the state to ARCHIVE and duplicate the checklist')
+            'set_state: decline and not pending -< about to set the \
+            state to ARCHIVE and duplicate the checklist')
         set_state_to_archive(isMoveToAutomation, description)
 
         # @UndefinedVariable
-        return check_sts(checklist, request_data_mgr.get_user(), CheckListState.archive.name, additional_comment)
+        return check_sts(checklist, request_data_mgr.get_user(),
+                         CheckListState.archive.name, additional_comment)
 
     elif checklist.state == CheckListState.pending.name:  # @UndefinedVariable
         logger.debug('set_state: pending to automation')
         set_state_to_automation()
 
         # @UndefinedVariable
-        return check_sts(checklist, request_data_mgr.get_user(), CheckListState.automation.name, additional_comment)
+        return check_sts(checklist, request_data_mgr.get_user(),
+                         CheckListState.automation.name, additional_comment)
 
     # this case is when getting a signal from VM that jenkins has finished all
     # tests
-    elif checklist.state == CheckListState.automation.name:  # @UndefinedVariable
+    elif checklist.state == CheckListState.automation.name:
         logger.debug('set_state: automation to review')
         set_state_to_review(checklist)
         slack_client.send_notification_to_reviewer_when_automation_completes(
             engagement_manual_id, vf_name, reviewer, checklist_name)
 
         # @UndefinedVariable
-        return check_sts(checklist, request_data_mgr.get_user(), CheckListState.review.name, additional_comment)
+        return check_sts(checklist, request_data_mgr.get_user(),
+                         CheckListState.review.name, additional_comment)
 
-    elif checklist.state == CheckListState.review.name:  # @UndefinedVariable
+    elif checklist.state == CheckListState.review.name:
         logger.debug('set_state: review to peer review')
         set_state_to_peer_review()
-        slack_client.send_notification_to_peer_reviewer_when_the_review_completes(
-            engagement_manual_id, vf_name, reviewer, peer_reviewer, checklist_name)
+        slack_client.\
+            send_notification_to_peer_reviewer_when_the_review_completes(
+                engagement_manual_id, vf_name, reviewer, peer_reviewer,
+                checklist_name)
 
         # @UndefinedVariable
-        return check_sts(checklist, request_data_mgr.get_user(), CheckListState.peer_review.name, additional_comment)
+        return check_sts(checklist, request_data_mgr.get_user(),
+                         CheckListState.peer_review.name, additional_comment)
 
-    elif checklist.state == CheckListState.peer_review.name:  # @UndefinedVariable
+    elif checklist.state == CheckListState.peer_review.name:
         logger.debug('set_state: peer review to approval')
         set_state_to_approval()
         admins = IceUserProfile.objects.filter(role__name=Roles.admin.name)
-        slack_client.send_notification_to_admins_when_the_peer_review_completes(
-            engagement_manual_id, vf_name, reviewer, peer_reviewer, admins, checklist_name)
+        slack_client.\
+            send_notification_to_admins_when_the_peer_review_completes(
+                engagement_manual_id,
+                vf_name, reviewer, peer_reviewer, admins,
+                checklist_name)
 
         # @UndefinedVariable
-        return check_sts(checklist, request_data_mgr.get_user(), CheckListState.approval.name, additional_comment)
+        return check_sts(checklist, request_data_mgr.get_user(),
+                         CheckListState.approval.name, additional_comment)
 
-    elif checklist.state == CheckListState.approval.name:  # @UndefinedVariable
+    elif checklist.state == CheckListState.approval.name:
         logger.debug('set_state: approval to handoff')
         set_state_to_handoff()
         slack_client.send_notification_to_reviewer_when_approved(
             engagement_manual_id, vf_name, reviewer, checklist_name)
 
         # @UndefinedVariable
-        return check_sts(checklist, request_data_mgr.get_user(), CheckListState.handoff.name, additional_comment)
+        return check_sts(checklist, request_data_mgr.get_user(),
+                         CheckListState.handoff.name, additional_comment)
 
-    elif checklist.state == CheckListState.handoff.name:  # @UndefinedVariable
+    elif checklist.state == CheckListState.handoff.name:
         logger.debug('set_state: handoff to closed')
         set_state_to_closed()
         admins = IceUserProfile.objects.filter(role__name=Roles.admin.name)
         slack_client.send_notifications_when_closed(
-            engagement_manual_id, vf_name, reviewer, peer_reviewer, admins, checklist_name)
+            engagement_manual_id, vf_name, reviewer, peer_reviewer,
+            admins, checklist_name)
 
         # @UndefinedVariable
-        return check_sts(checklist, request_data_mgr.get_user(), CheckListState.closed.name, additional_comment)
+        return check_sts(checklist, request_data_mgr.get_user(),
+                         CheckListState.closed.name, additional_comment)
 
 
 def duplicate_checklist_and_its_auditlogs(checklist, isMoveToAutomation):
-    ''' Create the basic duplicated checklist object based on the original one '''
+    ''' Create the basic duplicated checklist
+    object based on the original one '''
 
     newState = CheckListState.pending.name  # @UndefinedVariable
     checklistDupObject = Checklist.objects.create(
@@ -211,7 +237,8 @@ def duplicate_checklist_and_its_auditlogs(checklist, isMoveToAutomation):
         owner=checklist.creator,
         state=newState)
 
-    ''' Fetch all original cl audit logs and attach it to the duplicated one '''
+    ''' Fetch all original cl audit logs and attach it to the \
+    duplicated one '''
     audits = ChecklistAuditLog.objects.filter(checklist=checklist)
     for item in audits:
         audit = addAuditLogToChecklist(
@@ -219,37 +246,42 @@ def duplicate_checklist_and_its_auditlogs(checklist, isMoveToAutomation):
 
         if not audit:
             logger.error(
-                "duplicate_checklist_and_its_auditlogs: Failed to create a duplicated audit log in the DB")
+                "duplicate_checklist_and_its_auditlogs: Failed to \
+                create a duplicated audit log in the DB")
             msg = "checklist state wasn't change"
             raise Exception(msg)
 
     ''' Fetch all original line items and attach it to the duplicated one '''
     line_items_list = ChecklistLineItem.objects.filter(
         template=checklist.template)
-    # Implementation is based on space and performance aspect and not particularly one of them
-    #(could have just change the internal object's cl field to the new object and reset their values)
     for lineitem in line_items_list:
         old_decisions = ChecklistDecision.objects.filter(
-            lineitem=lineitem, checklist=checklist, template=checklist.template)
+            lineitem=lineitem, checklist=checklist,
+            template=checklist.template)
         if len(old_decisions) == 0:
             new_decision = ChecklistDecision.objects.create(
-                checklist=checklistDupObject, template=checklistDupObject.template, lineitem=lineitem)
+                checklist=checklistDupObject,
+                template=checklistDupObject.template, lineitem=lineitem)
         else:
             for decision in old_decisions:
                 new_decision = ChecklistDecision.objects.create(
-                    checklist=checklistDupObject, template=checklist.template, lineitem=lineitem)
+                    checklist=checklistDupObject,
+                    template=checklist.template, lineitem=lineitem)
                 old_decision_auditlogs = ChecklistAuditLog.objects.filter(
                     decision=decision)
                 for audit in old_decision_auditlogs:
                     audit = ChecklistAuditLog.objects.create(
-                        decision=new_decision, description=audit.description, category='', creator=audit.creator)
-
-    if isMoveToAutomation == True:  # This is a scenario in which we send to VM cl_from_pending_to_automation_event
+                        decision=new_decision, description=audit.description,
+                        category='', creator=audit.creator)
+    # This is a scenario in which we send to VM
+    # cl_from_pending_to_automation_event
+    if isMoveToAutomation:
         logger.debug("Cloned Checklist is triggered as to automation")
         try:
             set_state_to_automation(checklistDupObject)
         except KeyError:
-            # delete new checklist since we don't want duplicate checklist while
+            # delete new checklist since
+            # we don't want duplicate checklist while
             # the other one is still not archived
             checklistDupObject.delete()
 
@@ -258,9 +290,10 @@ def duplicate_checklist_and_its_auditlogs(checklist, isMoveToAutomation):
 
 def check_sts(checklist, user, next_state, additional_comment):
     description = description_creator(
-        checklist, next_state, additional_comment=additional_comment)  # @UndefinedVariable
+        checklist, next_state, additional_comment=additional_comment)
     if not description:
-        msg = "failed to set the state to the next one due to invalid parameters."
+        msg = "failed to set the state to the next one due to \
+        invalid parameters."
         raise ValueError(msg)
     addAuditLogToChecklist(checklist, description, user)
     return checklist
@@ -271,22 +304,25 @@ def check_decision_meet_criterias(checkListObj, review_type):
         return True
 
     if review_type == 'review_value':
-        invalid_decisions = ChecklistDecision.objects.filter(Q(checklist=checkListObj) &
-                                                             (
-            Q(review_value=CheckListDecisionValue.na.name)
-            | Q(review_value=CheckListDecisionValue.denied.name)
-        )).count()  # @UndefinedVariable
+        invalid_decisions = ChecklistDecision.objects.filter(
+            Q(checklist=checkListObj) &
+            (
+                Q(review_value=CheckListDecisionValue.na.name)
+                | Q(review_value=CheckListDecisionValue.denied.name)
+            )).count()  # @UndefinedVariable
     elif review_type == 'peer_review_value':
-        invalid_decisions = ChecklistDecision.objects.filter(Q(checklist=checkListObj) &
-                                                             (
-            Q(peer_review_value=CheckListDecisionValue.na.name) |
-            Q(peer_review_value=CheckListDecisionValue.denied.name)
-        )).count()  # @UndefinedVariable
+        invalid_decisions = ChecklistDecision.objects.filter(
+            Q(checklist=checkListObj) &
+            (
+                Q(peer_review_value=CheckListDecisionValue.na.name) |
+                Q(peer_review_value=CheckListDecisionValue.denied.name)
+            )).count()  # @UndefinedVariable
     else:
         return True
 
     if invalid_decisions:
-        msg = "checklist state wasn't change, not all decisions are approved / na"
+        msg = "checklist state wasn't change, \
+        not all decisions are approved / na"
         raise MethodNotAllowed(msg)
 
 
@@ -305,22 +341,23 @@ def retrieve_checklist_object(cluuid):
 
 
 """
-This method is called when an EL / Peer Reviewer declines a CL or creates a Next step for them after declining a specific line item in the CL.
+This method is called when an EL / Peer Reviewer declines a CL or \
+creates a Next step for them after declining a specific line item in the CL.
 """
 
 
 @auth(Permissions.set_checklist_decision, is_internal=True)
 def set_state_to_archive(isMoveToAutomation=True, description=None):
     checkListObj = retrieve_checklist_and_its_decisions(
-        request_data_mgr.get_cl_uuid(), '')  # @UndefinedVariable
+        request_data_mgr.get_cl_uuid(), '')
 
     rejection_description = description_creator(
-        checkListObj, CheckListState.archive.name, description)  # @UndefinedVariable
+        checkListObj, CheckListState.archive.name, description)
     addAuditLogToChecklist(
         checkListObj, rejection_description, request_data_mgr.get_user())
     checklistDupObject = duplicate_checklist_and_its_auditlogs(
         checkListObj, isMoveToAutomation)
-    checkListObj.state = CheckListState.archive.name  # @UndefinedVariable
+    checkListObj.state = CheckListState.archive.name
     checkListObj.owner = checkListObj.creator
     checkListObj.update_time = timezone.now()
 
@@ -331,25 +368,29 @@ def set_state_to_archive(isMoveToAutomation=True, description=None):
 
 def set_state_to_automation(checkListObj=None):
     if checkListObj is None:
-        checkListObj = retrieve_checklist_object(request_data_mgr.get_cl_uuid())
+        checkListObj = retrieve_checklist_object(
+            request_data_mgr.get_cl_uuid())
 
-    if checkListObj.associated_files == [] or not checkListObj.associated_files:
+    if checkListObj.associated_files == [] or not \
+            checkListObj.associated_files:
         logger.error(
-            "set_state_to_automation failed: no files were found in the checkListObj.associated_file")
-        msg = "checklist state wasn't change, please add files to the checklist in order to start Automation state"
+            "set_state_to_automation failed: no files were \
+            found in the checkListObj.associated_file")
+        msg = "checklist state wasn't change, please add files \
+        to the checklist in order to start Automation state"
         raise KeyError(msg)
     originalState = checkListObj.state
-    checkListObj.state = CheckListState.automation.name  # @UndefinedVariable
+    checkListObj.state = CheckListState.automation.name
     checkListObj.update_time = timezone.now()
 
     checkListObj.save()
 
-    if originalState == CheckListState.pending.name:  # @UndefinedVariable
+    if originalState == CheckListState.pending.name:
         send_cl_from_pending_to_automation_event(checkListObj)
 
 
 def set_state_to_review(checkListObj):
-    checkListObj.state = CheckListState.review.name  # @UndefinedVariable
+    checkListObj.state = CheckListState.review.name
     checkListObj.update_time = timezone.now()
     # set the owner to reviewer and update_or_insert_to_recent_engagements(...)
 
@@ -359,15 +400,17 @@ def set_state_to_review(checkListObj):
 @auth(Permissions.el_review_checklist, is_internal=True)
 def set_state_to_peer_review():
     """
-    This method is called when EL approves a review and moves a CL to peer_review
+    This method is called when EL approves a review
+    and moves a CL to peer_review
     """
     checkListObj = retrieve_checklist_and_its_decisions(
-        request_data_mgr.get_cl_uuid(), 'review_value')  # @UndefinedVariable
-    checkListObj.state = CheckListState.peer_review.name  # @UndefinedVariable
+        request_data_mgr.get_cl_uuid(), 'review_value')
+    checkListObj.state = CheckListState.peer_review.name
     checkListObj.owner = checkListObj.engagement.peer_reviewer
 
     insert_to_recent_engagements(
-        owner=checkListObj.owner, action=RecentEngagementActionType.GOT_OWNERSHIP_OVER_ENGAGEMENT.name)  # @UndefinedVariable
+        owner=checkListObj.owner,
+        action=RecentEngagementActionType.GOT_OWNERSHIP_OVER_ENGAGEMENT.name)
 
     checkListObj.update_time = timezone.now()
 
@@ -377,17 +420,19 @@ def set_state_to_peer_review():
 @auth(Permissions.peer_review_checklist, is_internal=True)
 def set_state_to_approval():
     """
-    This method is called when Peer Reviewer approves a review and moves a CL to approval state
+    This method is called when Peer Reviewer approves a
+    review and moves a CL to approval state
     """
     checkListObj = retrieve_checklist_and_its_decisions(
-        request_data_mgr.get_cl_uuid(), 'peer_review_value')  # @UndefinedVariable
-    checkListObj.state = CheckListState.approval.name  # @UndefinedVariable
-    admin_role = Role.objects.get(name=Roles.admin.name)  # @UndefinedVariable
+        request_data_mgr.get_cl_uuid(), 'peer_review_value')
+    checkListObj.state = CheckListState.approval.name
+    admin_role = Role.objects.get(name=Roles.admin.name)
 
     admin_list = IceUserProfile.objects.all().filter(
-        role=admin_role)  # @UndefinedVariable
+        role=admin_role)
     if admin_list.count() < 1:
-        logger.error("Failed to save the new state of the Checklist to the DB")
+        logger.error("Failed to save the new state \
+        of the Checklist to the DB")
         msg = "checklist state wasn't change due to server error"
         raise Exception(msg)
 
@@ -397,7 +442,8 @@ def set_state_to_approval():
     checkListObj.update_time = timezone.now()
     checkListObj.owner = admin
     insert_to_recent_engagements(
-        owner=checkListObj.owner, action=RecentEngagementActionType.GOT_OWNERSHIP_OVER_ENGAGEMENT.name)  # @UndefinedVariable
+        owner=checkListObj.owner,
+        action=RecentEngagementActionType.GOT_OWNERSHIP_OVER_ENGAGEMENT.name)
 
     checkListObj.save()
 
@@ -405,15 +451,17 @@ def set_state_to_approval():
 @auth(Permissions.admin_approve_checklist)
 def set_state_to_handoff():
     """
-    This method is called when an admin approves a CL and moves it to a handoff state
+    This method is called when an admin approves
+    a CL and moves it to a handoff state
     """
     checkListObj = retrieve_checklist_and_its_decisions(
         request_data_mgr.get_cl_uuid(), '')
-    checkListObj.state = CheckListState.handoff.name  # @UndefinedVariable
+    checkListObj.state = CheckListState.handoff.name
     checkListObj.owner = checkListObj.creator
 
     insert_to_recent_engagements(
-        owner=checkListObj.owner, action=RecentEngagementActionType.GOT_OWNERSHIP_OVER_ENGAGEMENT.name)  # @UndefinedVariable
+        owner=checkListObj.owner,
+        action=RecentEngagementActionType.GOT_OWNERSHIP_OVER_ENGAGEMENT.name)
 
     checkListObj.update_time = timezone.now()
 
@@ -423,11 +471,12 @@ def set_state_to_handoff():
 @auth(Permissions.handoff_checklist)
 def set_state_to_closed():
     """
-    This method is called when an EL approves the handoff and moves the CL to closed state
+    This method is called when an EL approves the handoff
+    and moves the CL to closed state
     """
     checkListObj = retrieve_checklist_and_its_decisions(
         request_data_mgr.get_cl_uuid(), '')
-    checkListObj.state = CheckListState.closed.name  # @UndefinedVariable
+    checkListObj.state = CheckListState.closed.name
     checkListObj.owner = checkListObj.creator
     checkListObj.update_time = timezone.now()
     update_eng_validation_details(checkListObj)
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 8625d88..4f7cdd5 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index ab6fc96..9dbc44f 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -55,10 +55,12 @@ class CMSPagesService(BaseCms):
     def getPage(self, id):
         page = cms_client.get_page(id)
 
-        # Handling static files address (like images) to get the full address of the CMS static file:
+        # Handling static files address (like images) to get the full
+        # address of the CMS static file:
         if 'content' in page and page['content']:
             cmsAddress = re.sub('\/api/$', '', cms_client.api_url)
-            page['content'] = page['content'].replace('src="/static/media/', 'src="%s/static/media/' % cmsAddress)
+            page['content'] = page['content'].replace(
+                'src="/static/media/', 'src="%s/static/media/' % cmsAddress)
 
         return page
 
index 720f766..3121202 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -51,8 +51,10 @@ class CMSPostsService(BaseCms):
         from_last_days_param = ""
 
         if (fromLastDays is not None and fromLastDays != ""):
-            from_last_days_param = (datetime.now() - timedelta(days=int(fromLastDays))).strftime('%Y-%m-%d')
+            from_last_days_param = (datetime.now() - timedelta(
+                days=int(fromLastDays))).strftime('%Y-%m-%d')
 
-        posts = cms_client.get_posts(offset, limit, category, from_last_days_param)
+        posts = cms_client.get_posts(
+            offset, limit, category, from_last_days_param)
 
         return posts
index 69c5e6f..d0ca514 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index d151ac0..190f613 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 628bc57..48cc728 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -50,8 +50,8 @@ from engagementmanager.bus.messages.activity_event_message import \
 from engagementmanager.slack_client.api import SlackClient
 from engagementmanager.models import VF, Engagement, RecentEngagement, \
     EngagementStatus, VFC, IceUserProfile, Checklist
-from engagementmanager.serializers import SuperThinIceUserProfileModelSerializer, \
-    VFModelSerializerForSignal
+from engagementmanager.serializers import \
+    SuperThinIceUserProfileModelSerializer, VFModelSerializerForSignal
 from engagementmanager.utils.constants import Roles, EngagementStage, \
     ChecklistDefaultNames
 from engagementmanager.utils.dates import parse_date
@@ -71,13 +71,15 @@ def update_engagement_status(user, description, eng_status_uuid, engagement):
         status.description = description
         status.update_time = timezone.now()
         status.save()
-        msg = "Status was successfully updated with a for engagement with uuid: " + \
+        msg = "Status was successfully updated " +\
+            "with a for engagement with uuid: " + \
             engagement.uuid
         logger.debug(msg)
     except RecentEngagement.DoesNotExist:
         EngagementStatus.objects.create(
             creator=user, description=description)
-        msg = "Status was successfully created with a for engagement with uuid: " + \
+        msg = "Status was successfully created with a " +\
+            "for engagement with uuid: " + \
             engagement.uuid
         logger.debug(msg)
 
@@ -85,18 +87,19 @@ def update_engagement_status(user, description, eng_status_uuid, engagement):
 def insert_engagement_status(user, description, engagement):
     created_eng = EngagementStatus.objects.create(
         creator=user, description=description, engagement=engagement)
-    msg = "Status was successfully created with a for engagement with uuid: " + \
-        engagement.uuid
+    msg = "Status was successfully created \
+    with a for engagement with uuid: " + engagement.uuid
     logger.debug(msg)
     return created_eng
 
 
-def update_or_insert_to_recent_engagements(original_user_uuid, vf, action_type):
+def update_or_insert_to_recent_engagements(
+        original_user_uuid, vf, action_type):
     try:
         user_uuid = ''
         try:
             user_uuid = original_user_uuid.urn[9:]
-        except:
+        except BaseException:
             user_uuid = original_user_uuid
         recent_engs = RecentEngagement.objects.filter(
             user_uuid=user_uuid, vf=vf.uuid).order_by('-last_update')
@@ -109,23 +112,28 @@ def update_or_insert_to_recent_engagements(original_user_uuid, vf, action_type):
         if (recent_eng.action_type != action_type):
             recent_eng.action_type = action_type
             recent_eng.last_update = timezone.now()
-            msg = "Recent engagement table was successfully updated the row for a user with uuid: " + \
+            msg = "Recent engagement table was successfully updated " +\
+                "the row for a user with uuid: " + \
                 user_uuid + " and vf uuid: " + vf.uuid + \
                 "with a new action type: " + action_type
             logger.debug(msg)
             recent_eng.save()
         else:
             recent_eng.last_update = timezone.now()
-            msg = "Recent engagement table was successfully updated the last_update row for a user with uuid: " + \
+            msg = "Recent engagement table was successfully updated " +\
+                "the last_update row for a user with uuid: " + \
                 user_uuid + " and vf uuid: " + vf.uuid
             logger.debug(msg)
             recent_eng.save()
         RecentEngagement.objects.filter(
-            last_update__lt=datetime.now() - timedelta(days=settings.RECENT_ENG_TTL)).delete()
+            last_update__lt=datetime.now() -
+            timedelta(
+                days=settings.RECENT_ENG_TTL)).delete()
     except RecentEngagement.DoesNotExist:
         RecentEngagement.objects.create(
             user_uuid=user_uuid, vf=vf, action_type=action_type)
-        msg = "Recent engagement table was successfully updated with a new row for a user with uuid: " + \
+        msg = "Recent engagement table was successfully updated " +\
+            "with a new row for a user with uuid: " + \
             str(user_uuid) + " and vf uuid: " + str(vf.uuid)
         logger.debug(msg)
 
@@ -135,13 +143,18 @@ def get_dashboard_expanded_engs(stage, keyword, offset, limit, user):
     Expecting:
            stage: one of the choices in the defined constants.
            keyword: string
-           offset: non-negative number to start the pull from them + 9 (Negative indexing (i.e. Entry.objects.all()[-1]) is not supported - according to Django 21.12.16).
+           offset: non-negative number to start the pull from them + 9
+           (Negative indexing (i.e. Entry.objects.all()[-1]) is not
+           supported - according to Django 21.12.16).
            user: user object of the requesting client.
     Result:
            Query-set of engs that match the parameters provided (10 objects).
     """
-    engStageList = [EngagementStage.Intake.name, EngagementStage.Active.name,
-                    EngagementStage.Validated.name, EngagementStage.Completed.name]  # @UndefinedVariable
+    engStageList = [
+        EngagementStage.Intake.name,
+        EngagementStage.Active.name,
+        EngagementStage.Validated.name,
+        EngagementStage.Completed.name]  # @UndefinedVariable
 
     q_object = Q()
     q_vfc_object = Q()
@@ -160,14 +173,16 @@ def get_dashboard_expanded_engs(stage, keyword, offset, limit, user):
         q_vfc_object &= Q(vf__engagement__engagement_stage=stage)
 
     # @UndefinedVariable
-    if (user.role.name != Roles.admin.name and user.role.name != Roles.admin_ro.name):
+    if (user.role.name != Roles.admin.name and
+            user.role.name != Roles.admin_ro.name):
         q_object &= Q(engagement__engagement_team__uuid=user.uuid)
         q_vfc_object &= Q(vf__engagement__engagement_team__uuid=user.uuid)
 
     vf_list_uuids = VF.objects.filter(q_object).values_list(
         'uuid', flat=True).order_by('engagement__target_completion_date')
     vfc_vflist_uuids = VFC.objects.filter(q_vfc_object).values_list(
-        'vf__uuid', flat=True).order_by('vf__engagement__target_completion_date')
+        'vf__uuid', flat=True).order_by(
+            'vf__engagement__target_completion_date')
 
     vf_list_uuids = OrderedSet(vf_list_uuids)
     for current_vf in OrderedSet(vfc_vflist_uuids):
@@ -175,33 +190,37 @@ def get_dashboard_expanded_engs(stage, keyword, offset, limit, user):
     num_of_objects = len(vf_list_uuids)
 
     vf_final_array = []
-    vf_list = VF.objects.filter(uuid__in=vf_list_uuids)\
-        .annotate(vf__name=F('name'), vendor__name=F('vendor__name'),
-                  )\
-        .values(
-        'vf__name',
-        'version',
-        'deployment_target__version',
-        'engagement__peer_reviewer__uuid',
-        'ecomp_release__name',
-        'engagement__engagement_stage',
-        'engagement__engagement_manual_id',
-        'engagement__uuid',
-        'engagement__heat_validated_time',
-        'engagement__image_scan_time',
-        'engagement__aic_instantiation_time',
-        'engagement__asdc_onboarding_time',
-        'engagement__target_completion_date',
-        'engagement__progress',
-        'target_lab_entry_date',
-        'engagement__started_state_time',
-        'vendor__name',
-        'engagement__validated_time',
-        'engagement__completed_time',
-        'uuid'
-    )\
-        .annotate(vf_uuid_count=Count('uuid', distinct=True))\
-        .order_by('engagement__target_completion_date')[int(offset):int(offset) + limit]
+    vf_list = VF.objects.filter(
+        uuid__in=vf_list_uuids) .annotate(
+        vf__name=F('name'),
+        vendor__name=F('vendor__name'),
+    ) .values(
+            'vf__name',
+            'version',
+            'deployment_target__version',
+            'engagement__peer_reviewer__uuid',
+            'ecomp_release__name',
+            'engagement__engagement_stage',
+            'engagement__engagement_manual_id',
+            'engagement__uuid',
+            'engagement__heat_validated_time',
+            'engagement__image_scan_time',
+            'engagement__aic_instantiation_time',
+            'engagement__asdc_onboarding_time',
+            'engagement__target_completion_date',
+            'engagement__progress',
+            'target_lab_entry_date',
+            'engagement__started_state_time',
+            'vendor__name',
+            'engagement__validated_time',
+            'engagement__completed_time',
+            'uuid') .annotate(
+                vf_uuid_count=Count(
+                    'uuid',
+                    distinct=True)) .order_by(
+                        'engagement__target_completion_date')[
+                        int(offset):int(offset) +
+        limit]
     for current_vf in vf_list:
         eng = Engagement.objects.get(uuid=current_vf['engagement__uuid'])
         starred_users = eng.starred_engagement.all()
@@ -257,7 +276,8 @@ def get_expanded_engs_for_export(stage, keyword, user):
 
 def is_eng_stage_eql_to_requested_one(engagement, requested_stage):
     if engagement.engagement_stage == requested_stage:
-        msg = "An attempt to change the Engagement's stage (uuid: " + engagement.uuid + \
+        msg = "An attempt to change the Engagement's stage (uuid: " + \
+            engagement.uuid + \
             ") to the same stage it is current in(" + \
             engagement.engagement_stage + ") was made."
         logger.debug(msg)
@@ -275,6 +295,8 @@ def set_engagement_stage(eng_uuid, stage):
         engagement.engagement_stage = stage
         engagement.intake_time = timezone.now()
         engagement.save()
+        logger.debug("Engagement's stage was modified in DB to: %s" % stage)
+        logger.debug("firing an event to gitlab")
         vm_client.fire_event_in_bg('send_provision_new_vf_event', vfObj)
         msg = send_notifications_and_create_activity_after_eng_stage_update(
             engagement)
@@ -286,22 +308,27 @@ def send_notifications_and_create_activity_after_eng_stage_update(engagement):
     res = get_engagement_manual_id_and_vf_name(engagement)
     slack_client = SlackClient()
     slack_client.update_for_change_of_the_engagement_stage(
-        res['engagement_manual_id'], res['vf_name'], engagement.engagement_stage)
+        res['engagement_manual_id'], res['vf_name'],
+        engagement.engagement_stage)
 
-    activity_data = ChangeEngagementStageActivityData(VF.objects.get(engagement=engagement), engagement.engagement_stage,
-                                                      engagement)
+    activity_data = ChangeEngagementStageActivityData(VF.objects.get(
+        engagement=engagement), engagement.engagement_stage, engagement)
     from engagementmanager.apps import bus_service
     bus_service.send_message(ActivityEventMessage(activity_data))
 
-    logger.debug("Engagement's stage (eng_uuid: " + engagement.uuid + ") was successfully changed to: "
-                 + engagement.engagement_stage)
+    logger.debug(
+        "Engagement's stage (eng_uuid: " +
+        engagement.uuid +
+        ") was successfully changed to: " +
+        engagement.engagement_stage)
     return "OK"
 
 
 def set_progress_for_engagement(progress=None):
     prog = int(progress)
     if prog < 0 or prog > 100:
-        msg = 'set_progress_for_engagement failed: Progress value is invalid (out of bounds). Should be 0-100'
+        msg = 'set_progress_for_engagement failed: Progress ' +\
+            'value is invalid (out of bounds). Should be 0-100'
         logger.debug(msg)
         raise ValueError(msg)
     else:
@@ -311,29 +338,35 @@ def set_progress_for_engagement(progress=None):
 
 
 def vf_retreiver(user, star=False, recent=False, eng_uuid=""):
-    engStageList = [EngagementStage.Intake.name, EngagementStage.Active.name,
-                    EngagementStage.Validated.name, EngagementStage.Completed.name]  # @UndefinedVariable
+    engStageList = [
+        EngagementStage.Intake.name,
+        EngagementStage.Active.name,
+        EngagementStage.Validated.name,
+        EngagementStage.Completed.name]
     # @UndefinedVariable
-    if (user.role.name == Roles.admin.name or user.role.name == Roles.admin_ro.name):
+    if (user.role.name == Roles.admin.name or
+            user.role.name == Roles.admin_ro.name):
         if star:
-            vf_list = VF.objects.filter(engagement__engagement_stage__in=engStageList)\
-                .filter(engagement__starred_engagement__uuid=user.uuid).distinct().order_by('engagement__engagement_manual_id')\
-                .values(
-                    'uuid',
-                    'name',
-                    'is_service_provider_internal',
-                    'engagement__creator__uuid',
-                    'engagement__engagement_manual_id',
-                    'engagement__peer_reviewer__uuid',
-                    'engagement__peer_reviewer__email',
-                    'engagement__reviewer__uuid',
-                    'engagement__reviewer__email',
-                    'engagement__uuid'
-            )
+            vf_list = VF.objects.filter(
+                engagement__engagement_stage__in=engStageList) .filter(
+                engagement__starred_engagement__uuid=user.uuid).\
+                distinct().order_by(
+                    'engagement__engagement_manual_id') .values(
+                'uuid',
+                'name',
+                'is_service_provider_internal',
+                'engagement__creator__uuid',
+                'engagement__engagement_manual_id',
+                'engagement__peer_reviewer__uuid',
+                'engagement__peer_reviewer__email',
+                'engagement__reviewer__uuid',
+                'engagement__reviewer__email',
+                'engagement__uuid')
 
             for vf in vf_list:
                 red_dot_activity = RecentEngagement.objects.filter(
-                    vf=vf['uuid']).values('action_type').order_by('-last_update')[:1]
+                    vf=vf['uuid']).values(
+                        'action_type').order_by('-last_update')[:1]
                 if (red_dot_activity.count() > 0):
                     vf['action_type'] = red_dot_activity[0]['action_type']
                 else:
@@ -342,9 +375,10 @@ def vf_retreiver(user, star=False, recent=False, eng_uuid=""):
             return vf_list
 
         elif recent:
-            recent = RecentEngagement.objects.filter(vf__engagement__engagement_stage__in=engStageList)\
-                .filter(user_uuid=user.uuid).distinct().order_by('-last_update')\
-                .values(
+            recent = RecentEngagement.objects.filter(
+                vf__engagement__engagement_stage__in=engStageList) .filter(
+                user_uuid=user.uuid).distinct().order_by(
+                    '-last_update') .values(
                 'vf__uuid',
                 'vf__name',
                 'vf__is_service_provider_internal',
@@ -356,29 +390,31 @@ def vf_retreiver(user, star=False, recent=False, eng_uuid=""):
                 'vf__engagement__reviewer__email',
                 'vf__engagement__uuid',
                 'action_type',
-                'last_update'
-            )[:20]
+                'last_update')[
+                :20]
             return recent
 
         else:
             if eng_uuid != "":
-                vf_list = VF.objects.filter(engagement__engagement_stage__in=engStageList)\
-                    .filter(engagement__uuid=eng_uuid).distinct().order_by('engagement__engagement_manual_id')\
-                    .values(
-                        'uuid',
-                        'name',
-                        'is_service_provider_internal',
-                        'engagement__creator__uuid',
-                        'engagement__engagement_manual_id',
-                        'engagement__peer_reviewer__uuid',
-                        'engagement__peer_reviewer__email',
-                        'engagement__reviewer__uuid',
-                        'engagement__reviewer__email',
-                        'engagement__uuid'
-                )
+                vf_list = VF.objects.filter(
+                    engagement__engagement_stage__in=engStageList) .filter(
+                    engagement__uuid=eng_uuid).distinct().order_by(
+                        'engagement__engagement_manual_id') .values(
+                    'uuid',
+                    'name',
+                    'is_service_provider_internal',
+                    'engagement__creator__uuid',
+                    'engagement__engagement_manual_id',
+                    'engagement__peer_reviewer__uuid',
+                    'engagement__peer_reviewer__email',
+                    'engagement__reviewer__uuid',
+                    'engagement__reviewer__email',
+                    'engagement__uuid')
             else:
-                vf_list = VF.objects.filter(engagement__engagement_stage__in=engStageList)\
-                    .filter().distinct().order_by('engagement__engagement_manual_id')\
+                vf_list = VF.objects.filter(
+                    engagement__engagement_stage__in=engStageList)\
+                    .filter().distinct().order_by(
+                        'engagement__engagement_manual_id')\
                     .values(
                         'uuid',
                         'name',
@@ -396,8 +432,15 @@ def vf_retreiver(user, star=False, recent=False, eng_uuid=""):
     else:
         if star:
             if eng_uuid != "":
-                vf_list = VF.objects.filter(engagement__engagement_stage__in=engStageList)\
-                    .filter(Q(engagement__uuid=eng_uuid, engagement__engagement_team__uuid=user.uuid, engagement__starred_engagement__uuid=user.uuid) | Q(engagement__uuid=eng_uuid, engagement__peer_reviewer=user, engagement__starred_engagement__uuid=user.uuid))\
+                vf_list = VF.objects.filter(
+                    engagement__engagement_stage__in=engStageList) .filter(
+                    Q(
+                        engagement__uuid=eng_uuid,
+                        engagement__engagement_team__uuid=user.uuid,
+                        engagement__starred_engagement__uuid=user.uuid) | Q(
+                        engagement__uuid=eng_uuid,
+                        engagement__peer_reviewer=user,
+                        engagement__starred_engagement__uuid=user.uuid)) \
                     .values(
                     'uuid',
                     'name',
@@ -408,12 +451,17 @@ def vf_retreiver(user, star=False, recent=False, eng_uuid=""):
                     'engagement__peer_reviewer__email',
                     'engagement__reviewer__uuid',
                     'engagement__reviewer__email',
-                    'engagement__uuid'
-                )
+                    'engagement__uuid')
             else:
-                vf_list = VF.objects.filter(engagement__engagement_stage__in=engStageList)\
-                    .filter(Q(engagement__engagement_team__uuid=user.uuid, engagement__starred_engagement__uuid=user.uuid) | Q(engagement__peer_reviewer=user, engagement__starred_engagement__uuid=user.uuid)).distinct().order_by('engagement__engagement_manual_id')\
-                    .values(
+                vf_list = VF.objects.filter(
+                    engagement__engagement_stage__in=engStageList) .filter(
+                    Q(
+                        engagement__engagement_team__uuid=user.uuid,
+                        engagement__starred_engagement__uuid=user.uuid) | Q(
+                        engagement__peer_reviewer=user,
+                        engagement__starred_engagement__uuid=user.uuid)).\
+                    distinct().order_by(
+                        'engagement__engagement_manual_id') .values(
                     'uuid',
                     'name',
                     'is_service_provider_internal',
@@ -423,11 +471,11 @@ def vf_retreiver(user, star=False, recent=False, eng_uuid=""):
                     'engagement__peer_reviewer__email',
                     'engagement__reviewer__uuid',
                     'engagement__reviewer__email',
-                    'engagement__uuid'
-                )
+                    'engagement__uuid')
             for vf in vf_list:
                 red_dot_activity = RecentEngagement.objects.filter(
-                    vf=vf['uuid']).values('action_type').order_by('-last_update')[:1]
+                    vf=vf['uuid']).values(
+                        'action_type').order_by('-last_update')[:1]
                 if (red_dot_activity.count() > 0):
                     vf['action_type'] = red_dot_activity[0]['action_type']
                 else:
@@ -436,28 +484,38 @@ def vf_retreiver(user, star=False, recent=False, eng_uuid=""):
             return vf_list
 
         elif recent:
-            recent = RecentEngagement.objects.filter(vf__engagement__engagement_stage__in=engStageList)\
-                .filter(Q(user_uuid=user.uuid, vf__engagement__engagement_team__uuid=user.uuid) | Q(user_uuid=user.uuid, vf__engagement__peer_reviewer=user)).distinct().order_by('-last_update')\
-                .values(
-                'vf__uuid',
-                'vf__name',
-                'vf__is_service_provider_internal',
-                'vf__engagement__creator__uuid',
-                'vf__engagement__engagement_manual_id',
-                'vf__engagement__peer_reviewer__uuid',
-                'vf__engagement__peer_reviewer__email',
-                'vf__engagement__reviewer__uuid',
-                'vf__engagement__reviewer__email',
-                'vf__engagement__uuid',
-                'action_type',
-                'last_update'
-            )[:20]
+            recent = RecentEngagement.objects.filter(
+                vf__engagement__engagement_stage__in=engStageList) .filter(
+                Q(
+                    user_uuid=user.uuid,
+                    vf__engagement__engagement_team__uuid=user.uuid) | Q(
+                    user_uuid=user.uuid,
+                    vf__engagement__peer_reviewer=user)).distinct().order_by(
+                        '-last_update') .values(
+                    'vf__uuid',
+                    'vf__name',
+                    'vf__is_service_provider_internal',
+                    'vf__engagement__creator__uuid',
+                    'vf__engagement__engagement_manual_id',
+                    'vf__engagement__peer_reviewer__uuid',
+                    'vf__engagement__peer_reviewer__email',
+                    'vf__engagement__reviewer__uuid',
+                    'vf__engagement__reviewer__email',
+                    'vf__engagement__uuid',
+                    'action_type',
+                    'last_update')[
+                        :20]
             return recent
         else:
             if eng_uuid != "":
-                vf_list = VF.objects.filter(engagement__engagement_stage__in=engStageList)\
-                    .filter(Q(engagement__uuid=eng_uuid, engagement__engagement_team__uuid=user.uuid) | Q(engagement__uuid=eng_uuid, engagement__peer_reviewer=user)).distinct().order_by('engagement__engagement_manual_id')\
-                    .values(
+                vf_list = VF.objects.filter(
+                    engagement__engagement_stage__in=engStageList) .filter(
+                    Q(
+                        engagement__uuid=eng_uuid,
+                        engagement__engagement_team__uuid=user.uuid) | Q(
+                        engagement__uuid=eng_uuid,
+                        engagement__peer_reviewer=user)).distinct().order_by(
+                            'engagement__engagement_manual_id') .values(
                     'uuid',
                     'name',
                     'is_service_provider_internal',
@@ -467,12 +525,14 @@ def vf_retreiver(user, star=False, recent=False, eng_uuid=""):
                     'engagement__peer_reviewer__email',
                     'engagement__reviewer__uuid',
                     'engagement__reviewer__email',
-                    'engagement__uuid'
-                )
+                    'engagement__uuid')
             else:
-                vf_list = VF.objects.filter(engagement__engagement_stage__in=engStageList)\
-                    .filter(Q(engagement__engagement_team__uuid=user.uuid) | Q(engagement__peer_reviewer=user)).distinct().order_by('engagement__engagement_manual_id')\
-                    .values(
+                vf_list = VF.objects.filter(
+                    engagement__engagement_stage__in=engStageList) .filter(
+                    Q(
+                        engagement__engagement_team__uuid=user.uuid) | Q(
+                        engagement__peer_reviewer=user)).distinct().order_by(
+                            'engagement__engagement_manual_id') .values(
                     'uuid',
                     'name',
                     'is_service_provider_internal',
@@ -482,8 +542,7 @@ def vf_retreiver(user, star=False, recent=False, eng_uuid=""):
                     'engagement__peer_reviewer__email',
                     'engagement__reviewer__uuid',
                     'engagement__reviewer__email',
-                    'engagement__uuid'
-                )
+                    'engagement__uuid')
             return vf_list
 
 
@@ -557,7 +616,11 @@ def set_engagement_reviewer(eng_uuid, reviewer_uuid):
         res = get_engagement_manual_id_and_vf_name(engagement)
         slack_client = SlackClient()
         slack_client.update_reviewer_or_peer_reviewer(
-            res['engagement_manual_id'], res['vf_name'], reviewer, old_reviewer, 'reviewer')
+            res['engagement_manual_id'],
+            res['vf_name'],
+            reviewer,
+            old_reviewer,
+            'reviewer')
 
         result = reviewer
     else:
@@ -588,7 +651,11 @@ def set_engagement_peer_reviewer(eng_uuid, peer_reviewer_uuid):
         res = get_engagement_manual_id_and_vf_name(engagement)
         slack_client = SlackClient()
         slack_client.update_reviewer_or_peer_reviewer(
-            res['engagement_manual_id'], res['vf_name'], peer_reviewer, old_peer_reviewer, 'peer reviewer')
+            res['engagement_manual_id'],
+            res['vf_name'],
+            peer_reviewer,
+            old_peer_reviewer,
+            'peer reviewer')
 
         result = peer_reviewer
     else:
@@ -605,7 +672,8 @@ def switch_engagement_reviewers(eng_uuid, reviewer_uuid, peer_reviewer_uuid):
     old_reviewer = engagement.reviewer
 
     checklist_owners = Checklist.objects.filter(
-        Q(engagement__uuid=eng_uuid) & (Q(owner=old_reviewer) | Q(owner=old_peer_reviewer)))
+        Q(engagement__uuid=eng_uuid) & (
+            Q(owner=old_reviewer) | Q(owner=old_peer_reviewer)))
 
     for checklist in checklist_owners:
         if checklist.owner == reviewer:
@@ -622,9 +690,17 @@ def switch_engagement_reviewers(eng_uuid, reviewer_uuid, peer_reviewer_uuid):
     res = get_engagement_manual_id_and_vf_name(engagement)
     slack_client = SlackClient()
     slack_client.update_reviewer_or_peer_reviewer(
-        res['engagement_manual_id'], res['vf_name'], reviewer, old_reviewer, 'reviewer')
+        res['engagement_manual_id'],
+        res['vf_name'],
+        reviewer,
+        old_reviewer,
+        'reviewer')
     slack_client.update_reviewer_or_peer_reviewer(
-        res['engagement_manual_id'], res['vf_name'], peer_reviewer, old_peer_reviewer, 'peer reviewer')
+        res['engagement_manual_id'],
+        res['vf_name'],
+        peer_reviewer,
+        old_peer_reviewer,
+        'peer reviewer')
 
     return {"reviewer": reviewer_uuid, "peerreviewer": peer_reviewer_uuid}
 
@@ -666,24 +742,32 @@ def update_engagement(engagement_dict):
 def remove_user_from_engagement_team(eng_uuid, user, removed_user_uuid):
     msg = "User was successfully removed from the engagement team"
     # @UndefinedVariable
-    if ((removed_user_uuid == user.uuid) or (removed_user_uuid != user.uuid and (user.role.name == Roles.admin.name or user.role.name == Roles.el.name))):
+    if ((removed_user_uuid == user.uuid) or
+        (removed_user_uuid != user.uuid and (
+            user.role.name == Roles.admin.name or
+            user.role.name == Roles.el.name))):
         engagement = Engagement.objects.get(uuid=eng_uuid)
         requested_user = IceUserProfile.objects.get(uuid=removed_user_uuid)
-        if (engagement.peer_reviewer == requested_user or engagement.reviewer == requested_user
-           or engagement.creator == requested_user or engagement.contact_user == requested_user):
-            msg = "Reviewer/Peer Reviewer/Creator/Contact user cannot be removed from engagement team."
+        if (engagement.peer_reviewer == requested_user or
+            engagement.reviewer == requested_user
+                or engagement.creator == requested_user or
+                engagement.contact_user == requested_user):
+            msg = "Reviewer/Peer Reviewer/Creator/Contact " +\
+                "user cannot be removed from engagement team."
             logger.error(msg)
             raise PermissionDenied
         engagement.engagement_team.remove(requested_user)
         engagement.save()
         logger.debug(msg)
     else:
-        msg = "removed user is not equal to conducting user or user is not an admin."
+        msg = "removed user is not equal to conducting " +\
+            "user or user is not an admin."
         logger.error(msg)
         raise PermissionDenied
 
 
 def update_eng_validation_details(cl):
     setattr(cl.engagement,
-            ChecklistDefaultNames.VALIDATION_DATE_ARRAY[cl.name], timezone.now())
+            ChecklistDefaultNames.VALIDATION_DATE_ARRAY[cl.name],
+            timezone.now())
     cl.engagement.save()
index c4780fd..b22a27d 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -52,36 +52,46 @@ from engagementmanager.service.logging_service import LoggingServiceFactory
 logger = LoggingServiceFactory.get_logger()
 
 
-def enforce_invitation_throttling(eng_uuid, invited_email, inviterUser, invitedUser):
+def enforce_invitation_throttling(eng_uuid, invited_email,
+                                  inviterUser, invitedUser):
     assert eng_uuid is not None
     assert invited_email is not None
 
-    invitation = Invitation.objects.filter(engagement_uuid=eng_uuid, email=invited_email)
+    invitation = Invitation.objects.filter(
+        engagement_uuid=eng_uuid, email=invited_email)
     if len(invitation) > 0:
-        logger.warn("Oops, looks like an invitation with following details already exists: " + str(invitation))
+        logger.warn(
+            "Oops, looks like an invitation with " +
+            "following details already exists: "
+            + str(invitation))
         return False
 
-    if ((invitedUser != None and invitedUser.role.name != Roles.admin.name and
-                 invitedUser.role.name != Roles.el.name) or invitedUser == None):
-        numOfInvitationinLast24H = Invitation.objects.filter(email=invited_email,
-                                                             create_time__gte=datetime.now() - timedelta(
-                                                                 hours=24)).count()
+    if (not invitedUser or (
+        not invitedUser and invitedUser.role.name !=
+            Roles.admin.name and invitedUser.role.name != Roles.el.name)):
+        numOfInvitationinLast24H = Invitation.objects.filter(
+            email=invited_email,
+            create_time__gte=datetime.now() - timedelta(
+                hours=24)).count()
         if numOfInvitationinLast24H >= 5:
             logger.warn(
-                "Oops, looks like invited email (" + invited_email + ") which isn't EL nor admin has reached its "
-                                                                     "max invitations (5) in the last 24 hours")
+                "Oops, looks like invited email (" + invited_email +
+                ") which isn't EL nor admin has reached its "
+                "max invitations (5) in the last 24 hours")
             return False
 
-    if ((invitedUser != None and invitedUser.role.name == Roles.standard_user.name) or
-            (invitedUser != None and invitedUser.role.name == Roles.admin_ro.name) or
-            invitedUser == None):
-        numOfInvitationinLast24H = Invitation.objects.filter(invited_by_user_uuid=inviterUser.uuid,
-                                                             create_time__gte=datetime.now() - timedelta(
-                                                                 hours=24)).count()
+    if ((invitedUser and invitedUser.role.name == Roles.standard_user.name) or
+            (invitedUser and invitedUser.role.name == Roles.admin_ro.name) or
+            invitedUser is None):
+        numOfInvitationinLast24H = Invitation.objects.filter(
+            invited_by_user_uuid=inviterUser.uuid,
+            create_time__gte=datetime.now() - timedelta(
+                hours=24)).count()
         if numOfInvitationinLast24H >= 25:
             logger.warn(
                 "Oops, looks like a standard-user/admin-readonly inviter "
-                "(" + inviterUser.email + ") has reached its max invitations (25) in the last 24 hours")
+                "(" + inviterUser.email + ") has reached its max invitations" +
+                "(25) in the last 24 hours")
             return False
     return True
 
@@ -92,27 +102,35 @@ def generateInviteMail(data, inviterUser, invitedUser, is_contact_user):
         data['vf_name'] = vf.name
     else:
         data['vf_name'] = "-"
-        logger.error("Couldn't fetch VF by engagement uuid=" + logEncoding(data['eng_uuid']))
+        logger.error("Couldn't fetch VF by engagement uuid=" +
+                     logEncoding(data['eng_uuid']))
 
     body = get_template("{invite_template_dir}invite_mail_body.html".format(
         invite_template_dir=Constants.invite_template_dir))
-    subject = get_template("{invite_template_dir}invite_mail_subject.html".format(
-        invite_template_dir=Constants.invite_template_dir))
+    subject = get_template(
+        "{invite_template_dir}invite_mail_subject.html".format(
+            invite_template_dir=Constants.invite_template_dir))
 
     data['dashboard_link'] = str(settings.DOMAIN) + "/#/dashboard/"
-    invitation = Invitation.objects.create(engagement_uuid=data['eng_uuid'],
-                                           invited_by_user_uuid=inviterUser.uuid, email=data['email'],
-                                           invitation_token=uuid4())
+    invitation = Invitation.objects.create(
+        engagement_uuid=data['eng_uuid'],
+        invited_by_user_uuid=inviterUser.uuid, email=data['email'],
+        invitation_token=uuid4())
 
     if invitedUser is not None:
-        data['invite_link'] = str(settings.DOMAIN) + "/#/login?invitation=" + str(invitation.invitation_token)
-        data['instruction'] = "To accept this invitation, please click this link:"
-        logger.debug("Invited Contact with email " + data['email'] + "already exist in the DB. Sending them an email "
-                                                                     "with link to login page. link=" + data[
+        data['invite_link'] = str(
+            settings.DOMAIN) + "/#/login?invitation="\
+            + str(invitation.invitation_token)
+        data['instruction'] = "To accept this invitation, \
+        please click this link:"
+        logger.debug("Invited Contact with email " + data['email'] +
+                     "already exist in the DB. Sending them an email "
+                     "with link to login page. link=" + data[
             'invite_link'])
         if is_contact_user:
             logger.debug("Updating the Engagement with uuid=" + data[
-                'eng_uuid'] + " to have this contact user: " + invitedUser.full_name)
+                'eng_uuid'] + " to have this contact user: "
+                + invitedUser.full_name)
             engObj = Engagement.objects.get(uuid=data['eng_uuid'])
             engObj.contact_user = invitedUser
             engObj.save()
@@ -121,21 +139,27 @@ def generateInviteMail(data, inviterUser, invitedUser, is_contact_user):
         prefix = str(settings.DOMAIN) + "/#/signUp?invitation=" + \
             str(invitation.invitation_token) + "&email=" + data['email']
         suffix = ""
-        if 'full_name' in data and data['full_name'] and 'phone_number' in data and data['phone_number']:
-            suffix += "&full_name=" + data['full_name'] + "&phone_number=" + data['phone_number']
+        if 'full_name' in data and data['full_name'] and \
+                'phone_number' in data and data['phone_number']:
+            suffix += "&full_name=" + \
+                data['full_name'] + "&phone_number=" + data['phone_number']
             if data.get('company'):
                 suffix += "&company=" + data['company']
 
         data['invite_link'] = prefix + suffix
-        data['instruction'] = "To create an account and accept this invitation, please click this link:"
+        data['instruction'] = "To create an account and accept this " +\
+            "invitation, please click this link:"
 
         if is_contact_user:
             data['invite_link'] += "&is_contact_user=true"
-            logger.debug("The invite mail is sent to a contact person (VF Contact or "
-                         + Constants.service_provider_company_name + " Sponsor)")
+            logger.debug("The invite mail is sent to a contact "
+                         "person (VF Contact or "
+                         + Constants.service_provider_company_name
+                         + " Sponsor)")
 
         logger.debug(
-            "Invited Person doesn't exists, sending them an email with link to signup. link=" + data['invite_link'])
+            "Invited Person doesn't exists, sending them an email " +
+            "with link to signup. link=" + data['invite_link'])
 
     return body, subject, invitation
 
@@ -151,23 +175,27 @@ def inviteUserToSignUpOrLogin(inviterUser, data, is_contact_user):
     if len(rs) > 0:
         invitedUser = IceUserProfile.objects.get(email=data['email'])
 
-    is_invite_ok = enforce_invitation_throttling(data['eng_uuid'], data['email'], inviterUser, invitedUser)
+    is_invite_ok = enforce_invitation_throttling(
+        data['eng_uuid'], data['email'], inviterUser, invitedUser)
 
-    if is_invite_ok == False:
+    if not is_invite_ok:
         msg = "Invite couldn't be created"
         logger.error(msg)
         raise VvpBadRequest(msg)
 
-    body, subject, invitation = generateInviteMail(data, inviterUser, invitedUser, is_contact_user)
+    body, subject, invitation = generateInviteMail(
+        data, inviterUser, invitedUser, is_contact_user)
 
     try:
         mail.sendMail(data['email'], data, body, subject)
     except Exception as e:
         logger.error(e)
-        msg = "Something went wrong while trying to send mail to " + data['email'] + " from " + inviterUser.email
+        msg = "Something went wrong while trying to send mail to " + \
+            data['email'] + " from " + inviterUser.email
         logger.error(msg)
         if invitation:
-            logger.error("Rolling back the invitation (" + invitation + ") due to problems in sending its mail")
+            logger.error("Rolling back the invitation (" +
+                         invitation + ") due to problems in sending its mail")
             invitation.delete()
         raise Exception(msg)
 
index b90bdbf..7136774 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 7216b56..6388e1e 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -74,14 +74,19 @@ class LoginSvc(BaseSvc):
             raise PermissionDenied(msg)
         return user
 
-    def reset_password(self, reset_password_email, i_password, msg, user_profile):
+    def reset_password(self, reset_password_email, i_password,
+                       msg, user_profile):
         token_user = self.get_user_by_email(reset_password_email)
         if user_profile.user.id != token_user.id:
-            msg = self.render_user_conflict_message(user_profile.user, token_user)
+            msg = self.render_user_conflict_message(
+                user_profile.user, token_user)
         temp_encrypted_password = user_profile.user.temp_password
-        is_temp_password_ok = check_password(i_password, temp_encrypted_password)
+        is_temp_password_ok = check_password(
+            i_password, temp_encrypted_password)
         if is_temp_password_ok:
-            self.logger.debug("Temporary Passwords match... Checking temporary password expiration")
+            self.logger.debug(
+                "Temporary Passwords match...\
+                 Checking temporary password expiration")
         else:
             msg = "User or Password does not match"
             self.logger.error(msg + " in Reset Password flow")
@@ -90,7 +95,8 @@ class LoginSvc(BaseSvc):
 
     def render_user_conflict_message(self, user, user_from_token):
         msg = "User Conflict"
-        self.logger.error(msg + ". user uuid =" + user.id + ", user from token uuid=" + user_from_token.id)
+        self.logger.error(msg + ". user uuid =" + user.id +
+                          ", user from token uuid=" + user_from_token.id)
         raise VvpConflict
 
     def render_user_not_active_message(self, i_email):
@@ -106,25 +112,31 @@ class LoginSvc(BaseSvc):
         if reset_password_param is not None:
             is_reset_pwd_flow = True
             self.logger.debug(
-                "Reset Password flow is identified. Checking temporary password expiration. t=" + reset_password_param)
+                "Reset Password flow is identified.\
+                 Checking temporary password expiration. t="
+                + reset_password_param)
             token_arr = reset_password_param.split("token")
             if len(token_arr) > 0:
                 email = jwt_obj.decode_reset_password_token(str(token_arr[1]))
             else:
-                self.logger.error("token doesn't include token prefix: " + logEncoding(reset_password_param))
+                self.logger.error(
+                    "token doesn't include token prefix: "
+                    + logEncoding(reset_password_param))
                 is_reset_pwd_flow = False
         return email, is_reset_pwd_flow
 
     def handle_invite_token(self, data, user_data, user_profile):
         data['invitation'] = data['invitation'].strip()
-        invitation = Invitation.objects.get(invitation_token=data['invitation'])
+        invitation = Invitation.objects.get(
+            invitation_token=data['invitation'])
         addUsersToEngTeam(invitation.engagement_uuid, [user_profile])
         vf_obj = VF.objects.get(engagement__uuid=invitation.engagement_uuid)
         vm_client.fire_event_in_bg('send_provision_new_vf_event', vf_obj)
         user_data['eng_uuid'] = invitation.engagement_uuid
         markInvitationAsAccepted(data['invitation'])
 
-    def get_serialized_user_data(self, is_reset_pwd_flow, user_profile, jwt_obj, user):
+    def get_serialized_user_data(self, is_reset_pwd_flow, user_profile,
+                                 jwt_obj, user):
         user_data = ThinIceUserProfileModelSerializer(user_profile).data
         user_data['isResetPwdFlow'] = is_reset_pwd_flow
         user_data['token'] = jwt_obj.create_token(user)
index 9fa8672..fe34f3a 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -40,13 +40,19 @@ import json
 from django.db.models.query_utils import Q
 from django.utils import timezone
 from django.utils.timezone import timedelta
-from engagementmanager.bus.messages.activity_event_message import ActivityEventMessage
-from engagementmanager.models import Engagement, IceUserProfile, NextStep, VF
-from engagementmanager.serializers import ThinNextStepModelSerializer, UserNextStepModelSerializer
-from engagementmanager.utils.activities_data import UpdateNextStepsActivityData, AddNextStepsActivityData
-from engagementmanager.service.engagement_service import update_or_insert_to_recent_engagements
+from engagementmanager.bus.messages.activity_event_message import \
+    ActivityEventMessage
+from engagementmanager.models import Engagement, IceUserProfile, \
+    NextStep, VF
+from engagementmanager.serializers import ThinNextStepModelSerializer, \
+    UserNextStepModelSerializer
+from engagementmanager.utils.activities_data import \
+    UpdateNextStepsActivityData, AddNextStepsActivityData
+from engagementmanager.service.engagement_service import \
+    update_or_insert_to_recent_engagements
 from engagementmanager.service.base_service import BaseSvc
-from engagementmanager.utils.constants import Constants, NextStepType, NextStepState, RecentEngagementActionType
+from engagementmanager.utils.constants import Constants, NextStepType,\
+    NextStepState, RecentEngagementActionType
 from engagementmanager.utils.request_data_mgr import request_data_mgr
 from engagementmanager.apps import bus_service
 from engagementmanager.service.logging_service import LoggingServiceFactory
@@ -59,37 +65,45 @@ class NextStepSvc(BaseSvc):
         {
             'position': 2,
             'stage': 'Intake',
-            'text': 'Please work with your Engagement Lead (EL) to complete the necessary trial agreements.',
+            'text': 'Please work with your Engagement Lead (EL) ' +
+            'to complete the necessary trial agreements.',
             'condition': lambda x, y: True,
-            'type': NextStepType.trial_agreements.name  # @UndefinedVariable
+            'type': NextStepType.trial_agreements.name
         },
         {
             'position': 3,
             'stage': 'Intake',
-            'text': 'Please add your ' + Constants.service_provider_company_name + ' sponsor or vendor contact information.',
-            'condition': lambda user, eng: False if (eng.contact_user) else True,
-            'type': NextStepType.add_contact_person.name  # @UndefinedVariable
+            'text': 'Please add your ' +
+            Constants.service_provider_company_name +
+            ' sponsor or vendor contact information.',
+            'condition': lambda user, eng: False if
+            (eng.contact_user) else True,
+            'type': NextStepType.add_contact_person.name
         },
         {
             'position': 1,
             'stage': 'Active',
-            'text': 'Please submit the first version of the VF package. If you have any problems or questions, please contact your Engagement Lead (EL)',
+            'text': 'Please submit the first version of the VF package. ' +
+            'If you have any problems or questions, please ' +
+            'contact your Engagement Lead (EL)',
             'condition': lambda x, y: True,
-            'type': NextStepType.submit_vf_package.name  # @UndefinedVariable
+            'type': NextStepType.submit_vf_package.name
         },
         {
             'position': 1,
             'stage': 'Validated',
-            'text': 'Please schedule a time with your Engagement Lead (EL) to complete the handoff.',
+            'text': 'Please schedule a time with your Engagement Lead (EL) ' +
+            'to complete the handoff.',
             'condition': lambda x, y: True,
-            'type': NextStepType.el_handoff.name  # @UndefinedVariable
+            'type': NextStepType.el_handoff.name
         }
     ]
 
     def get_user_next_steps(self, limit, state):
         user = request_data_mgr.get_user()
 
-        nextSteps = NextStep.objects.filter(Q(assignees=user) & Q(state=state)).order_by('due_date').distinct()
+        nextSteps = NextStep.objects.filter(Q(assignees=user) & Q(
+            state=state)).order_by('due_date').distinct()
         count = nextSteps.count()
         serializer = UserNextStepModelSerializer(nextSteps[:limit], many=True)
         return serializer, count
@@ -98,16 +112,24 @@ class NextStepSvc(BaseSvc):
         user = request_data_mgr.get_user()
         eng_uuid = request_data_mgr.get_eng_uuid()
 
-        ers = NextStep.objects.filter(Q(engagement__uuid=eng_uuid, owner=None, engagement_stage=eng_stage) | Q(
-            owner=user, engagement_stage=eng_stage)).order_by('position')
+        ers = NextStep.objects.filter(
+            Q(
+                engagement__uuid=eng_uuid,
+                owner=None,
+                engagement_stage=eng_stage) | Q(
+                owner=user,
+                engagement_stage=eng_stage)).order_by('position')
 
         serializer = ThinNextStepModelSerializer(ers, many=True)
         for next_step in serializer.data:
             if next_step['files'] is not None:
                 next_step['files'] = json.loads(next_step['files'])
-            if 'engagement' in next_step and next_step['engagement'] is not None and 'engagement_team' in next_step['engagement'] and next_step['engagement']['engagement_team'] is not None:
+            if 'engagement' in next_step and next_step['engagement'] \
+                is not None and 'engagement_team' in next_step[
+                    'engagement'] and \
+                    next_step['engagement']['engagement_team'] is not None:
                 for user in next_step['engagement']['engagement_team']:
-                    if (user['ssh_public_key'] != None):
+                    if (user['ssh_public_key'] is not None):
                         del user['ssh_public_key']
         return serializer
 
@@ -126,24 +148,27 @@ class NextStepSvc(BaseSvc):
 
         for data in dataList:
             try:
-                associated_files = json.dumps(data['files'], ensure_ascii=False)
-            except:
+                associated_files = json.dumps(
+                    data['files'], ensure_ascii=False)
+            except BaseException:
                 associated_files = "[]"
 
             try:
                 due_date = data['duedate']
-            except:
+            except BaseException:
                 due_date = None
 
-            nextStepObj = NextStep.objects.create(creator=user, last_updater=user, engagement=engObj, position=NextStep.objects.count() + 1,
-                                                  # @UndefinedVariable
-                                                  description=data[
-                                                      'description'], state=NextStepState.Incomplete.name, engagement_stage=engObj.engagement_stage,
-                                                  files=associated_files, due_date=due_date)  # @UndefinedVariable
+            nextStepObj = NextStep.objects.create(
+                creator=user, last_updater=user, engagement=engObj,
+                position=NextStep.objects.count() + 1,
+                description=data[
+                    'description'], state=NextStepState.Incomplete.name,
+                engagement_stage=engObj.engagement_stage,
+                files=associated_files, due_date=due_date)
 
             try:
                 data['assigneesUuids']
-            except:
+            except BaseException:
                 data['assigneesUuids'] = []
 
             for assigneesUuid in data['assigneesUuids']:
@@ -152,30 +177,39 @@ class NextStepSvc(BaseSvc):
                 nextStepObj.assignees.add(assignee_user)
                 nextStepObj.save()
                 update_or_insert_to_recent_engagements(
-                    assignee_user.uuid, vfObj, RecentEngagementActionType.NEXT_STEP_ASSIGNED.name)  # @UndefinedVariable
+                    assignee_user.uuid,
+                    vfObj,
+                    RecentEngagementActionType.NEXT_STEP_ASSIGNED.name)
 
             nextStepData.append(ThinNextStepModelSerializer(nextStepObj).data)
 
-            activity_data = AddNextStepsActivityData(VF.objects.get(engagement=engObj), user, engObj)
+            activity_data = AddNextStepsActivityData(
+                VF.objects.get(engagement=engObj), user, engObj)
             bus_service.send_message(ActivityEventMessage(activity_data))
 
-        if checklist_uuid != None:
-            from engagementmanager.service.checklist_state_service import set_state
-            set_state(True, checklist_uuid, isMoveToAutomation=True, description=desc)
-            logger.debug("Successfully added a Next Step to engagement_uuid=" +
-                              eng_uuid + " for checklist=" + checklist_uuid)
+        if checklist_uuid is not None:
+            from engagementmanager.service.checklist_state_service import \
+                set_state
+            set_state(True, checklist_uuid,
+                      isMoveToAutomation=True, description=desc)
+            logger.debug("Successfully added a \
+            Next Step to engagement_uuid=" +
+                         eng_uuid + " for checklist=" + checklist_uuid)
 
         return nextStepData
 
     '''
-    This function shall return the update type in the next step (can be Completed or Denied)
+    This function shall return the update type in the next step
+    (can be Completed or Denied)
     '''
 
     def validate_state_transition(self, user, current_state, next_state):
         update_type = next_state.name
-        logger.debug('validating step transition by %s from %s to %s', user.role.name, current_state, next_state)
+        logger.debug('validating step transition by %s from %s to %s',
+                     user.role.name, current_state, next_state)
 
-        if (current_state == NextStepState.Completed and next_state == NextStepState.Incomplete):
+        if (current_state == NextStepState.Completed and next_state ==
+                NextStepState.Incomplete):
             if (user.role.name == 'el'):
                 update_type = 'Denied'
             else:
@@ -184,7 +218,8 @@ class NextStepSvc(BaseSvc):
         return update_type
 
     def create_default_next_steps_for_user(self, user, el_user):
-        def cond(user): return False if (user.ssh_public_key and user.ssh_public_key != '') else True
+        def cond(user): return False if (
+            user.ssh_public_key and user.ssh_public_key != '') else True
         if cond(user):
             desc = "Please add your SSH key to be able to contribute."
 
@@ -198,12 +233,13 @@ class NextStepSvc(BaseSvc):
                 engagement_stage='Intake',
                 engagement=None,
                 owner=user,
-                next_step_type=NextStepType.set_ssh.name,  # @UndefinedVariable
+                next_step_type=NextStepType.set_ssh.name,
                 due_date=timezone.now() + timedelta(days=1))
             nextstep.save()
 
     '''
-    This method is for non-personal default next step only since it doesn't have an owner
+    This method is for non-personal default next step only
+    since it doesn't have an owner
     '''
 
     def create_default_next_steps(self, user, engagement, el_user):
@@ -215,16 +251,30 @@ class NextStepSvc(BaseSvc):
                 if (user.company == Constants.service_provider_company):
                     desc = desc.replace('$Contact', 'Vendor Contact')
                 else:
-                    desc = desc.replace('$Contact', Constants.service_provider_company_name + ' Sponsor Contact')
+                    desc = desc.replace(
+                        '$Contact',
+                        Constants.service_provider_company_name +
+                        ' Sponsor Contact')
                 logger.debug('Creating default next step : ' + desc)
 
-                nextstep = NextStep.objects.create(creator=el_user, last_updater=el_user, position=step['position'], description=desc, state='Incomplete', engagement_stage=step[
-                                                   'stage'], engagement=engagement, next_step_type=ns_type, due_date=timezone.now() + timedelta(days=1))
+                nextstep = NextStep.objects.create(
+                    creator=el_user,
+                    last_updater=el_user,
+                    position=step['position'],
+                    description=desc,
+                    state='Incomplete',
+                    engagement_stage=step['stage'],
+                    engagement=engagement,
+                    next_step_type=ns_type,
+                    due_date=timezone.now() +
+                    timedelta(
+                        days=1))
                 nextstep.assignees.add(el_user)
                 nextstep.save()
 
             else:
-                logger.debug('Skipping creation of default next step : ' + desc)
+                logger.debug(
+                    'Skipping creation of default next step : ' + desc)
 
     def update_next_steps_order(self, nextsteps):
         counter = 0
@@ -248,13 +298,17 @@ class NextStepSvc(BaseSvc):
                 step.assignees.remove(user)
             for assigneesUuid in data['assigneesUuids']:
                 assigned_user = IceUserProfile.objects.get(uuid=assigneesUuid)
-                eng_team = Engagement.objects.get(uuid=request_data_mgr.get_eng_uuid()).engagement_team.all()
+                eng_team = Engagement.objects.get(
+                    uuid=request_data_mgr.get_eng_uuid()).\
+                    engagement_team.all()
                 if (assigned_user in eng_team):
                     step.assignees.add(assigned_user)
                     step.save()
                 else:
                     logger.error(
-                        "An attempt to edit a NS and assign a user who is not in the engagement team was conducted, user wasn't assigned!")
+                        "An attempt to edit a NS and assign a user who is " +
+                        "not in the engagement team was conducted, " +
+                        "user wasn't assigned!")
                     continue
 
         step.last_updater = request_data_mgr.get_user()
@@ -268,7 +322,8 @@ class NextStepSvc(BaseSvc):
 
         if attr == 'state':
             update_type = self.validate_state_transition(
-                request_data_mgr.get_user(), NextStepState[step.state], NextStepState[state])
+                request_data_mgr.get_user(), NextStepState[step.state],
+                NextStepState[state])
             step.state = state
             step.last_updater = request_data_mgr.get_user()
             step.last_update_time = timezone.now()
@@ -276,5 +331,6 @@ class NextStepSvc(BaseSvc):
             step.save()
         if step.engagement:
             activity_data = UpdateNextStepsActivityData(
-                step.last_update_type, request_data_mgr.get_user(), step.engagement)
+                step.last_update_type,
+                request_data_mgr.get_user(), step.engagement)
             bus_service.send_message(ActivityEventMessage(activity_data))
index 8d6317e..d8a99f1 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -40,9 +40,11 @@ from django.contrib.auth import get_user_model
 from sshpubkeys import SSHKey
 
 from engagementmanager.apps import bus_service
-from engagementmanager.bus.messages.activity_event_message import ActivityEventMessage
+from engagementmanager.bus.messages.activity_event_message\
+    import ActivityEventMessage
 from engagementmanager.models import IceUserProfile, Role, VF
-from engagementmanager.serializers import SuperThinIceUserProfileModelSerializerForSignals
+from engagementmanager.serializers import\
+    SuperThinIceUserProfileModelSerializerForSignals
 from engagementmanager.service.base_service import BaseSvc
 from engagementmanager.utils.cryptography import CryptographyText
 from engagementmanager.utils.activities_data import SSHKeyAddedActivityData
@@ -61,15 +63,15 @@ class UserService(BaseSvc):
         try:
             ssh.parse()
         except Exception as e:
-            msg = """ssh provided by the user is invalid, type of exception: """ + \
-                str(e)
+            msg = """ssh provided by the user is invalid,""" +\
+                """type of exception: """ + str(e)
             self.logger.error(msg)
             msg = "Updating SSH Key failed due to invalid key."
             raise VvpBadRequest(msg)
 
         # remove comment from ssh key
         # ssh.comment returns comment attached to key
-        if ssh.comment != None:
+        if ssh.comment is not None:
             striped_key = sshkey.replace(ssh.comment, '').strip()
         else:
             striped_key = sshkey.strip()
@@ -85,7 +87,8 @@ class UserService(BaseSvc):
             raise Exception(msg)
         else:
             self.logger.debug(
-                "SSH key already taken by another user - uuid: %s", user_with_ssh.uuid)
+                "SSH key already taken by another user - uuid: %s",
+                user_with_ssh.uuid)
             msg = "Updating SSH Key failed due to invalid key."
             raise VvpBadRequest(msg)
 
@@ -100,7 +103,8 @@ class UserService(BaseSvc):
     def get_el_list(self):
         el_role = Role.objects.get(name='el')
         engagement_leads_users = IceUserProfile.objects.filter(role=el_role)
-        return SuperThinIceUserProfileModelSerializerForSignals(engagement_leads_users, many=True).data
+        return SuperThinIceUserProfileModelSerializerForSignals(
+            engagement_leads_users, many=True).data
 
     def get_user_by_email(self, email):
         UserModel = get_user_model()
index aa3a9d3..7399cd2 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 341cfc1..807a8ea 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -54,14 +54,19 @@ class VFCSvc(BaseSvc):
         duplicate = False
         many = True
         dict = {}
-        # Iterate through all the VFCs that are received from the user, if there's duplication -> check the VF, if it is the same ->duplicate = True
-        # If there's a duplication and the other VFCs trying to be created are not
-        # duplicated -> Many = True -> they would be successfully created any way
+        # Iterate through all the VFCs that are received from the user,
+        # if there's duplication -> check the VF,
+        # if it is the same ->duplicate = True
+        # If there's a duplication and the other
+        # VFCs trying to be created are not
+        # duplicated -> Many = True -> they would be successfully created any
+        # way
         for i in range(len(data['vfcs'])):
             dict.update(data['vfcs'][i])
             # check if the VFC already exist (filter by name)
             try:
-                vfc = VFC.objects.filter(name=dict['name'], external_ref_id=dict['external_ref_id'])
+                vfc = VFC.objects.filter(
+                    name=dict['name'], external_ref_id=dict['external_ref_id'])
                 # if found VFC with same name and ref id
                 if (vfc.count() > 0):
                     for item in vfc:
@@ -69,8 +74,10 @@ class VFCSvc(BaseSvc):
                             if (not duplicate):
                                 duplicate = True
                             duplicateNames.append(dict['name'])
-                    # if found a similar VFC with name and ref_id, but VF is different (
-                    # cannot use else, and raise, since the for has to check all vfcs that
+                    # if found a similar VFC with name and ref_id,\
+                    # but VF is different (
+                    # cannot use else, and raise,
+                    # since the for has to check all vfcs that
                     # match - for example, 2 VFs with same vfc)
                     if not duplicate:
                         raise VFC.DoesNotExist
@@ -79,19 +86,26 @@ class VFCSvc(BaseSvc):
                     raise VFC.DoesNotExist
             # If the VFC Does not exist, then continue as usual and create it.
             except VFC.DoesNotExist:
-                many = True  # not used, unless there's a duplicate as well, just a helper
+                many = True
+                # not used, unless there's a duplicate as well, just a helper
 
-                user = IceUserProfile.objects.get(email=data['creator']['email'])
+                user = IceUserProfile.objects.get(
+                    email=data['creator']['email'])
                 vf = VF.objects.get(uuid=data['vf_uuid'])
                 # Check if the company that the user entered already exist.
                 try:
                     company = Vendor.objects.get(name=dict['company'])
                 except Vendor.DoesNotExist:
-                    company = Vendor.objects.create(name=dict['company'], public=False)
+                    company = Vendor.objects.create(
+                        name=dict['company'], public=False)
                     company.save()
                 # create the VFC
-                vfc = VFC.objects.create(name=dict['name'], company=company, vf=vf,
-                                         creator=user, external_ref_id=dict['external_ref_id'])
+                vfc = VFC.objects.create(
+                    name=dict['name'],
+                    company=company,
+                    vf=vf,
+                    creator=user,
+                    external_ref_id=dict['external_ref_id'])
                 if 'ice_mandated' in dict:
                     vfc.ice_mandated = dict['ice_mandated']
                 vfc.save()
@@ -101,7 +115,8 @@ class VFCSvc(BaseSvc):
             num = 1
             for vfc_name in duplicateNames:
                 msg = msg + str(num) + ". The VFC " + vfc_name + \
-                    " already exist, the VF that it is related to is: " + item.vf.name + "\n"
+                    " already exist, the VF that it is related to is: "\
+                    + item.vf.name + "\n"
                 num += 1
             msg = msg + "\nThe other VFCs were created succesfully\n"
             self.logger.error(msg)
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index f006322..df149ed 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -58,11 +58,14 @@ class SlackClient(object):
 
         # create the slack client
         self.client = None
-        if settings.SLACK_API_TOKEN is not None and settings.SLACK_API_TOKEN != "":
+        if settings.SLACK_API_TOKEN is not None and \
+                settings.SLACK_API_TOKEN != "":
             try:
                 self.client = Slacker(settings.SLACK_API_TOKEN)
             except Exception as exception:
-                logger.error('Unknown error while creating the a slack client: ' + str(exception))
+                logger.error(
+                    'Unknown error while creating the a slack client: ' +
+                    str(exception))
 
     # post a message via the Slack API
     def trigger_slack_chat_post_message(self, to, message):
@@ -75,11 +78,13 @@ class SlackClient(object):
              """
         try:
             # Send a message to a channel or a user
-            response = self.client.chat.post_message(to, message)
+            self.client.chat.post_message(to, message)
         except Error as e:
             logger.error('Invalid Slack API token was provided: ' + str(e))
         except Exception as exception:
-            logger.error('Unknown error while posting a message to Slack: ' + str(exception))
+            logger.error(
+                'Unknown error while posting a message to Slack: ' +
+                str(exception))
 
     # asynchronously post a message
     def post_message(self, to, message):
@@ -91,8 +96,11 @@ class SlackClient(object):
 
         if to and message:
             logger.debug('Trigger Slack API - chat.post_message')
-            future = executor.submit(self.trigger_slack_chat_post_message, to, message)
-            logger.debug('Continuing after triggering the Slack API - chat.post_message')
+            executor.submit(
+                self.trigger_slack_chat_post_message, to, message)
+            logger.debug(
+                'Continuing after triggering the Slack API - \
+                chat.post_message')
 
     # send slack message to the engagement channel
     def update_engagement_channel(self, message, notify_channel=False):
@@ -119,94 +127,219 @@ class SlackClient(object):
             self.post_message('@' + user.slack_handle, message)
 
     # update reviewer or peer reviewer when a new engagement is created
-    def update_reviewer_or_peer_reviewer(self, engagement_manual_id, vf_name, user, old_user, notification_type='reviewer'):
+    def update_reviewer_or_peer_reviewer(
+            self,
+            engagement_manual_id,
+            vf_name,
+            user,
+            old_user,
+            notification_type='reviewer'):
         # construct the Slack messages
-        user_message = 'You have been assigned as the _{}_ for the engagement _{}: {}_. '.format(
+        user_message = 'You have been assigned as the \
+        _{}_ for the engagement _{}: {}_. '.format(
             notification_type, engagement_manual_id, vf_name)
-        old_user_message_postfix = 'The assigned _{}_ is now _{}_.'.format(notification_type, user.full_name)
+        old_user_message_postfix = 'The assigned _{}_ is now _{}_.'.format(
+            notification_type, user.full_name)
 
         user_message_postfix = ""
         old_user_message = ""
         if old_user is not None:
-            user_message_postfix = 'The previously assigned _{}_ was _{}_ in case you need to reach out for questions.'.format(
+            user_message_postfix = 'The previously assigned _{}_ was _{}_ in \
+            case you need to reach out for questions.'.format(
                 notification_type, old_user.full_name)
-            old_user_message = 'You are no longer the assigned _{}_ for the engagement _{}: {}_. '.format(
+            old_user_message = 'You are no longer the assigned _{}_ for the \
+            engagement _{}: {}_. '.format(
                 notification_type, engagement_manual_id, vf_name)
 
         # send Slack messages
         self.send_message_to_user(user, user_message + user_message_postfix)
-        self.send_message_to_user(old_user, old_user_message + old_user_message_postfix)
+        self.send_message_to_user(
+            old_user, old_user_message + old_user_message_postfix)
 
     # update the engagement channel when a new engagement is created
-    def update_engagement_channel_for_new_engagement(self, engagement_manual_id, vf_name, reviewer, peer_reviewer, creator):
-        new_engagement_message = '_{}_ created a new engagement _{}: {}_. _{}_ was assigned as the reviewer and _{}_ as the peer reviewer'.format(
-            creator.full_name, engagement_manual_id, vf_name, reviewer.full_name, peer_reviewer.full_name)
+    def update_engagement_channel_for_new_engagement(
+            self, engagement_manual_id, vf_name, reviewer,
+            peer_reviewer, creator):
+        new_engagement_message = '_{}_ created a new engagement _{}: {}_. \
+        _{}_ was assigned as the reviewer and \
+        _{}_ as the peer reviewer'.format(
+            creator.full_name, engagement_manual_id, vf_name,
+            reviewer.full_name, peer_reviewer.full_name)
         self.update_engagement_channel(new_engagement_message, True)
 
-    # update reviewer, peer reviewer and the engagement channel when a new engagement is created
-    def send_slack_notifications_for_new_engagement(self, engagement_manual_id, vf_name, reviewer, peer_reviewer, creator):
-        self.update_reviewer_or_peer_reviewer(engagement_manual_id, vf_name, reviewer, None, 'reviewer')
-        self.update_reviewer_or_peer_reviewer(engagement_manual_id, vf_name, peer_reviewer, None, 'peer reviewer')
+    # update reviewer, peer reviewer and the engagement channel when a new
+    # engagement is created
+    def send_slack_notifications_for_new_engagement(
+            self,
+            engagement_manual_id,
+            vf_name,
+            reviewer,
+            peer_reviewer,
+            creator):
+        self.update_reviewer_or_peer_reviewer(
+            engagement_manual_id, vf_name, reviewer, None, 'reviewer')
+        self.update_reviewer_or_peer_reviewer(
+            engagement_manual_id, vf_name, peer_reviewer, None,
+            'peer reviewer')
         self.update_engagement_channel_for_new_engagement(
             engagement_manual_id, vf_name, reviewer, peer_reviewer, creator)
 
     def send_slack_notifications_for_new_feedback(self, feedback, user):
-        new_feedback_message = 'Created a new Feedback by {} Description : {}.'.format(
+        new_feedback_message = 'Created a new Feedback by {} Description : \
+        {}.'.format(
             user.full_name, feedback.description)
         self.update_engagement_channel(new_feedback_message, True)
         self.update_devops_channel(new_feedback_message, True)
 
     # update the engagement channel when the stage is changed for an engagement
-    def update_for_change_of_the_engagement_stage(self, engagement_manual_id, vf_name, stage):
-        change_engagement_stage_message = 'The engagement _{}: {}_ was moved to the _{}_ stage.'.format(
+    def update_for_change_of_the_engagement_stage(
+            self, engagement_manual_id, vf_name, stage):
+        change_engagement_stage_message = 'The engagement _{}: \
+        {}_ was moved to the _{}_ stage.'.format(
             engagement_manual_id, vf_name, stage)
         self.update_engagement_channel(change_engagement_stage_message)
 
     # update the engagement channel when an engagement is archived
-    def update_for_archived_engagement(self, engagement_manual_id, vf_name, reason):
-        archived_engagement_message = 'The engagement _{}: {}_ was archived because of this reason: _{}_.'.format(
+    def update_for_archived_engagement(
+            self, engagement_manual_id, vf_name, reason):
+        archived_engagement_message = 'The engagement _{}: \
+        {}_ was archived because of this reason: _{}_.'.format(
             engagement_manual_id, vf_name, reason)
         self.update_engagement_channel(archived_engagement_message)
 
     # update the reviewer and peer reviewer when the git repository is updated
-    def send_notifications_on_git_push(self, engagement_manual_id, vf_name, reviewer, peer_reviewer, committed_files):
-        str_committed_files = "The following files was added or changed as part of the commit:\n\n- %s" % '\n- '.join(
+    def send_notifications_on_git_push(
+            self,
+            engagement_manual_id,
+            vf_name,
+            reviewer,
+            peer_reviewer,
+            committed_files):
+        str_committed_files = "The following files was added \
+        or changed as part of the commit:\n\n- %s" % '\n- '.join(
             committed_files)
-        message = 'The Git repository for the engagement _{}: {}_ in which you are assigned as a _{}_ was updated. ' + \
+        message = 'The Git repository for the engagement _{}: \
+        {}_ in which you are assigned as a _{}_ was updated. ' + \
             str_committed_files
-        self.send_message_to_user(reviewer, message.format(engagement_manual_id, vf_name, 'reviewer'))
-        self.send_message_to_user(peer_reviewer, message.format(engagement_manual_id, vf_name, 'peer_reviewer'))
+        self.send_message_to_user(reviewer, message.format(
+            engagement_manual_id, vf_name, 'reviewer'))
+        self.send_message_to_user(peer_reviewer, message.format(
+            engagement_manual_id, vf_name, 'peer_reviewer'))
 
-    # update the reviewer when the automation phase is completed for a checklist
-    def send_notification_to_reviewer_when_automation_completes(self, engagement_manual_id, vf_name, reviewer, checklist_name):
+    def send_notifications_bucket_image_update(
+            self,
+            engagement_manual_id,
+            vf_name,
+            reviewer,
+            peer_reviewer,
+            bucket_name):
+        str_committed_files = "The following bucket was updated with new image files: %s" % bucket_name
+        message = 'The rgwa bucket for the engagement _{}: {}_ in which you are assigned as a _{}_ was updated. ' + \
+            str_committed_files
+        self.send_message_to_user(
+            reviewer,
+            message.format(
+                engagement_manual_id,
+                vf_name,
+                'reviewer'))
+        self.send_message_to_user(
+            peer_reviewer,
+            message.format(
+                engagement_manual_id,
+                vf_name,
+                'peer_reviewer'))
+
+    # update the reviewer when the automation phase is completed for a
+    # checklist
+    def send_notification_to_reviewer_when_automation_completes(
+            self, engagement_manual_id, vf_name, reviewer, checklist_name):
         message = 'The automation phase completed for the checklist _{}_ under the engagement _{}: {}_. You can now start your review of it.'
-        self.send_message_to_user(reviewer, message.format(checklist_name, engagement_manual_id, vf_name))
+        self.send_message_to_user(
+            reviewer,
+            message.format(
+                checklist_name,
+                engagement_manual_id,
+                vf_name))
 
-    # update the peer reviewer when the review phase is completed for a checklist
-    def send_notification_to_peer_reviewer_when_the_review_completes(self, engagement_manual_id, vf_name, reviewer, peer_reviewer, checklist_name):
-        message = 'The review phase was completed by _{}_ for the checklist _{}_ under the engagement _{}: {}_. You can now start your peer review of it.'
+    # update the peer reviewer when the review phase is completed for a
+    # checklist
+    def send_notification_to_peer_reviewer_when_the_review_completes(
+            self, engagement_manual_id, vf_name, reviewer, peer_reviewer,
+            checklist_name):
+        message = 'The review phase was completed by _{}_ for the checklist \
+        _{}_ under the engagement _{}: {}_. \
+        You can now start your peer review of it.'
         self.send_message_to_user(peer_reviewer, message.format(
-            reviewer.full_name, checklist_name, engagement_manual_id, vf_name))
+            reviewer.full_name, checklist_name,
+            engagement_manual_id, vf_name))
 
-    # update the admins when the review and peer reviews have been completed for a checklist
-    def send_notification_to_admins_when_the_peer_review_completes(self, engagement_manual_id, vf_name, reviewer, peer_reviewer, admins, checklist_name):
-        message = 'The manual reviews have been completed by the reviewer _{}_ and peer reviewer _{}_ for the checklist _{}_ under the engagement _{}: {}_. It is now waiting for an approval by you or any other admin.'
+    # update the admins when the review and peer reviews have been completed
+    # for a checklist
+    def send_notification_to_admins_when_the_peer_review_completes(
+            self,
+            engagement_manual_id,
+            vf_name,
+            reviewer,
+            peer_reviewer,
+            admins,
+            checklist_name):
+        message = 'The manual reviews have been completed by the reviewer \
+        _{}_ and peer reviewer _{}_ for the checklist _{}_ under the \
+        engagement _{}: {}_. It is now waiting for an approval by you \
+        or any other admin.'
         for admin in admins:
-            self.send_message_to_user(admin, message.format(
-                reviewer.full_name, peer_reviewer.full_name, checklist_name, engagement_manual_id, vf_name))
+            self.send_message_to_user(
+                admin,
+                message.format(
+                    reviewer.full_name,
+                    peer_reviewer.full_name,
+                    checklist_name,
+                    engagement_manual_id,
+                    vf_name))
 
     # update reviewer when a checklist is approved
-    def send_notification_to_reviewer_when_approved(self, engagement_manual_id, vf_name, reviewer, checklist_name):
-        message = 'The checklist _{}_ under the engagement _{}: {}_ is now approved. You can now hand off the artifacts and close out the checklist.'
-        self.send_message_to_user(reviewer, message.format(checklist_name, engagement_manual_id, vf_name))
+    def send_notification_to_reviewer_when_approved(
+            self, engagement_manual_id, vf_name, reviewer, checklist_name):
+        message = 'The checklist _{}_ under the engagement _{}: {}_ is \
+        now approved. You can now hand off the artifacts and close \
+        out the checklist.'
+        self.send_message_to_user(reviewer, message.format(
+            checklist_name, engagement_manual_id, vf_name))
 
     # update reviewer, peer reviewer and admins when a checklist is closed
-    def send_notifications_when_closed(self, engagement_manual_id, vf_name, reviewer, peer_reviewer, admins, checklist_name):
-        message = 'The checklist _{}_ under the engagement _{}: {}_ has now been closed and all the asssociated artifacts are validated. The reviewer was _{}_ and the peer reviewer was _{}_.'
-        self.send_message_to_user(reviewer, message.format(checklist_name, engagement_manual_id,
-                                                           vf_name, reviewer.full_name, peer_reviewer.full_name))
-        self.send_message_to_user(peer_reviewer, message.format(
-            checklist_name, engagement_manual_id, vf_name, reviewer.full_name, peer_reviewer.full_name))
+    def send_notifications_when_closed(
+            self,
+            engagement_manual_id,
+            vf_name,
+            reviewer,
+            peer_reviewer,
+            admins,
+            checklist_name):
+        message = 'The checklist _{}_ under the engagement _{}: {}_ has now \
+        been closed and all the asssociated artifacts are validated. The \
+        reviewer was _{}_ and the peer reviewer was _{}_.'
+        self.send_message_to_user(
+            reviewer,
+            message.format(
+                checklist_name,
+                engagement_manual_id,
+                vf_name,
+                reviewer.full_name,
+                peer_reviewer.full_name))
+        self.send_message_to_user(
+            peer_reviewer,
+            message.format(
+                checklist_name,
+                engagement_manual_id,
+                vf_name,
+                reviewer.full_name,
+                peer_reviewer.full_name))
         for admin in admins:
-            self.send_message_to_user(admin, message.format(checklist_name, engagement_manual_id,
-                                                            vf_name, reviewer.full_name, peer_reviewer.full_name))
+            self.send_message_to_user(
+                admin,
+                message.format(
+                    checklist_name,
+                    engagement_manual_id,
+                    vf_name,
+                    reviewer.full_name,
+                    peer_reviewer.full_name))
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 1a6a0ee..77db16b 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 73d427c..7ddc867 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -45,7 +45,8 @@ from django.utils import timezone
 from engagementmanager.utils.constants import Constants
 from engagementmanager.vm_integration import vm_client
 from validationmanager.rados.rgwa_client import RGWAClient
-from validationmanager.tests.test_rgwa_client_factory import TestRGWAClientFactory
+from validationmanager.tests.test_rgwa_client_factory import \
+    TestRGWAClientFactory
 
 
 class ActivateTestCase(TestBaseEntity):
@@ -56,25 +57,41 @@ class ActivateTestCase(TestBaseEntity):
 
         self.urlStr = self.urlPrefix + "signup/"
         self.createDefaultRoles()
-        uuid, vendor = self.creator.createVendor(Constants.service_provider_company_name)
+        uuid, vendor = self.creator.createVendor(
+            Constants.service_provider_company_name)
         self.activation_token_time = timezone.now()
         self.activation_token_time = self.activation_token_time.replace(
             2012, 1, 2, 13, 48, 25)
-        print("This is the time that is going to be added to expiredTokenUser: " +
+        print("This is the time that is going to be " +
+              "added to expiredTokenUser: " +
               str(self.activation_token_time))
-        self.user = self.creator.createUser(vendor, self.randomGenerator("email"), self.randomGenerator(
-            "randomNumber"), self.randomGenerator("randomString"), self.standard_user, True)
-        self.new_user = self.creator.createUser(vendor, self.randomGenerator("email"), self.randomGenerator(
-            "randomNumber"), self.randomGenerator("randomString"), self.standard_user, True)
+        self.user = self.creator.createUser(
+            vendor,
+            self.randomGenerator("email"),
+            self.randomGenerator("randomNumber"),
+            self.randomGenerator("randomString"),
+            self.standard_user,
+            True)
+        self.new_user = self.creator.createUser(
+            vendor,
+            self.randomGenerator("email"),
+            self.randomGenerator("randomNumber"),
+            self.randomGenerator("randomString"),
+            self.standard_user,
+            True)
         print('-----------------------------------------------------')
         print('Created User:')
         print('UUID: ' + str(self.user.uuid))
         print('Full Name: ' + self.user.full_name)
         print('-----------------------------------------------------')
-        self.params = '{"company":"' + str(self.user.company) + '","full_name":"' + self.user.full_name + '","email":"' + self.user.email + '","phone_number":"' + self.user.phone_number + \
-            '","password":"' + self.user.user.password + '","regular_email_updates":"' + \
+        self.params = '{"company":"' + str(self.user.company) \
+            + '","full_name":"' + self.user.full_name + '","email":"' + \
+            self.user.email + '","phone_number":"' + self.user.phone_number + \
+            '","password":"' + self.user.user.password \
+            + '","regular_email_updates":"' + \
             str(self.user.regular_email_updates) + \
-            '","is_service_provider_contact":"' + str(self.user.is_service_provider_contact) + '"}'
+            '","is_service_provider_contact":"' + \
+            str(self.user.is_service_provider_contact) + '"}'
         self.userToken = self.loginAndCreateSessionToken(self.user)
         self.new_user_token = self.loginAndCreateSessionToken(self.new_user)
 
@@ -83,7 +100,7 @@ class ActivateTestCase(TestBaseEntity):
             vm_client.fire_event_in_bg(
                 'send_create_user_in_rgwa_event', self.user)
             rgwa = TestRGWAClientFactory.admin()
-            rgwa_user = rgwa.get_user(self.user.full_name)
+            rgwa_user = rgwa.get_user(self.user.uuid)
             if rgwa_user is None:
                 print("Test Failed!")
             else:
@@ -91,15 +108,15 @@ class ActivateTestCase(TestBaseEntity):
                 print("######access_key#################= ", access_key)
                 secret_key = rgwa_user['secret_key']
                 print("######secret_key#################= ", secret_key)
-                self.assertTrue(access_key and secret_key != None)
+                self.assertTrue(access_key and secret_key is not None)
                 print("#################################")
                 print("Test PASS!")
                 self.printTestName("Test ended")
 
 
 # Whenever a new user is configured, we should create a RadosGW user for them.
-# If unspecified, the access keys are generated on the server and returned here
-# in the response.
+# If unspecified, the access keys are generated
+# on the server and returned here in the response.
     def testCreateAndGetRgwaUser(self):
         if settings.IS_SIGNAL_ENABLED:
             base_url = 'http://{S3_HOST}:{S3_PORT}/admin'.format(
@@ -116,7 +133,7 @@ class ActivateTestCase(TestBaseEntity):
             new_user = admin_conn.create_user(
                 uid=username, display_name='User "%s"' % username)
             print("new_user = " + str(new_user))
-            self.assertTrue(new_user['user_id'] != None)
+            self.assertTrue(new_user['user_id'] is not None)
             get_user = admin_conn.get_user(new_user['user_id'])
             self.assertTrue(new_user['user_id'] == get_user['user_id'])
 
@@ -129,17 +146,18 @@ class ActivateTestCase(TestBaseEntity):
             print("S3_HOST = " + self.s3_host)
             print("s3_port =" + str(self.s3_port))
 
-            boto_conn = S3Connection(host=self.s3_host,
-                                     port=self.s3_port,
-                                     aws_access_key_id=s3aws_access_key_id,
-                                     aws_secret_access_key=s3aws_secret_access_key,
-                                     calling_format=OrdinaryCallingFormat(),
-                                     is_secure=False,
-                                     )
+            boto_conn = S3Connection(
+                host=self.s3_host,
+                port=self.s3_port,
+                aws_access_key_id=s3aws_access_key_id,
+                aws_secret_access_key=s3aws_secret_access_key,
+                calling_format=OrdinaryCallingFormat(),
+                is_secure=False,
+            )
             boto_conn.num_retries = 0
             bucketname = self.randomGenerator("randomString").lower()
             new_bucket = boto_conn.create_bucket(bucketname)
-            assertTrue(new_bucket != None)
+            assertTrue(new_bucket is not None)
             print("new_bucket = " + str(new_bucket))
             bucket = boto_conn.get_bucket(bucketname)
             print("bucket = " + str(bucket))
@@ -149,27 +167,34 @@ class ActivateTestCase(TestBaseEntity):
     def testGetSecretKey(self):
         vm_client.send_create_user_in_rgwa_event(self.user)
         urlStr = self.urlPrefix + 'users/account/rgwa/'
-        print("urlStr of get secret key",urlStr)
+        print("urlStr of get secret key", urlStr)
         self.printTestName("testGetSecretKey [Start]")
-        response = self.c.get(urlStr, data={}, content_type='application/json',
-                              **{'HTTP_AUTHORIZATION': "token " + self.userToken})
+        response = self.c.get(
+            urlStr,
+            data={},
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.userToken})
         print('Got response : ' + str(response.status_code))
         dict_response = json.loads(response.content)
-        print("api response",dict_response)
+        print("api response", dict_response)
         self.assertTrue(dict_response["rgwa_secret_key"] is not None)
         self.printTestName("testGetSecretKey [End]")
 
     def testNegativeGetSecretKeyInvalidToken(self):
         vm_client.send_create_user_in_rgwa_event(self.user)
         urlStr = self.urlPrefix + 'users/account/rgwa/'
-        print("urlStr of get secret key",urlStr)
+        print("urlStr of get secret key", urlStr)
         self.printTestName("testGetSecretKey [Start]")
-        response = self.c.get(urlStr, data={}, content_type='application/json',
-                              **{'HTTP_AUTHORIZATION': 'token' + self.new_user_token})
+        response = self.c.get(
+            urlStr,
+            data={},
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': 'token' + self.new_user_token})
         print('Got response : ' + str(response.status_code))
         dict_response = json.loads(response.content)
-        print("api response",dict_response)
-        self.assertTrue(dict_response[
-                        "detail"] == 'You must authenticate in order to ' +
-                        'perform this action: Authentication credentials were not provided.')
+        print("api response", dict_response)
+        self.assertTrue(
+            dict_response["detail"] == 'You must authenticate in order to ' +
+            'perform this action: Authentication ' +
+            'credentials were not provided.')
         self.printTestName("testGetSecretKey [End]")
index a845373..25403dd 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -47,22 +47,43 @@ class ActivateTestCase(TestBaseEntity):
     def childSetup(self):  # Variables to use in this class.
         self.urlStr = self.urlPrefix + "signup/"
         self.createDefaultRoles()
-        uuid, vendor = self.creator.createVendor(Constants.service_provider_company_name)
+        uuid, vendor = self.creator.createVendor(
+            Constants.service_provider_company_name)
         self.activation_token_time = timezone.now()
-        self.activation_token_time = self.activation_token_time.replace(2012, 1, 2, 13, 48, 25)
-        print("This is the time that is going to be added to expiredTokenUser: " + str(self.activation_token_time))
-        self.user = self.creator.createUser(vendor, self.randomGenerator("email"), self.randomGenerator(
-            "randomNumber"), self.randomGenerator("randomString"), self.standard_user, False)
-        self.expiredTokenUser = self.creator.createUser(vendor, self.randomGenerator("email"), self.randomGenerator(
-            "randomNumber"), self.randomGenerator("randomString"), self.standard_user, False, activation_token_create_time=self.activation_token_time)
+        self.activation_token_time = self.activation_token_time.replace(
+            2012, 1, 2, 13, 48, 25)
+        print("This is the time that is going " +
+              "to be added to expiredTokenUser: " +
+              str(self.activation_token_time))
+        self.user = self.creator.createUser(
+            vendor,
+            self.randomGenerator("email"),
+            self.randomGenerator("randomNumber"),
+            self.randomGenerator("randomString"),
+            self.standard_user,
+            False)
+        self.expiredTokenUser = self.creator.createUser(
+            vendor,
+            self.randomGenerator("email"),
+            self.randomGenerator("randomNumber"),
+            self.randomGenerator("randomString"),
+            self.standard_user,
+            False,
+            activation_token_create_time=self.activation_token_time)
         print('-----------------------------------------------------')
         print('Created User:')
         print('UUID: ' + str(self.user.uuid))
         print('Full Name: ' + self.user.full_name)
         print('-----------------------------------------------------')
-        self.params = '{"company":"' + str(self.user.company) + '","full_name":"' + self.user.full_name + '","email":"' + self.user.email + '","phone_number":"' + self.user.phone_number + \
-            '","password":"' + self.user.user.password + '","regular_email_updates":"' + \
-            str(self.user.regular_email_updates) + '","is_service_provider_contact":"' + str(self.user.is_service_provider_contact) + '"}'
+        self.params = '{"company":"' + str(self.user.company) + \
+            '","full_name":"' + self.user.full_name + '","email":"' + \
+            self.user.email + '","phone_number":"' + \
+            self.user.phone_number + \
+            '","password":"' + self.user.user.password + \
+            '","regular_email_updates":"' + \
+            str(self.user.regular_email_updates) + \
+            '","is_service_provider_contact":"' + \
+            str(self.user.is_service_provider_contact) + '"}'
 
     def testActivation(self):
         print("\n\n$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
@@ -70,12 +91,15 @@ class ActivateTestCase(TestBaseEntity):
         print("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n")
         for a in range(2):
             print("###############################################")
-        print("  Before activation, Current User's activation mode: " + str(self.user.user.is_active))
+        print("  Before activation, Current User's activation mode: " +
+              str(self.user.user.is_active))
         for a in range(2):
             print("###############################################")
         user_uuid = self.user.uuid
-        print(self.urlPrefix + 'activate/' + str(user_uuid) + '/' + str(self.user.user.activation_token))
-        print("Activating through the activate_user function: (simulating a GET request)")
+        print(self.urlPrefix + 'activate/' + str(user_uuid) +
+              '/' + str(self.user.user.activation_token))
+        print("Activating through the activate_user function: " +
+              "(simulating a GET request)")
         response = self.c.get(self.urlPrefix + 'activate/' + str(user_uuid) +
                               '/' + str(self.user.user.activation_token))
         print("Response: " + str(response.status_code))
@@ -84,11 +108,13 @@ class ActivateTestCase(TestBaseEntity):
             print("******")
         for a in range(2):
             print("###############################################")
-        print("   Current User's activation mode: " + str(self.user.user.is_active))
+        print("   Current User's activation mode: " +
+              str(self.user.user.is_active))
         for a in range(2):
             print("###############################################")
-        print("Current User's activation mode: " + str(self.user.user.is_active))
-        if (self.user.user.is_active != True):
+        print("Current User's activation mode: " +
+              str(self.user.user.is_active))
+        if (not self.user.user.is_active):
             for a in range(2):
                 print("###############################################")
             print("   User's activation failed: is_active != True..")
@@ -108,23 +134,29 @@ class ActivateTestCase(TestBaseEntity):
         print("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n")
         for a in range(2):
             print("###############################################")
-        print("Current User's activation mode: " + str(self.user.user.is_active))
+        print("Current User's activation mode: " +
+              str(self.user.user.is_active))
         for a in range(2):
             print("###############################################")
 
-        urlStrToGET = self.urlPrefix + "users/"
         user_uuid = self.expiredTokenUser.uuid
-        print("\n\nA user with was pre-initiated with old token creation time  : 2012-01-02 13:48:25.299000+00:00\n\n")
-        response = self.c.get(self.urlPrefix + 'activate/' + str(user_uuid) + '/' +
-                              str(self.expiredTokenUser.user.activation_token))
+        print("\n\nA user with was pre-initiated with old token " +
+              "creation time: 2012-01-02 13:48:25.299000+00:00\n\n")
+        self.c.get(
+            self.urlPrefix +
+            'activate/' +
+            str(user_uuid) +
+            '/' +
+            str(self.expiredTokenUser.user.activation_token))
         self.user.refresh_from_db()
         for a in range(2):
             print("###############################################")
-        print("   Current User's activation mode: " + str(self.expiredTokenUser.user.is_active))
+        print("   Current User's activation mode: " +
+              str(self.expiredTokenUser.user.is_active))
         for a in range(2):
             print("###############################################")
         print("\n\n")
-        if (self.expiredTokenUser.user.activation_token != True):
+        if (not self.expiredTokenUser.user.activation_token):
             for a in range(2):
                 print("###############################################")
             print("Test Success!")
@@ -143,23 +175,27 @@ class ActivateTestCase(TestBaseEntity):
         print("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n")
         for a in range(2):
             print("###############################################")
-        print("Current User's activation mode: " + str(self.user.user.is_active))
+        print("Current User's activation mode: " +
+              str(self.user.user.is_active))
         for a in range(2):
             print("###############################################")
 
-        urlStrToGET = self.urlPrefix + "users/"
-        user_uuid = self.expiredTokenUser.uuid
         print("\n\n Trying to activate a user with an unmatching token")
-        response = self.c.get(self.urlPrefix + 'activate/' + str(self.user.uuid) +
-                              '/' + str(self.expiredTokenUser.user.activation_token))
+        self.c.get(
+            self.urlPrefix +
+            'activate/' +
+            str(self.user.uuid) +
+            '/' +
+            str(self.expiredTokenUser.user.activation_token))
         self.user.refresh_from_db()
         for a in range(2):
             print("###############################################")
-        print("   Current User's activation mode: " + str(self.expiredTokenUser.user.is_active))
+        print("   Current User's activation mode: " +
+              str(self.expiredTokenUser.user.is_active))
         for a in range(2):
             print("###############################################")
         print("\n\n")
-        if (self.expiredTokenUser.user.activation_token != True):
+        if (not self.expiredTokenUser.user.activation_token):
             for a in range(2):
                 print("###############################################")
             print("Test Success!")
index 9e83e9f..65b5bef 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
 # ============LICENSE_END============================================
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
-from engagementmanager.bus.messages.activity_event_message import ActivityEventMessage
+from engagementmanager.bus.messages.activity_event_message \
+    import ActivityEventMessage
 from engagementmanager.models import Vendor
-from engagementmanager.utils.activities_data import UserJoinedEngagementActivityData
+from engagementmanager.utils.activities_data import \
+    UserJoinedEngagementActivityData
 from engagementmanager.tests.test_base_entity import TestBaseEntity
 from engagementmanager.utils.constants import Constants
 from engagementmanager.apps import bus_service
@@ -54,14 +56,30 @@ class ActivityTestCase(TestBaseEntity):
 
         self.createDefaultRoles()
         # Create a user with role el
-        vendor = Vendor.objects.get(name=Constants.service_provider_company_name)
-        self.el_user = self.creator.createUser(vendor, self.randomGenerator(
-            "main-vendor-email"), self.randomGenerator("randomNumber"), self.randomGenerator("randomString"), self.el, True)
+        vendor = Vendor.objects.get(
+            name=Constants.service_provider_company_name)
+        self.el_user = self.creator.createUser(
+            vendor,
+            self.randomGenerator("main-vendor-email"),
+            self.randomGenerator("randomNumber"),
+            self.randomGenerator("randomString"),
+            self.el,
+            True)
         vendor = Vendor.objects.get(name='Other')
-        self.user = self.creator.createUser(vendor, self.randomGenerator("email"), self.randomGenerator(
-            "randomNumber"), self.randomGenerator("randomString"), self.standard_user, True)
-        self.pruser = self.creator.createUser(vendor, self.randomGenerator("email"), self.randomGenerator(
-            "randomNumber"), self.randomGenerator("randomString"), self.standard_user, True)
+        self.user = self.creator.createUser(
+            vendor,
+            self.randomGenerator("email"),
+            self.randomGenerator("randomNumber"),
+            self.randomGenerator("randomString"),
+            self.standard_user,
+            True)
+        self.pruser = self.creator.createUser(
+            vendor,
+            self.randomGenerator("email"),
+            self.randomGenerator("randomNumber"),
+            self.randomGenerator("randomString"),
+            self.standard_user,
+            True)
 
         # Create an Engagement with team
         self.engagement = self.creator.createEngagement(self.randomGenerator(
@@ -73,9 +91,14 @@ class ActivityTestCase(TestBaseEntity):
 
         # Create a VF
         self.deploymentTarget = self.creator.createDeploymentTarget(
-            self.randomGenerator("randomString"), self.randomGenerator("randomString"))
-        self.vf = self.creator.createVF(self.randomGenerator("randomString"),
-                                        self.engagement, self.deploymentTarget, False, vendor)
+            self.randomGenerator("randomString"),
+            self.randomGenerator("randomString"))
+        self.vf = self.creator.createVF(
+            self.randomGenerator("randomString"),
+            self.engagement,
+            self.deploymentTarget,
+            False,
+            vendor)
         self.token = self.loginAndCreateSessionToken(self.user)
 
     def testCreateActivity(self):
@@ -84,42 +107,57 @@ class ActivityTestCase(TestBaseEntity):
 
         logger.debug("Starting activity test: User joined")
         vendor = Vendor.objects.get(name='Other')
-        randomUser = self.creator.createUser(vendor, self.randomGenerator("email"), self.randomGenerator(
-            "randomNumber"), self.randomGenerator("randomString"), self.standard_user, True)
+        randomUser = self.creator.createUser(
+            vendor,
+            self.randomGenerator("email"),
+            self.randomGenerator("randomNumber"),
+            self.randomGenerator("randomString"),
+            self.standard_user,
+            True)
         self.engagement.engagement_team.add(randomUser)
         self.engagement.save()
 
         logger.debug(
-            "created a new user & added them to the engagement team, going to create the activity and consider it as a notification")
+            "created a new user & added them to the engagement team, \
+            going to create the activity and consider it as a notification")
         usersList = []
         usersList.append(randomUser)
-        activity_data = UserJoinedEngagementActivityData(self.vf, usersList, self.engagement)
+        activity_data = UserJoinedEngagementActivityData(
+            self.vf, usersList, self.engagement)
         bus_service.send_message(ActivityEventMessage(activity_data))
         logger.debug(
-            "activity & notification created successfully, please manually verify that an email was sent / MX server tried to send")
+            "activity & notification created successfully, \
+            please manually verify that an email was sent / MX server \
+            tried to send")
         logger.debug("Ended activity test: User joined ")
 
         logger.debug("Starting pullActivities test")
-        response = self.c.get(urlStr.replace('${uuid}', str(self.engagement.uuid)),
+        response = self.c.get(urlStr.replace('${uuid}',
+                                             str(self.engagement.uuid)),
                               **{'HTTP_AUTHORIZATION': "token " + self.token})
         content = response.content
         status = response.status_code
         logger.debug("Got response : " + str(status))
         logger.debug("Got content : " + str(content))
         if (status != 200):
-            logger.error("Got response : " + str(status) + " , wrong http response returned ")
+            logger.error("Got response : " + str(status) +
+                         " , wrong http response returned ")
             self.assertEqual(response.status_code, 200)
         logger.debug("Ended pullActivities test ")
 
         logger.debug("Starting activity test: delete user")
-        logger.debug("Verify that the 'User Joined' activity is deleted from the recent activities")
-        response = self.c.get(urlStr.replace('${uuid}', str(self.engagement.uuid)),
+        logger.debug(
+            "Verify that the 'User Joined' activity \
+            is deleted from the recent activities")
+        response = self.c.get(urlStr.replace('${uuid}',
+                                             str(self.engagement.uuid)),
                               **{'HTTP_AUTHORIZATION': "token " + self.token})
         content = response.content
         status = response.status_code
         logger.debug("Got response : " + str(status))
         logger.debug("Got content : " + str(content))
         if (status != 200):
-            logger.error("Got response : " + str(status) + " , wrong http response returned ")
+            logger.error("Got response : " + str(status) +
+                         " , wrong http response returned ")
             self.assertEqual(response.status_code, 200)
         logger.debug("Ended activity test: delete user ")
index c1af553..95b7713 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -37,7 +37,6 @@
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
 import json
-import random
 from engagementmanager.tests.test_base_entity import TestBaseEntity
 from engagementmanager.models import Vendor
 from engagementmanager.utils.constants import Constants
@@ -52,20 +51,29 @@ class TestAddContactTestCase(TestBaseEntity):
         self.createDefaultRoles()
 
         # Create a user with role el
-        self.el_user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator(
-            "main-vendor-email"), '55501000199', 'el user', self.el, True)
-
-        self.inviter = self.creator.createUser(Vendor.objects.get(
-            name='Other'), self.randomGenerator(
-            "main-vendor-email"), '55501000199', 'inviter user', self.standard_user, True)
+        self.el_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator(
+                "main-vendor-email"), '55501000199', 'el user', self.el, True)
+
+        self.inviter = self.creator.createUser(
+            Vendor.objects.get(
+                name='Other'),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'inviter user',
+            self.standard_user,
+            True)
 
         self.reviewer = self.creator.createUser(Vendor.objects.get(
             name='Other'), self.randomGenerator(
-            "main-vendor-email"), '55501000199', 'reviewer user', self.el, True)
+            "main-vendor-email"), '55501000199',
+            'reviewer user', self.el, True)
         self.peer_reviewer = self.creator.createUser(Vendor.objects.get(
             name='Other'), self.randomGenerator(
-            "main-vendor-email"), '55501000199', 'peer-reviewer user', self.el, True)
+            "main-vendor-email"), '55501000199', 'peer-reviewer user',
+            self.el, True)
         # Create an Engagement with team
         self.engagement = self.creator.createEngagement(
             '123456789', 'Validation', None)
@@ -80,40 +88,53 @@ class TestAddContactTestCase(TestBaseEntity):
 
         # Create a VF
         self.deploymentTarget = self.creator.createDeploymentTarget(
-            self.randomGenerator("randomString"), self.randomGenerator("randomString"))
-        self.vf = self.creator.createVF(self.randomGenerator("randomString"), self.engagement,
-                                        self.deploymentTarget, False, Vendor.objects.get(name='Other'))
+            self.randomGenerator("randomString"),
+            self.randomGenerator("randomString"))
+        self.vf = self.creator.createVF(
+            self.randomGenerator("randomString"),
+            self.engagement,
+            self.deploymentTarget,
+            False,
+            Vendor.objects.get(
+                name='Other'))
 
         self.urlStr = self.urlPrefix + "add-contact/"
         self.data = dict()
         self.token = self.loginAndCreateSessionToken(self.el_user)
 
     def initBody(self):
-        self.data['company'] = Vendor.objects.get(name=Constants.service_provider_company_name).name
+        self.data['company'] = Vendor.objects.get(
+            name=Constants.service_provider_company_name).name
         self.data['full_name'] = "full name"
         self.data['email'] = self.randomGenerator("main-vendor-email")
         self.data['phone_number'] = "12345"
 
     def addContact(self, expectedStatus=200):
         self.contactData = json.dumps(self.data, ensure_ascii=False)
-        response = self.c.post(self.urlStr, self.contactData, content_type='application/json',
-                               **{'HTTP_AUTHORIZATION': "token " + self.token})
+        response = self.c.post(
+            self.urlStr,
+            self.contactData,
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.token})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, expectedStatus)
         return response
 
     def createContactUser(self):
-        self.contact = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.data['email'],
-            self.data['phone_number'], self.data['full_name'], self.standard_user, True)
+        self.contact = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.data['email'],
+            self.data['phone_number'],
+            self.data['full_name'],
+            self.standard_user,
+            True)
         print('-----------------------------------------------------')
         print('Created User:')
         print('UUID: ' + str(self.contact.uuid))
         print('Full Name: ' + self.contact.full_name)
         print('-----------------------------------------------------')
 
-    ### TESTS ###
-
     def testAddContactForNonExistingContact(self):
         self.initBody()
         self.data['eng_uuid'] = str(self.engagement.uuid)
@@ -130,12 +151,14 @@ class TestAddContactTestCase(TestBaseEntity):
         self.initBody()
         self.data['eng_uuid'] = str(self.engagement.uuid)
         self.data['email'] = None
-        print("Negative test: removing mandatory field email --> Should fail on 400")
+        print("Negative test: removing mandatory field email --> " +
+              "Should fail on 400")
         self.addContact(400)
 
     def testNegativeAddContactForExistingContactAndFakeEngUUID(self):
         self.initBody()
         self.createContactUser()
         self.data['eng_uuid'] = "FakeUuid"
-        print("Negative test: Non existing engagement UUID --> Should fail on 500")
+        print("Negative test: Non existing engagement UUID --> " +
+              "Should fail on 500")
         self.addContact(401)
index 33382aa..c7f5923 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
 import json
-import random
 
 from rest_framework.status import HTTP_200_OK, HTTP_400_BAD_REQUEST
 from engagementmanager.tests.test_base_entity import TestBaseEntity
 from engagementmanager.models import Vendor
 from engagementmanager.utils.constants import Constants
-from engagementmanager.utils.request_data_mgr import request_data_mgr
 
 
 class TestAddContactTestCase(TestBaseEntity):
@@ -52,8 +50,14 @@ class TestAddContactTestCase(TestBaseEntity):
 
         self.createVendors([Constants.service_provider_company_name, 'Other'])
         self.createDefaultRoles()
-        self.reviewer = self.creator.createUser(Vendor.objects.get(
-            name='Other'), self.randomGenerator("main-vendor-email"), '55501000199', 'reviewer user', self.el, True)
+        self.reviewer = self.creator.createUser(
+            Vendor.objects.get(
+                name='Other'),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'reviewer user',
+            self.el,
+            True)
         self.peer_reviewer = self.creator.createUser(Vendor.objects.get(
             name='Other'), self.randomGenerator("main-vendor-email"),
             '55501000199', 'peer-reviewer user', self.el, True)
@@ -70,9 +74,15 @@ class TestAddContactTestCase(TestBaseEntity):
 
         # Create a VF
         self.deploymentTarget = self.creator.createDeploymentTarget(
-            self.randomGenerator("randomString"), self.randomGenerator("randomString"))
-        self.vf = self.creator.createVF(self.randomGenerator("randomString"), self.engagement,
-                                        self.deploymentTarget, False, Vendor.objects.get(name='Other'))
+            self.randomGenerator("randomString"),
+            self.randomGenerator("randomString"))
+        self.vf = self.creator.createVF(
+            self.randomGenerator("randomString"),
+            self.engagement,
+            self.deploymentTarget,
+            False,
+            Vendor.objects.get(
+                name='Other'))
 
         self.urlStr = self.urlPrefix + "add-feedback/"
         self.data = dict()
@@ -80,18 +90,20 @@ class TestAddContactTestCase(TestBaseEntity):
 
     def initBody(self):
         self.data['description'] = Vendor.objects.get(
-            name=Constants.service_provider_company_name).name + "ruslan gafiulin"
+            name=Constants.service_provider_company_name).name \
+            + "ruslan gafiulin"
 
     def addFeedback(self, expectedStatus=HTTP_200_OK):
         self.feedbackData = json.dumps(self.data, ensure_ascii=False)
-        response = self.c.post(self.urlStr, self.feedbackData, content_type='application/json',
-                               **{'HTTP_AUTHORIZATION': "token " + self.token})
+        response = self.c.post(self.urlStr,
+                               self.feedbackData,
+                               content_type='application/json',
+                               **{'HTTP_AUTHORIZATION': "token "
+                                  + self.token})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, expectedStatus)
         return response
 
-    ### TESTS ###
-
     def testAddFeedbackForNonExistingContact(self):
         self.initBody()
         self.data['description'] = str(self.engagement.uuid)
index e88cddd..21301af 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -50,13 +50,19 @@ class TestAddNextStepToChecklistTestCase(TestBaseEntity):
 
     def childSetup(self):
         self.createVendors([Constants.service_provider_company_name, 'Other'])
-        self.vendor = Vendor.objects.get(name=Constants.service_provider_company_name)
+        self.vendor = Vendor.objects.get(
+            name=Constants.service_provider_company_name)
         self.createDefaultRoles()
 
         # Create a user with role el
-        self.el_user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'el user', self.el, True)
+        self.el_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'el user',
+            self.el,
+            True)
         print('-----------------------------------------------------')
         print('Created User:')
         print('UUID: ' + str(self.el_user.uuid))
@@ -64,17 +70,28 @@ class TestAddNextStepToChecklistTestCase(TestBaseEntity):
         print('-----------------------------------------------------')
 
         # Create a user with role el
-        self.peer_reviewer_user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'peer-reviewer user', self.el, True)
+        self.peer_reviewer_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'peer-reviewer user',
+            self.el,
+            True)
         print('-----------------------------------------------------')
         print('Created User:')
         print('UUID: ' + str(self.el_user.uuid))
         print('Full Name: ' + self.el_user.full_name)
         print('-----------------------------------------------------')
 
-        self.user2 = self.creator.createUser(Vendor.objects.get(
-            name='Other'), self.randomGenerator("main-vendor-email"), '55501000199', 'user', self.standard_user, True)
+        self.user2 = self.creator.createUser(
+            Vendor.objects.get(
+                name='Other'),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'user',
+            self.standard_user,
+            True)
         print('-----------------------------------------------------')
         print('Created User:')
         print('UUID: ' + str(self.user2.uuid))
@@ -82,7 +99,8 @@ class TestAddNextStepToChecklistTestCase(TestBaseEntity):
         print('-----------------------------------------------------')
 
         # Create an Engagement with team
-        self.engagement = self.creator.createEngagement('123456789', 'Validation', None)
+        self.engagement = self.creator.createEngagement(
+            '123456789', 'Validation', None)
         self.engagement.reviewer = self.el_user
         self.engagement.engagement_team.add(self.el_user)
         self.engagement.peer_reviewer = self.peer_reviewer_user
@@ -93,9 +111,14 @@ class TestAddNextStepToChecklistTestCase(TestBaseEntity):
         print('-----------------------------------------------------')
 
         self.deploymentTarget = self.creator.createDeploymentTarget(
-            self.randomGenerator("randomString"), self.randomGenerator("randomString"))
-        self.vf = self.creator.createVF(self.randomGenerator("randomString"),
-                                        self.engagement, self.deploymentTarget, False, self.vendor)
+            self.randomGenerator("randomString"),
+            self.randomGenerator("randomString"))
+        self.vf = self.creator.createVF(
+            self.randomGenerator("randomString"),
+            self.engagement,
+            self.deploymentTarget,
+            False,
+            self.vendor)
         print('-----------------------------------------------------')
         print('Created VF:')
         print('UUID: ' + str(self.vf.uuid))
@@ -111,10 +134,15 @@ class TestAddNextStepToChecklistTestCase(TestBaseEntity):
         self.token = self.loginAndCreateSessionToken(self.el_user)
         datajson = json.dumps(self.data, ensure_ascii=False)
         self.clUrlStr = self.urlPrefix + "engagement/@eng_uuid/checklist/new/"
-        self.checklist = self.c.post(self.clUrlStr.replace("@eng_uuid", str(self.engagement.uuid)),
-                                     datajson, content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.token})
-
-        self.urlStr = self.urlPrefix + "engagement/@eng_uuid/checklist/@checklist_uuid/nextstep/"
+        self.checklist = self.c.post(
+            self.clUrlStr.replace(
+                "@eng_uuid", str(
+                    self.engagement.uuid)), datajson,
+            content_type='application/json', **{
+                'HTTP_AUTHORIZATION': "token " + self.token})
+
+        self.urlStr = self.urlPrefix + \
+            "engagement/@eng_uuid/checklist/@checklist_uuid/nextstep/"
         self.nextStepList = []
 
     def initBody(self):
@@ -137,9 +165,14 @@ class TestAddNextStepToChecklistTestCase(TestBaseEntity):
     def testAddNextStepForCheckListPositive(self):
         self.initBody()
         self.nextStepList = json.dumps(self.nextStepList, ensure_ascii=False)
-        self.urlStr = self.urlStr.replace("@checklist_uuid", json.loads(self.checklist.content)[
-                                          'uuid']).replace("@eng_uuid", str(self.engagement.uuid))
-        response = self.c.post(self.urlStr, self.nextStepList, content_type='application/json',
+        self.urlStr = self.urlStr.replace(
+            "@checklist_uuid", json.loads(
+                self.checklist.content)['uuid']).replace(
+            "@eng_uuid", str(
+                self.engagement.uuid))
+        response = self.c.post(self.urlStr,
+                               self.nextStepList,
+                               content_type='application/json',
                                **{'HTTP_AUTHORIZATION': "token " + self.token})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
@@ -150,8 +183,11 @@ class TestAddNextStepToChecklistTestCase(TestBaseEntity):
         self.nextStepList = json.dumps(self.nextStepList, ensure_ascii=False)
         self.urlStr = self.urlStr.replace("@checklist_uuid", json.loads(
             self.checklist.content)['uuid']).replace("@eng_uuid", str(uuid4()))
-        response = self.c.post(self.urlStr, self.nextStepList, content_type='application/json',
+        response = self.c.post(self.urlStr,
+                               self.nextStepList,
+                               content_type='application/json',
                                **{'HTTP_AUTHORIZATION': "token " + self.token})
-        print('------------------------------> Got response : ' + str(response.status_code))
+        print('------------------------------> Got response : ' +
+              str(response.status_code))
         self.assertEqual(response.status_code, HTTP_401_UNAUTHORIZED)
         return response
index 42395ae..7614a84 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -41,9 +41,11 @@ from uuid import uuid4
 from rest_framework.status import HTTP_200_OK, HTTP_400_BAD_REQUEST,\
     HTTP_401_UNAUTHORIZED, HTTP_500_INTERNAL_SERVER_ERROR,\
     HTTP_405_METHOD_NOT_ALLOWED
-from engagementmanager.models import Vendor, Checklist, ChecklistAuditLog, ChecklistDecision, ChecklistLineItem, ChecklistSection
+from engagementmanager.models import Vendor, Checklist, ChecklistAuditLog, \
+    ChecklistDecision, ChecklistLineItem, ChecklistSection
 from engagementmanager.tests.test_base_entity import TestBaseEntity
-from engagementmanager.utils.constants import CheckListLineType, CheckListDecisionValue, CheckListState, Constants
+from engagementmanager.utils.constants import CheckListLineType, \
+    CheckListDecisionValue, CheckListState, Constants
 from engagementmanager.service.logging_service import LoggingServiceFactory
 
 logger = LoggingServiceFactory.get_logger()
@@ -53,19 +55,31 @@ class AuditLogAndDecisionAPITest(TestBaseEntity):
 
     def childSetup(self):
 
-        self.createVendors([Constants.service_provider_company_name, 'Amdocs', 'Other'])
+        self.createVendors(
+            [Constants.service_provider_company_name, 'Amdocs', 'Other'])
         self.createDefaultRoles()
 
         # Create a user with role el
-        self.el_user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"), '12323245435', 'el user', self.el, True)
+        self.el_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '12323245435',
+            'el user',
+            self.el,
+            True)
         self.peer_reviewer = self.creator.createUser(Vendor.objects.get(
             name='Other'), self.randomGenerator("main-vendor-email"),
             '55501000199', 'peer-reviewer user', self.el, True)
         # For negative tests
         self.user = self.creator.createUser(
-            Vendor.objects.get(name=Constants.service_provider_company_name),
-            self.randomGenerator("main-vendor-email"), '12323245435', 'user', self.standard_user, True)
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '12323245435',
+            'user',
+            self.standard_user,
+            True)
 
         self.template = self.creator.createDefaultCheckListTemplate()
         self.engagement = self.creator.createEngagement(
@@ -77,14 +91,36 @@ class AuditLogAndDecisionAPITest(TestBaseEntity):
         self.clbodydata = dict()
         self.initCLBody()
         self.auditdata = dict()
-        self.checklist = Checklist.objects.create(uuid=uuid4(), name=self.clbodydata['checkListName'], validation_cycle=1, associated_files=self.clbodydata[
-                                                  'checkListAssociatedFiles'], engagement=self.engagement, template=self.template, creator=self.el_user, owner=self.el_user)
-        self.section = ChecklistSection.objects.create(uuid=uuid4(), name=self.randomGenerator("randomString"), weight=1.0, description=self.randomGenerator(
-            "randomString"), validation_instructions=self.randomGenerator("randomString"), template=self.template)
-        self.line_item = ChecklistLineItem.objects.create(uuid=uuid4(), name=self.randomGenerator("randomString"), weight=1.0, description=self.randomGenerator(
-            "randomString"), line_type=CheckListLineType.auto.name, validation_instructions=self.randomGenerator("randomString"), template=self.template, section=self.section)  # @UndefinedVariable
+        self.checklist = Checklist.objects.create(
+            uuid=uuid4(),
+            name=self.clbodydata['checkListName'],
+            validation_cycle=1,
+            associated_files=self.clbodydata['checkListAssociatedFiles'],
+            engagement=self.engagement,
+            template=self.template,
+            creator=self.el_user,
+            owner=self.el_user)
+        self.section = ChecklistSection.objects.create(
+            uuid=uuid4(),
+            name=self.randomGenerator("randomString"),
+            weight=1.0,
+            description=self.randomGenerator("randomString"),
+            validation_instructions=self.randomGenerator("randomString"),
+            template=self.template)
+        self.line_item = ChecklistLineItem.objects.create(
+            uuid=uuid4(),
+            name=self.randomGenerator("randomString"),
+            weight=1.0,
+            description=self.randomGenerator("randomString"),
+            line_type=CheckListLineType.auto.name,
+            validation_instructions=self.randomGenerator("randomString"),
+            template=self.template,
+            section=self.section)  # @UndefinedVariable
         self.decision = ChecklistDecision.objects.create(
-            uuid=uuid4(), checklist=self.checklist, template=self.template, lineitem=self.line_item)
+            uuid=uuid4(),
+            checklist=self.checklist,
+            template=self.template,
+            lineitem=self.line_item)
         self.section.save()
         self.line_item.save()
         self.decision.save()
@@ -96,10 +132,13 @@ class AuditLogAndDecisionAPITest(TestBaseEntity):
         self.clbodydata['checkListName'] = "ice-checklist-for-test"
         self.clbodydata['checkListTemplateUuid'] = str(self.template.uuid)
         self.clbodydata[
-            'checkListAssociatedFiles'] = "[\"file0/f69f4ce7-51d5-409c-9d0e-ec6b1e79df28\", \"file1/f69f4ce7-51d5-409c-9d0e-ec6b1e79df28\", \"file2/f69f4ce7-51d5-409c-9d0e-ec6b1e79df28\"]"
+            'checkListAssociatedFiles'] = "\
+            [\"file0/f69f4ce7-51d5-409c-9d0e-ec6b1e79df28\",\
+             \"file1/f69f4ce7-51d5-409c-9d0e-ec6b1e79df28\",\
+              \"file2/f69f4ce7-51d5-409c-9d0e-ec6b1e79df28\"]"
 
-    def loggerTestFailedOrSucceded(self, bool):
-        if bool:
+    def loggerTestFailedOrSucceded(self, bool_flag):
+        if bool_flag:
             logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
             logger.debug(" Test Succeeded")
             logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n")
@@ -119,8 +158,12 @@ class AuditLogAndDecisionAPITest(TestBaseEntity):
         self.auditdata['description'] = "description text"
         datajson = json.dumps(self.auditdata, ensure_ascii=False)
 
-        response = self.c.post(self.urlStr.replace("@cl_uuid", str(self.checklist.uuid)), datajson,
-                               content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        response = self.c.post(self.urlStr.replace("@cl_uuid",
+                                                   str(self.checklist.uuid)),
+                               datajson,
+                               content_type='application/json',
+                               **{'HTTP_AUTHORIZATION': "token "
+                                  + self.ELtoken})
         logger.debug('Got response : ' + str(response.status_code) +
                      " Expecting " + str(HTTP_200_OK))
 
@@ -140,7 +183,8 @@ class AuditLogAndDecisionAPITest(TestBaseEntity):
     def testCreateAuditLogViaChecklistNegativeEmptyDescription(self):
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
         logger.debug(
-            " Negative Test started: Create AuditLog Via Checklist with empty description")
+            " Negative Test started: Create AuditLog Via \
+            Checklist with empty description")
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n")
 
         self.urlStr = self.urlPrefix + "checklist/@cl_uuid/auditlog/"
@@ -150,8 +194,12 @@ class AuditLogAndDecisionAPITest(TestBaseEntity):
         self.auditdata['description'] = ""
         datajson = json.dumps(self.auditdata, ensure_ascii=False)
 
-        response = self.c.post(self.urlStr.replace("@cl_uuid", str(self.checklist.uuid)), datajson,
-                               content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        response = self.c.post(self.urlStr.replace("@cl_uuid",
+                                                   str(self.checklist.uuid)),
+                               datajson,
+                               content_type='application/json',
+                               **{'HTTP_AUTHORIZATION': "token "
+                                  + self.ELtoken})
         logger.debug('Got response : ' + str(response.status_code) +
                      " Expecting " + str(HTTP_400_BAD_REQUEST))
 
@@ -165,7 +213,8 @@ class AuditLogAndDecisionAPITest(TestBaseEntity):
     def testCreateAuditLogViaChecklistNegativeBadCLUuid(self):
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
         logger.debug(
-            " Negative Test started: Create AuditLog Via Checklist with bad CL uuid")
+            " Negative Test started: Create AuditLog Via \
+            Checklist with bad CL uuid")
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n")
 
         self.urlStr = self.urlPrefix + "checklist/@cl_uuid/auditlog/"
@@ -175,8 +224,11 @@ class AuditLogAndDecisionAPITest(TestBaseEntity):
         self.auditdata['description'] = "description text"
         datajson = json.dumps(self.auditdata, ensure_ascii=False)
 
-        response = self.c.post(self.urlStr.replace("@cl_uuid", str(uuid4())),
-                               datajson, content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.token})
+        response = self.c.post(self.urlStr.replace("@cl_uuid",
+                                                   str(uuid4())),
+                               datajson,
+                               content_type='application/json',
+                               **{'HTTP_AUTHORIZATION': "token " + self.token})
         logger.debug('Got response : ' + str(response.status_code) +
                      " Expecting " + str(HTTP_500_INTERNAL_SERVER_ERROR))
 
@@ -192,15 +244,20 @@ class AuditLogAndDecisionAPITest(TestBaseEntity):
         logger.debug(" Test started: Create AuditLog Via Decision")
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n")
 
-        self.urlStr = self.urlPrefix + "checklist/decision/@decision_uuid/auditlog/"
+        self.urlStr = self.urlPrefix + \
+            "checklist/decision/@decision_uuid/auditlog/"
 
         logger.debug("Creating a checklist")
 
         self.auditdata['description'] = "description text"
         datajson = json.dumps(self.auditdata, ensure_ascii=False)
 
-        response = self.c.post(self.urlStr.replace("@decision_uuid", str(self.decision.uuid)), datajson,
-                               content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        response = self.c.post(self.urlStr.replace("@decision_uuid",
+                                                   str(self.decision.uuid)),
+                               datajson,
+                               content_type='application/json',
+                               **{'HTTP_AUTHORIZATION': "token "
+                                  + self.ELtoken})
         logger.debug('Got response : ' + str(response.status_code) +
                      " Expecting " + str(HTTP_200_OK))
 
@@ -214,18 +271,24 @@ class AuditLogAndDecisionAPITest(TestBaseEntity):
     def testCreateAuditLogViaDecisionNegativeEmptyDescription(self):
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
         logger.debug(
-            " Negative Test started: Create AuditLog Via Decision with empty description")
+            " Negative Test started: Create AuditLog Via \
+            Decision with empty description")
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n")
 
-        self.urlStr = self.urlPrefix + "checklist/decision/@decision_uuid/auditlog/"
+        self.urlStr = self.urlPrefix + \
+            "checklist/decision/@decision_uuid/auditlog/"
 
         logger.debug("Creating a checklist")
 
         self.auditdata['description'] = ""
         datajson = json.dumps(self.auditdata, ensure_ascii=False)
 
-        response = self.c.post(self.urlStr.replace("@decision_uuid", str(self.decision.uuid)), datajson,
-                               content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        response = self.c.post(self.urlStr.replace("@decision_uuid",
+                                                   str(self.decision.uuid)),
+                               datajson,
+                               content_type='application/json',
+                               **{'HTTP_AUTHORIZATION': "token "
+                                  + self.ELtoken})
         logger.debug('Got response : ' + str(response.status_code) +
                      " Expecting " + str(HTTP_400_BAD_REQUEST))
 
@@ -239,18 +302,24 @@ class AuditLogAndDecisionAPITest(TestBaseEntity):
     def testCreateAuditLogViaDecisionNegativeBadCLUuid(self):
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
         logger.debug(
-            " Negative Test started: Create AuditLog Via Decision with bad Decision uuid")
+            " Negative Test started: Create AuditLog Via \
+            Decision with bad Decision uuid")
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n")
 
-        self.urlStr = self.urlPrefix + "checklist/decision/@decision_uuid/auditlog/"
+        self.urlStr = self.urlPrefix + \
+            "checklist/decision/@decision_uuid/auditlog/"
 
         logger.debug("Creating a checklist")
 
         self.auditdata['description'] = "description text"
         datajson = json.dumps(self.auditdata, ensure_ascii=False)
 
-        response = self.c.post(self.urlStr.replace("@decision_uuid", str(uuid4())), datajson,
-                               content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        response = self.c.post(self.urlStr.replace("@decision_uuid",
+                                                   str(uuid4())),
+                               datajson,
+                               content_type='application/json',
+                               **{'HTTP_AUTHORIZATION': "token "
+                                  + self.ELtoken})
         logger.debug('Got response : ' + str(response.status_code) +
                      " Expecting " + str(HTTP_400_BAD_REQUEST))
 
@@ -270,20 +339,25 @@ class AuditLogAndDecisionAPITest(TestBaseEntity):
 
         logger.debug("Creating a checklist")
 
-        self.checklist.state = CheckListState.review.name  # @UndefinedVariable
+        self.checklist.state = CheckListState.review.name
         self.checklist.owner = self.el_user
         self.checklist.save()
         # @UndefinedVariable
         self.auditdata['value'] = CheckListDecisionValue.approved.name
         datajson = json.dumps(self.auditdata, ensure_ascii=False)
 
-        response = self.c.put(self.urlStr.replace("@decision_uuid", str(self.decision.uuid)), datajson,
-                              content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        response = self.c.put(
+            self.urlStr.replace("@decision_uuid",
+                                str(self.decision.uuid)),
+            datajson,
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
         logger.debug('Got response : ' + str(response.status_code) +
                      " Expecting " + str(HTTP_200_OK))
 
         check = ChecklistDecision.objects.get(checklist=self.checklist)
-        if (response.status_code == HTTP_200_OK and check.review_value == 'approved'):
+        if (response.status_code == HTTP_200_OK and
+                check.review_value == 'approved'):
             self.loggerTestFailedOrSucceded(True)
             self.assertEqual(response.status_code, HTTP_200_OK)
         else:
@@ -299,15 +373,19 @@ class AuditLogAndDecisionAPITest(TestBaseEntity):
 
         logger.debug("Creating a checklist")
 
-        self.checklist.state = CheckListState.review.name  # @UndefinedVariable
+        self.checklist.state = CheckListState.review.name
         self.checklist.owner = self.user
         self.checklist.save()
         # @UndefinedVariable
         self.auditdata['value'] = CheckListDecisionValue.approved.name
         datajson = json.dumps(self.auditdata, ensure_ascii=False)
 
-        response = self.c.put(self.urlStr.replace("@decision_uuid", str(self.decision.uuid)), datajson,
-                              content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        response = self.c.put(
+            self.urlStr.replace("@decision_uuid",
+                                str(self.decision.uuid)),
+            datajson,
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
         logger.debug('Got response : ' + str(response.status_code) +
                      " Expecting " + str(HTTP_401_UNAUTHORIZED))
 
@@ -327,14 +405,18 @@ class AuditLogAndDecisionAPITest(TestBaseEntity):
 
         logger.debug("Creating a checklist")
 
-        self.checklist.state = CheckListState.review.name  # @UndefinedVariable
+        self.checklist.state = CheckListState.review.name
         self.checklist.owner = self.el_user
         self.checklist.save()
         self.auditdata['value'] = self.randomGenerator("randomString")
         datajson = json.dumps(self.auditdata, ensure_ascii=False)
 
-        response = self.c.put(self.urlStr.replace("@decision_uuid", str(self.decision.uuid)), datajson,
-                              content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        response = self.c.put(
+            self.urlStr.replace("@decision_uuid",
+                                str(self.decision.uuid)),
+            datajson,
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
         logger.debug('Got response : ' + str(response.status_code) +
                      " Expecting " + str(HTTP_400_BAD_REQUEST))
 
@@ -362,8 +444,12 @@ class AuditLogAndDecisionAPITest(TestBaseEntity):
         self.auditdata['value'] = CheckListDecisionValue.approved.name
         datajson = json.dumps(self.auditdata, ensure_ascii=False)
 
-        response = self.c.put(self.urlStr.replace("@decision_uuid", str(self.decision.uuid)), datajson,
-                              content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        response = self.c.put(
+            self.urlStr.replace("@decision_uuid",
+                                str(self.decision.uuid)),
+            datajson,
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
         logger.debug('Got response : ' + str(response.status_code) +
                      " Expecting " + str(HTTP_400_BAD_REQUEST))
 
@@ -372,4 +458,5 @@ class AuditLogAndDecisionAPITest(TestBaseEntity):
             self.assertEqual(response.status_code, HTTP_400_BAD_REQUEST)
         else:
             self.loggerTestFailedOrSucceded(False)
-            self.assertEqual(response.status_code, HTTP_405_METHOD_NOT_ALLOWED)
+            self.assertEqual(response.status_code,
+                             HTTP_405_METHOD_NOT_ALLOWED)
index b61de8d..f5c9544 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -37,7 +37,8 @@
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
 from engagementmanager.models import Vendor
-from engagementmanager.service.authorization_service import AuthorizationService, Permissions
+from engagementmanager.service.authorization_service import \
+    AuthorizationService, Permissions
 from engagementmanager.tests.test_base_entity import TestBaseEntity
 from engagementmanager.utils.constants import Constants
 from engagementmanager.utils.request_data_mgr import request_data_mgr
@@ -50,9 +51,14 @@ class TestAuthService(TestBaseEntity):
 
         self.createDefaultRoles()
 
-        self.admin_user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), Constants.service_provider_admin_mail,
-            '55501000199', 'admin user', self.admin, True)
+        self.admin_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            Constants.service_provider_admin_mail,
+            '55501000199',
+            'admin user',
+            self.admin,
+            True)
         print('-----------------------------------------------------')
         print('Created User:')
         print('UUID: ' + str(self.admin_user.uuid))
@@ -60,18 +66,28 @@ class TestAuthService(TestBaseEntity):
         print('-----------------------------------------------------')
 
         # Create a user with role el
-        self.el_user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'el user', self.el, True)
+        self.el_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'el user',
+            self.el,
+            True)
         print('-----------------------------------------------------')
         print('Created User:')
         print('UUID: ' + str(self.el_user.uuid))
         print('Full Name: ' + self.el_user.full_name)
         print('-----------------------------------------------------')
 
-        self.peer_reviewer = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'peer-reviewer user', self.el, True)
+        self.peer_reviewer = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'peer-reviewer user',
+            self.el,
+            True)
         print('-----------------------------------------------------')
         print('Created User:')
         print('UUID: ' + str(self.peer_reviewer.uuid))
@@ -79,9 +95,14 @@ class TestAuthService(TestBaseEntity):
         print('-----------------------------------------------------')
 
         # Create another EL
-        self.another_el_user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'el user2', self.el, True)
+        self.another_el_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'el user2',
+            self.el,
+            True)
         print('-----------------------------------------------------')
         print('Created User:')
         print('UUID: ' + str(self.another_el_user.uuid))
@@ -99,9 +120,15 @@ class TestAuthService(TestBaseEntity):
         print('-----------------------------------------------------')
 
         # Create a user with role standard_user with SSH key
-        self.user_with_ssh = self.creator.createUser(Vendor.objects.get(
-            name='Other'), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'ssh user', self.standard_user, True, 'just-a-fake-ssh-key')
+        self.user_with_ssh = self.creator.createUser(
+            Vendor.objects.get(
+                name='Other'),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'ssh user',
+            self.standard_user,
+            True,
+            'just-a-fake-ssh-key')
         print('-----------------------------------------------------')
         print('Created User:')
         print('UUID: ' + str(self.user_with_ssh.uuid))
@@ -109,7 +136,8 @@ class TestAuthService(TestBaseEntity):
         print('-----------------------------------------------------')
 
         # Create an Engagement with team
-        self.engagement = self.creator.createEngagement('just-a-fake-uuid', 'Validation', None)
+        self.engagement = self.creator.createEngagement(
+            'just-a-fake-uuid', 'Validation', None)
         self.engagement.engagement_team.add(self.user, self.el_user)
         self.engagement.reviewer = self.el_user
         self.engagement.peer_reviewer = self.peer_reviewer
@@ -120,16 +148,20 @@ class TestAuthService(TestBaseEntity):
         print('-----------------------------------------------------')
 
         # Create another Engagement with team with SSH Key
-        self.engagement_ssh = self.creator.createEngagement('just-another-fake-uuid', 'Validation', None)
-        self.engagement_ssh.engagement_team.add(self.user_with_ssh, self.el_user)
+        self.engagement_ssh = self.creator.createEngagement(
+            'just-another-fake-uuid', 'Validation', None)
+        self.engagement_ssh.engagement_team.add(
+            self.user_with_ssh, self.el_user)
         print('-----------------------------------------------------')
         print('Created Engagement:')
         print('UUID: ' + str(self.engagement_ssh.uuid))
         print('-----------------------------------------------------')
 
         # Create another Engagement with Main Contact
-        self.engagement_with_contact = self.creator.createEngagement('yet-just-another-fake-uuid', 'Validation', None)
-        self.engagement_with_contact.engagement_team.add(self.user_with_ssh, self.el_user)
+        self.engagement_with_contact = self.creator.createEngagement(
+            'yet-just-another-fake-uuid', 'Validation', None)
+        self.engagement_with_contact.engagement_team.add(
+            self.user_with_ssh, self.el_user)
         self.engagement_with_contact.contact_user = self.user_with_ssh
         print('-----------------------------------------------------')
         print('Created Engagement:')
@@ -137,8 +169,10 @@ class TestAuthService(TestBaseEntity):
         print('-----------------------------------------------------')
 
         # Create another Engagement with Main Contact
-        self.engagement_4_createNS = self.creator.createEngagement('yet-just-another-fake-uuid2', 'Validation', None)
-        self.engagement_4_createNS.engagement_team.add(self.user_with_ssh, self.el_user)
+        self.engagement_4_createNS = self.creator.createEngagement(
+            'yet-just-another-fake-uuid2', 'Validation', None)
+        self.engagement_4_createNS.engagement_team.add(
+            self.user_with_ssh, self.el_user)
         self.engagement_4_createNS.contact_user = self.user_with_ssh
         print('-----------------------------------------------------')
         print('Created Engagement:')
@@ -154,8 +188,15 @@ class TestAuthService(TestBaseEntity):
         print('UUID: ' + str(self.checklist_template.uuid))
         print('-----------------------------------------------------')
 
-        self.checklist = self.creator.createCheckList('some-checklist', 'Automation', 1, '{}', self.engagement,
-                                                      self.checklist_template, self.el_user, self.peer_reviewer)
+        self.checklist = self.creator.createCheckList(
+            'some-checklist',
+            'Automation',
+            1,
+            '{}',
+            self.engagement,
+            self.checklist_template,
+            self.el_user,
+            self.peer_reviewer)
         print('-----------------------------------------------------')
         print('Created Check List')
         print('UUID: ' + str(self.checklist.uuid))
@@ -168,77 +209,90 @@ class TestAuthService(TestBaseEntity):
         # TEST EL PERMISSIONS
         ######################
         # Test Add VF for EL
-        auth_result, message = auth.is_user_able_to(self.el_user, Permissions.add_vf, str(self.engagement.uuid), '')
+        auth_result, message = auth.is_user_able_to(
+            self.el_user, Permissions.add_vf, str(self.engagement.uuid), '')
         print('ADD_VF Got Result : ' + str(auth_result) + ' ' + message)
         self.assertEquals(auth_result, True)
 
-        auth_result, message = auth.is_user_able_to(self.el_user, Permissions.add_vendor, '', '')
+        auth_result, message = auth.is_user_able_to(
+            self.el_user, Permissions.add_vendor, '', '')
         print('ADD_VENDOR Got Result : ' + message)
         self.assertEquals(auth_result, True)
 
         # Check that EL that belong to ENG can create next step
         auth_result, message = auth.is_user_able_to(
-            self.el_user, Permissions.add_nextstep, str(self.engagement.uuid), '')
+            self.el_user, Permissions.add_nextstep, str(
+                self.engagement.uuid), '')
         print('ADD_NEXTSTEP Got Result : ' + message)
         self.assertEquals(auth_result, True)
 
         # Check that EL that does not belong to ENG cannot create next step
         auth_result, message = auth.is_user_able_to(
-            self.another_el_user, Permissions.add_nextstep, str(self.engagement.uuid), '')
+            self.another_el_user, Permissions.add_nextstep, str(
+                self.engagement.uuid), '')
         print('ADD_NEXTSTEP Got Result : ' + message)
         self.assertEquals(auth_result, False)
 
         # Check that CL can be created only by EL that belongs to ENG
         auth_result, message = auth.is_user_able_to(
-            self.el_user, Permissions.add_checklist, str(self.engagement.uuid), '')
+            self.el_user, Permissions.add_checklist, str(
+                self.engagement.uuid), '')
         print('ADD_CHECKLIST Got Result : ' + message)
         self.assertEquals(auth_result, True)
 
-        # Check that CL can be created only by EL that belongs to ENG (use another el)
+        # Check that CL can be created only by EL that belongs to ENG (use
+        # another el)
         auth_result, message = auth.is_user_able_to(
-            self.another_el_user, Permissions.add_checklist, str(self.engagement.uuid), '')
+            self.another_el_user, Permissions.add_checklist, str(
+                self.engagement.uuid), '')
         print('ADD_CHECKLIST Got Result : ' + message)
         self.assertEquals(auth_result, False)
 
-        auth_result, message = auth.is_user_able_to(self.user, Permissions.add_checklist, str(self.engagement.uuid), '')
+        auth_result, message = auth.is_user_able_to(
+            self.user, Permissions.add_checklist, str(
+                self.engagement.uuid), '')
         print('ADD_CHECKLIST Got Result : ' + message)
         self.assertEquals(auth_result, False)
 
         # Check that only peer reviewer can do peer review
         request_data_mgr.set_cl_uuid(str(self.checklist.uuid))
         auth_result, message = auth.is_user_able_to(
-            self.peer_reviewer, Permissions.peer_review_checklist, str(self.engagement.uuid), str(self.checklist.uuid))
+            self.peer_reviewer, Permissions.peer_review_checklist, str(
+                self.engagement.uuid), str(
+                self.checklist.uuid))
         print('PEER_REVIEW_CHECKLIST Got Result : ' + message)
         self.assertEquals(auth_result, True)
 
         # Check that a user that is not defined as peer review cannot review
         auth_result, message = auth.is_user_able_to(
-            self.el_user, Permissions.peer_review_checklist, str(self.engagement.uuid), str(self.checklist.uuid))
+            self.el_user, Permissions.peer_review_checklist, str(
+                self.engagement.uuid), str(
+                self.checklist.uuid))
         print('PEER_REVIEW_CHECKLIST Got Result : ' + message)
         self.assertEquals(auth_result, False)
 
-        # Check that admin which is not owner cannot approve CL
-        # Test is greyed out due to the fact that admin can approve any CL
-#         auth_result, message = auth.is_user_able_to(self.admin_user, Permissions.admin_approve_checklist, str(self.engagement.uuid), str(self.checklist.uuid))
-#         print('ADMIN_APPROVE_CHECKLIST Got Result : ' + message)
-#         self.assertEquals(auth_result, False)
-
         # Check that only admin which is the cl owner can approve CL
         self.checklist.owner = self.admin_user  # Make admin the owner
         self.checklist.save()
         auth_result, message = auth.is_user_able_to(
-            self.admin_user, Permissions.admin_approve_checklist, str(self.engagement.uuid), str(self.checklist.uuid))
+            self.admin_user, Permissions.admin_approve_checklist, str(
+                self.engagement.uuid), str(
+                self.checklist.uuid))
         print('ADMIN_APPROVE_CHECKLIST Got Result : ' + message)
         self.assertEquals(auth_result, True)
 
         # Check that only admin can approve CL (attempt with regular EL)
         auth_result, message = auth.is_user_able_to(
-            self.el_user, Permissions.admin_approve_checklist, str(self.engagement.uuid), str(self.checklist.uuid))
+            self.el_user, Permissions.admin_approve_checklist, str(
+                self.engagement.uuid), str(
+                self.checklist.uuid))
         print('ADMIN_APPROVE_CHECKLIST Got Result : ' + message)
         self.assertEquals(auth_result, False)
 
         # Check that only admin can approve CL (attempt with regular user)
         auth_result, message = auth.is_user_able_to(
-            self.user, Permissions.admin_approve_checklist, str(self.engagement.uuid), str(self.checklist.uuid))
+            self.user, Permissions.admin_approve_checklist, str(
+                self.engagement.uuid), str(
+                self.checklist.uuid))
         print('ADMIN_APPROVE_CHECKLIST Got Result : ' + message)
         self.assertEquals(auth_result, False)
index b6a5ece..712214a 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -41,6 +41,8 @@ import http.client
 import inspect
 import re
 import django
+from engagementmanager.tests.vvpEntitiesCreator import VvpEntitiesCreator
+from engagementmanager.service.logging_service import LoggingServiceFactory
 from django.conf import settings
 from django.test import TestCase
 from django.test.client import Client
@@ -48,8 +50,6 @@ import psycopg2
 from rest_framework.parsers import JSONParser
 from wheel.signatures import assertTrue
 django.setup()
-from engagementmanager.tests.vvpEntitiesCreator import VvpEntitiesCreator
-from engagementmanager.service.logging_service import LoggingServiceFactory
 
 logger = LoggingServiceFactory.get_logger()
 
@@ -58,9 +58,11 @@ class TestBaseEntity(TestCase):
     __metaclass__ = ABCMeta
 
     def setUp(self):
-        logger.debug("---------------------- TestCase " + self.__class__.__name__ + " ----------------------")
+        logger.debug("---------------------- TestCase " +
+                     self.__class__.__name__ + " ----------------------")
         self.urlPrefix = "/%s/v1/engmgr/" % settings.PROGRAM_NAME_URL_PREFIX
-        self.conn = http.client.HTTPConnection("127.0.0.1", 8000)  # @UndefinedVariable
+        self.conn = http.client.HTTPConnection(
+            "127.0.0.1", 8000)  # @UndefinedVariable
         self.c = Client()
         self.creator = VvpEntitiesCreator()
         settings.IS_SIGNAL_ENABLED = False
@@ -69,7 +71,8 @@ class TestBaseEntity(TestCase):
     def tearDown(self):
         settings.IS_SIGNAL_ENABLED = True
         self.conn.close()
-        logger.debug("----------------------  TestCase " + self.__class__.__name__ + " ---------------------- ")
+        logger.debug("----------------------  TestCase " +
+                     self.__class__.__name__ + " ---------------------- ")
         logger.debug("")
         logger.debug("")
 
@@ -80,7 +83,8 @@ class TestBaseEntity(TestCase):
 
     def createDefaultRoles(self):
         # Create Default Roles if does not exist
-        self.admin, self.el, self.standard_user = self.creator.createAndGetDefaultRoles()
+        self.admin, self.el, self.standard_user = \
+            self.creator.createAndGetDefaultRoles()
 
     def printTestName(self, testNameTrigger):
         if testNameTrigger == "START":
@@ -93,22 +97,24 @@ class TestBaseEntity(TestCase):
         pass
 
     def nativeConnect2Db(self):
-        return psycopg2.connect("dbname='icedb' user='iceuser' host='localhost' password='Aa123456' port='5433'")
+        return psycopg2.connect(
+            "dbname='icedb' user='iceuser' host='localhost' \
+            password='Aa123456' port='5433'")
 
     def deleteRecord(self, urlStr, getRecord, isNegativeTest):
         logger.debug("DELETE: " + urlStr + "/" + getRecord)
         self.conn.request("DELETE", urlStr + "/" + getRecord)
         r1 = self.conn.getresponse()
         logger.debug("DELETE response status code: " + str(r1.status))
-#         logger.debug("Number of records in the table: " + self.getNumOfRecordViaRest(urlStr))
-        if (isNegativeTest == False):
+        if (not isNegativeTest):
             assertTrue(r1.status == 204)
             return r1
-        elif (isNegativeTest == True):
+        elif (isNegativeTest):
             return r1
 
     def createEntityViaPost(self, urlStr, params, headers=None):
-        logger.debug("POST: " + urlStr + " Body: " + params + " Headers: " + str(headers))
+        logger.debug("POST: " + urlStr + " Body: " +
+                     params + " Headers: " + str(headers))
         self.conn.request("POST", urlStr, params, headers)
         r1 = self.conn.getresponse()
         return r1
@@ -118,17 +124,23 @@ class TestBaseEntity(TestCase):
         self.conn.request("PUT", urlStr + "/" + getRecord, params)
         r1 = self.conn.getresponse()
         logger.debug("PUT response status code: " + str(r1.status))
-        if (isNegativeTest == False):
+        if (not isNegativeTest):
             assertTrue(r1.status == 200)
             return r1
-        elif (isNegativeTest == True):
+        elif (isNegativeTest):
             return r1
 
     '''
-    If you wish to "SELECT *" and get the first record then send queryFilterName=1 and queryFilterValue=1 to the method
+    If you wish to "SELECT *" and get the first record then send
+    queryFilterName=1 and queryFilterValue=1 to the method
     '''
 
-    def filterTableByColAndVal(self, queryColumnName, queryTableName, queryFilterName, queryFilterValue):
+    def filterTableByColAndVal(
+            self,
+            queryColumnName,
+            queryTableName,
+            queryFilterName,
+            queryFilterValue):
         dbConn = self.nativeConnect2Db()
         cur = dbConn.cursor()
         queryStr = "SELECT %s FROM %s WHERE %s ='%s'" % (
@@ -136,9 +148,13 @@ class TestBaseEntity(TestCase):
         logger.debug(queryStr)
         cur.execute(queryStr)
         result = str(cur.fetchone())
-        if (bool(re.search('[^0-9]', result)) == True):
-            logger.debug("Looks like result (" + result +
-                         ") from DB is in a multi column pattern: [col1, col2,...,coln], omitting it all colm beside " + queryColumnName)
+        if (bool(re.search('[^0-9]', result))):
+            logger.debug(
+                "Looks like result (" +
+                result +
+                ") from DB is in a multi column pattern: \
+                [col1, col2,...,coln], omitting it all colm beside " +
+                queryColumnName)
             if (result.find("',)") != -1):  # formatting strings e.g uuid
                 result = result.partition('\'')[-1].rpartition('\'')[0]
             elif (result.find(",)") != -1):  # formatting ints e.g id
@@ -149,13 +165,18 @@ class TestBaseEntity(TestCase):
     def selectLastValue(self, queryColumnName, queryTableName, orderBy="id"):
         dbConn = self.nativeConnect2Db()
         cur = dbConn.cursor()
-        queryStr = "select %s from %s ORDER BY %s DESC LIMIT 1;" % (queryColumnName, queryTableName, orderBy)
+        queryStr = "select %s from %s ORDER BY %s DESC LIMIT 1;" % (
+            queryColumnName, queryTableName, orderBy)
         logger.debug(queryStr)
         cur.execute(queryStr)
         result = str(cur.fetchone())
-        if (bool(re.search('[^0-9]', result)) == True):
-            logger.debug("Looks like result (" + result +
-                         ") from DB is in a multi column pattern: [col1, col2,...,coln], omitting it all colm beside " + queryColumnName)
+        if (bool(re.search('[^0-9]', result))):
+            logger.debug(
+                "Looks like result (" +
+                result +
+                ") from DB is in a multi column pattern: [col1, col2,...,coln]\
+                , omitting it all colm beside " +
+                queryColumnName)
             if (result.find("',)") != -1):  # formatting strings e.g uuid
                 result = result.partition('\'')[-1].rpartition('\'')[0]
             elif (result.find(",)") != -1):  # formatting ints e.g id
@@ -166,11 +187,13 @@ class TestBaseEntity(TestCase):
     def columnMaxLength(self, tableName, columnName):
         dbConn = self.nativeConnect2Db()
         cur = dbConn.cursor()
-        queryStr = "SELECT character_maximum_length from information_schema.columns WHERE table_name ='%s' and column_name = '%s'" % (
+        queryStr = "SELECT character_maximum_length from \
+        information_schema.columns WHERE table_name ='%s' \
+        and column_name = '%s'" % (
             tableName, columnName)
         cur.execute(queryStr)
         result = str(cur.fetchone())
-        if (bool(re.search('[^0-9]', result)) == True):
+        if (bool(re.search('[^0-9]', result))):
             if (result.find("',)") != -1):  # formatting strings e.g uuid
                 result = result.partition('\'')[-1].rpartition('\'')[0]
             elif (result.find(",)") != -1):  # formatting ints e.g id
@@ -198,7 +221,8 @@ class TestBaseEntity(TestCase):
         logger.debug("MaximalNameValue=" + str(maxName))
         return maxName
 
-    def getRecordAndDeserilizeIt(self, urlStr, getFilter, serializer, isCreateObj):
+    def getRecordAndDeserilizeIt(
+            self, urlStr, getFilter, serializer, isCreateObj):
         logger.debug("GET: " + urlStr + "/" + getFilter)
         try:
             self.conn.request("GET", urlStr + "/" + getFilter)
@@ -206,7 +230,7 @@ class TestBaseEntity(TestCase):
             logger.debug("DATA After JSON Parse:" + str(data))
             ser = serializer(data=data)
 #             logger.debug(" --> Serializer data: "+repr(ser))
-            if (isCreateObj == True):
+            if (isCreateObj):
                 logger.debug("Creating ...")
                 obj = ser.create(data)
             else:
@@ -219,50 +243,64 @@ class TestBaseEntity(TestCase):
         return obj
 
     def newParameters(self, oldValue, newValue, uuidValue):
-        newParams = re.sub(oldValue, newValue, self.params)  # Find and replace in string.
-        newParams = re.sub("}", ', "uuid":"' + uuidValue + '"}', newParams)  # Add UUID to params
+        # Find and replace in string.
+        newParams = re.sub(oldValue, newValue, self.params)
+        newParams = re.sub("}", ', "uuid":"' + uuidValue +
+                           '"}', newParams)  # Add UUID to params
         return newParams
 
     def negativeTestPost(self, getFilter, allowTwice=False):
         logger.debug("POST negative tests are starting now!")
-        if (allowTwice == False):
+        if (not allowTwice):
             logger.debug("Negative 01: Insert the same record twice via REST")
             r1 = self.createEntityViaPost(self.urlStr, self.params)
             logger.debug(r1.status, r1.reason)
             assertTrue(r1.status == 400)
             self.deleteRecord(self.urlStr, getFilter, False)
         logger.debug("Negative 02: Insert record with empty value via REST")
-        paramsEmptyValue = re.sub(r':\".*?\"', ':\"\"', self.params)  # Create params with empty values.
+        # Create params with empty values.
+        paramsEmptyValue = re.sub(r':\".*?\"', ':\"\"', self.params)
         r1 = self.createEntityViaPost(self.urlStr, paramsEmptyValue)
         logger.debug(r1.status, r1.reason)
         assertTrue(r1.status == 400)
         logger.debug("Negative 03: Insert record with missing value via REST")
-        paramsMissingValue = re.sub(r'{\".*?\":', '{\"\":', self.params)  # Create params without records part 1.
+        # Create params without records part 1.
+        paramsMissingValue = re.sub(r'{\".*?\":', '{\"\":', self.params)
         # Create params without records part 2.
-        paramsMissingValue = re.sub(r', \".*?\":', ', \"\":', paramsMissingValue)
+        paramsMissingValue = re.sub(
+            r', \".*?\":', ', \"\":', paramsMissingValue)
         r1 = self.createEntityViaPost(self.urlStr, paramsMissingValue)
         logger.debug(r1.status, r1.reason)
         assertTrue(r1.status == 400)
-        logger.debug("Negative 04: Insert record with more than " + str(self.longValueLength) + " chars via REST")
-        paramsLongValue = re.sub(
-            r':\".*?\"', ':\"' + str(self.randomGenerator("randomNumber", self.longValueLength)) + '\"', self.params)
+        logger.debug("Negative 04: Insert record with more than " +
+                     str(self.longValueLength) + " chars via REST")
+        paramsLongValue = re.sub(r':\".*?\"',
+                                 ':\"' + str(
+                                     self.randomGenerator(
+                                         "randomNumber",
+                                         self.longValueLength)) + '\"',
+                                 self.params)
         r1 = self.createEntityViaPost(self.urlStr, paramsLongValue)
         logger.debug(r1.status, r1.reason)
         assertTrue(r1.status == 400)
-        if (allowTwice == True):
+        if (allowTwice):
             logger.debug("Deleting record from database...")
             self.deleteRecord(self.urlStr, getFilter, False)
 
     def negativeTestPut(self, getFilter, params):
         logger.debug("PUT negative tests are starting now!")
-        match = re.search("\D", getFilter)  # Check if getFilter contains non-digit characters.
+        # Check if getFilter contains non-digit characters.
+        match = re.search("\D", getFilter)
         if not match:
             logger.debug("Negative 01: Edit non existing record via REST")
             nonExistingValue = self.randomGenerator("randomNumber", 5)
-            r1 = self.editEntityViaPut(self.urlStr, nonExistingValue, params, True)
+            r1 = self.editEntityViaPut(
+                self.urlStr, nonExistingValue, params, True)
             logger.debug(r1.status, r1.reason)
             assertTrue(r1.status == 404)
-            logger.debug("Negative 02: Edit record with string in URL instead of integer via REST")
+            logger.debug(
+                "Negative 02: Edit record with string \
+                in URL instead of integer via REST")
             randStr = self.randomGenerator("randomString")
             r1 = self.editEntityViaPut(self.urlStr, randStr, params, True)
             logger.debug(r1.status, r1.reason)
@@ -270,7 +308,8 @@ class TestBaseEntity(TestCase):
         else:
             logger.debug("Negative 01: Edit non existing record via REST")
             nonExistingValue = self.randomGenerator("randomString")
-            r1 = self.editEntityViaPut(self.urlStr, nonExistingValue, params, True)
+            r1 = self.editEntityViaPut(
+                self.urlStr, nonExistingValue, params, True)
             logger.debug(r1.status, r1.reason)
             assertTrue(r1.status == 404)
         logger.debug("Negative 02: Edit record without URL pointer via REST")
@@ -278,15 +317,20 @@ class TestBaseEntity(TestCase):
         logger.debug(r1.status, r1.reason)
         assertTrue(r1.status == 405)
         logger.debug("Negative 03: Edit record with empty value via REST")
-        paramsEmptyValue = re.sub(r':\".*?\"', ':\"\"', params)  # Create params with empty values.
-        r1 = self.editEntityViaPut(self.urlStr, getFilter, paramsEmptyValue, True)
+        # Create params with empty values.
+        paramsEmptyValue = re.sub(r':\".*?\"', ':\"\"', params)
+        r1 = self.editEntityViaPut(
+            self.urlStr, getFilter, paramsEmptyValue, True)
         logger.debug(r1.status, r1.reason)
         assertTrue(r1.status == 400)
         logger.debug("Negative 04: Edit record with missing value via REST")
-        paramsMissingValue = re.sub(r'{\".*?\":', '{\"\":', params)  # Create params without records part 1.
+        # Create params without records part 1.
+        paramsMissingValue = re.sub(r'{\".*?\":', '{\"\":', params)
         # Create params without records part 2.
-        paramsMissingValue = re.sub(r', \".*?\":', ', \"\":', paramsMissingValue)
-        r1 = self.editEntityViaPut(self.urlStr, getFilter, paramsMissingValue, True)
+        paramsMissingValue = re.sub(
+            r', \".*?\":', ', \"\":', paramsMissingValue)
+        r1 = self.editEntityViaPut(
+            self.urlStr, getFilter, paramsMissingValue, True)
         logger.debug(r1.status, r1.reason)
         assertTrue(r1.status == 400)
         logger.debug("Deleting record from database...")
@@ -294,7 +338,9 @@ class TestBaseEntity(TestCase):
 
     def negativeTestDelete(self):
         logger.debug("DELETE negative tests are starting now!")
-        logger.debug("Negative 01: Delete non existing record via REST or wrong URL pointer")
+        logger.debug(
+            "Negative 01: Delete non existing record via \
+            REST or wrong URL pointer")
         nonExistingValue = self.randomGenerator("randomString")
         r1 = self.deleteRecord(self.urlStr, nonExistingValue, True)
         logger.debug(r1.status, r1.reason)
@@ -309,7 +355,8 @@ class TestBaseEntity(TestCase):
         self.assertTrue(False)
 
     def failRestTest(self, r1):
-        logger.debug("Previous HTTP POST request has failed with " + str(r1.status))
+        logger.debug(
+            "Previous HTTP POST request has failed with " + str(r1.status))
         self.assertTrue(False)
 
     def randomGenerator(self, typeOfValue, numberOfDigits=0):
index e206bad..06221c4 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -52,9 +52,11 @@ class TestBaseTransactionEntity(TransactionTestCase):
     __metaclass__ = ABCMeta
 
     def setUp(self):
-        logger.debug("---------------------- TransactionTestCase " + self.__class__.__name__ + " ----------------------")
+        logger.debug("---------------------- TransactionTestCase " +
+                     self.__class__.__name__ + " ----------------------")
         self.urlPrefix = "/%s/v1/engmgr/" % settings.PROGRAM_NAME_URL_PREFIX
-        self.conn = http.client.HTTPConnection("127.0.0.1", 8000)  # @UndefinedVariable
+        self.conn = http.client.HTTPConnection(
+            "127.0.0.1", 8000)  # @UndefinedVariable
         self.c = Client()
         self.creator = VvpEntitiesCreator()
         settings.IS_SIGNAL_ENABLED = False
@@ -63,7 +65,8 @@ class TestBaseTransactionEntity(TransactionTestCase):
     def tearDown(self):
         settings.IS_SIGNAL_ENABLED = True
         self.conn.close()
-        logger.debug("----------------------  TransactionTestCase " + self.__class__.__name__ + " ---------------------- ")
+        logger.debug("----------------------  TransactionTestCase " +
+                     self.__class__.__name__ + " ---------------------- ")
 
     @abstractmethod
     def childSetup(self):
index a7fa800..c9f6fde 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -39,7 +39,8 @@
 import json
 from uuid import uuid4
 
-from rest_framework.status import HTTP_200_OK, HTTP_401_UNAUTHORIZED, HTTP_400_BAD_REQUEST
+from rest_framework.status import HTTP_200_OK, HTTP_401_UNAUTHORIZED, \
+    HTTP_400_BAD_REQUEST
 
 from engagementmanager.models import ChecklistTemplate, ChecklistLineItem
 from engagementmanager.models import Vendor
@@ -51,24 +52,34 @@ class TestChecklistTestCase(TestBaseEntity):
 
     def childSetup(self):
 
-        self.createVendors([Constants.service_provider_company_name, 'Amdocs', 'Other'])
+        self.createVendors(
+            [Constants.service_provider_company_name, 'Amdocs', 'Other'])
         self.createDefaultRoles()
 
         # Create a user with role el
-        self.el_user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'el user', self.el, True)
+        self.el_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'el user',
+            self.el,
+            True)
         self.peer_reviewer = self.creator.createUser(Vendor.objects.get(
             name='Other'), self.randomGenerator("main-vendor-email"),
             '55501000199', 'peer-reviewer user', self.el, True)
         # For negative tests
-        self.user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'user', self.standard_user, True)
+        self.user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'user',
+            self.standard_user,
+            True)
         self.urlStr = self.urlPrefix + "engagement/@eng_uuid/checklist/new/"
         self.data = dict()
         self.template = self.creator.createDefaultCheckListTemplate()
-#         self.engagement = Engagement.objects.create(uuid='just-a-fake-uuid',engagement_stage='Validation')
         self.engagement = self.creator.createEngagement(
             uuid4(), 'Validation', None)
         self.engagement.reviewer = self.el_user
@@ -78,9 +89,14 @@ class TestChecklistTestCase(TestBaseEntity):
         self.engagement.save()
         self.vendor = Vendor.objects.get(name='Other')
         self.deploymentTarget = self.creator.createDeploymentTarget(
-            self.randomGenerator("randomString"), self.randomGenerator("randomString"))
-        self.vf = self.creator.createVF(self.randomGenerator("randomString"),
-                                        self.engagement, self.deploymentTarget, False, self.vendor)
+            self.randomGenerator("randomString"),
+            self.randomGenerator("randomString"))
+        self.vf = self.creator.createVF(
+            self.randomGenerator("randomString"),
+            self.engagement,
+            self.deploymentTarget,
+            False,
+            self.vendor)
 
     def initBody(self):
         self.data['checkListName'] = "ice checklist for test"
@@ -90,14 +106,20 @@ class TestChecklistTestCase(TestBaseEntity):
         self.data['checkListAssociatedFiles'].append("file1")
         self.data['checkListAssociatedFiles'].append("file2")
 
-    def getOrCreateChecklist(self, expectedStatus=HTTP_200_OK, httpMethod="GET"):
+    def getOrCreateChecklist(
+            self, expectedStatus=HTTP_200_OK, httpMethod="GET"):
         if (httpMethod == "GET"):
-            response = self.c.get(self.urlStr.replace("@eng_uuid", str(self.engagement.uuid)),
-                                  **{'HTTP_AUTHORIZATION': "token " + self.token})
+            response = self.c.get(self.urlStr.replace("@eng_uuid", str(
+                self.engagement.uuid)), **{'HTTP_AUTHORIZATION': "token "
+                                           + self.token})
         elif (httpMethod == "POST"):
             datajson = json.dumps(self.data, ensure_ascii=False)
-            response = self.c.post(self.urlStr.replace("@eng_uuid", str(self.engagement.uuid)), datajson,
-                                   content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.token})
+            response = self.c.post(
+                self.urlStr.replace("@eng_uuid", str(self.engagement.uuid)),
+                datajson,
+                content_type='application/json',
+                **{'HTTP_AUTHORIZATION': "token "
+                   + self.token})
 
         print('Got response : ' + str(response.status_code) +
               " Expecting " + str(expectedStatus))
@@ -163,8 +185,10 @@ class TestChecklistTestCase(TestBaseEntity):
         self.data = dict()
         self.data['decisions'] = "{123}"
         datajson = json.dumps(self.data, ensure_ascii=False)
-        response = self.c.get(self.urlStr.replace("@checklist_uuid", str(checklist['uuid'])),
-                              content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.token})
+        response = self.c.get(self.urlStr.replace("@checklist_uuid",
+                                                  str(checklist['uuid'])),
+                              content_type='application/json',
+                              **{'HTTP_AUTHORIZATION': "token " + self.token})
 
         print(json.loads(response.content))
 
@@ -173,5 +197,8 @@ class TestChecklistTestCase(TestBaseEntity):
         self.data = dict()
         self.data['decisions'] = "{123}"
         datajson = json.dumps(self.data, ensure_ascii=False)
-        response = self.c.post(self.urlStr.replace("@checklist_uuid", str(checklist['uuid'])), datajson,
-                               content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.token})
+        response = self.c.post(self.urlStr.replace("@checklist_uuid",
+                                                   str(checklist['uuid'])),
+                               datajson,
+                               content_type='application/json',
+                               **{'HTTP_AUTHORIZATION': "token " + self.token})
index c3c63e4..0cb8075 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -51,30 +51,51 @@ def dummy_true():
     return True
 
 
-@mock.patch('engagementmanager.service.checklist_service.CheckListSvc.decline_all_template_checklists', dummy_true)
+@mock.patch(
+    'engagementmanager.service.checklist_service.' +
+    'CheckListSvc.decline_all_template_checklists',
+    dummy_true)
 class TestChecklistTestCase(TestBaseEntity):
 
     def childSetup(self):
 
-        self.createVendors([Constants.service_provider_company_name, 'Amdocs', 'Other'])
+        self.createVendors(
+            [Constants.service_provider_company_name, 'Amdocs', 'Other'])
         self.createDefaultRoles()
         # Create a user with role el
         self.el_user = self.creator.createUser(
-            Vendor.objects.get(name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'el user', self.el, True)
-        self.admin_user = self.creator.createUser(Vendor.objects.get(name=Constants.service_provider_company_name),
-                                                  Constants.service_provider_admin_mail, '55501000199',
-                                                  'admin user', self.admin, True)
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'el user',
+            self.el,
+            True)
+        self.admin_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            Constants.service_provider_admin_mail,
+            '55501000199',
+            'admin user',
+            self.admin,
+            True)
         # For negative tests
         self.user = self.creator.createUser(
-            Vendor.objects.get(name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'user', self.standard_user, True)
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'user',
+            self.standard_user,
+            True)
         self.urlStrForSave = self.urlPrefix + "checklist/template/"
-        self.urlStrForGetTmpl = self.urlPrefix + "checklist/template/@template_uuid"
+        self.urlStrForGetTmpl = self.urlPrefix + \
+            "checklist/template/@template_uuid"
         self.urlStrForGetTmpls = self.urlPrefix + "checklist/templates/"
         self.data = dict()
         self.template = self.creator.createDefaultCheckListTemplate()
-        self.engagement = self.creator.createEngagement('just-a-fake-uuid', 'Validation', None)
+        self.engagement = self.creator.createEngagement(
+            'just-a-fake-uuid', 'Validation', None)
         self.engagement.reviewer = self.el_user
         self.engagement.peer_reviewer = self.el_user
         self.engagement.engagement_team.add(self.user)
@@ -82,9 +103,14 @@ class TestChecklistTestCase(TestBaseEntity):
         self.engagement.save()
         self.vendor = Vendor.objects.get(name='Other')
         self.deploymentTarget = self.creator.createDeploymentTarget(
-            self.randomGenerator("randomString"), self.randomGenerator("randomString"))
+            self.randomGenerator("randomString"),
+            self.randomGenerator("randomString"))
         self.vf = self.creator.createVF(
-            self.randomGenerator("randomString"), self.engagement, self.deploymentTarget, False, self.vendor)
+            self.randomGenerator("randomString"),
+            self.engagement,
+            self.deploymentTarget,
+            False,
+            self.vendor)
 
     def initBody(self):
         self.data['uuid'] = str(self.template.uuid)
@@ -108,24 +134,31 @@ class TestChecklistTestCase(TestBaseEntity):
         self.data['sections'].append(sec1)
         print(self.data)
 
-    def getOrCreateChecklistTemplate(self, urlStr, expectedStatus=HTTP_200_OK, httpMethod="GET"):
+    def getOrCreateChecklistTemplate(
+            self, urlStr, expectedStatus=HTTP_200_OK, httpMethod="GET"):
         if (httpMethod == "GET"):
             if (urlStr == self.urlStrForGetTmpls):
-                response = self.c.get(urlStr,
-                                      **{'HTTP_AUTHORIZATION': "token " + self.token})
+                response = self.c.get(
+                    urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
             else:
-                response = self.c.get(urlStr.replace("@template_uuid", str(self.template.uuid)),
-                                      **{'HTTP_AUTHORIZATION': "token " + self.token})
+                response = self.c.get(
+                    urlStr.replace("@template_uuid", str(
+                        self.template.uuid)),
+                    **{'HTTP_AUTHORIZATION': "token " + self.token})
         elif (httpMethod == "PUT"):
             datajson = json.dumps(self.data, ensure_ascii=False)
             response = self.c.put(
-                urlStr, datajson, content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.token})
-            print('Got response : ' + str(response.status_code) + " Expecting " + str(expectedStatus))
-        print('Got response : ' + str(response.status_code) + " Expecting " + str(expectedStatus))
+                urlStr,
+                datajson,
+                content_type='application/json',
+                **{'HTTP_AUTHORIZATION': "token " + self.token})
+            print('Got response : ' + str(response.status_code) +
+                  " Expecting " + str(expectedStatus))
+        print('Got response : ' + str(response.status_code) +
+              " Expecting " + str(expectedStatus))
         self.assertEqual(response.status_code, expectedStatus)
         return response
 
-    ### TESTS ###
     def testSaveChecklistTemplate(self):
         self.initBody()
         self.token = self.loginAndCreateSessionToken(self.admin_user)
@@ -137,32 +170,43 @@ class TestChecklistTestCase(TestBaseEntity):
         self.token = self.loginAndCreateSessionToken(self.admin_user)
         self.data['uuid'] = ""
         print("testSaveChecklistTemplateMissingTemplateUuid")
-        self.getOrCreateChecklistTemplate(self.urlStrForSave, expectedStatus=HTTP_404_NOT_FOUND, httpMethod="PUT")
+        self.getOrCreateChecklistTemplate(
+            self.urlStrForSave,
+            expectedStatus=HTTP_404_NOT_FOUND,
+            httpMethod="PUT")
 
     def testSaveChecklistTemplateNotExistingTemplate(self):
         self.initBody()
         self.token = self.loginAndCreateSessionToken(self.admin_user)
         print("testSaveChecklistTemplateNoExistanceTemplate")
         self.data['uuid'] = 'fake_uuid'
-        self.getOrCreateChecklistTemplate(self.urlStrForSave, expectedStatus=HTTP_404_NOT_FOUND, httpMethod="PUT")
+        self.getOrCreateChecklistTemplate(
+            self.urlStrForSave,
+            expectedStatus=HTTP_404_NOT_FOUND,
+            httpMethod="PUT")
 
     def testSaveChecklistTemplateMissingKey(self):
         self.initBody()
         self.token = self.loginAndCreateSessionToken(self.admin_user)
         print("testSaveChecklistTemplateNoExistanceTemplate")
-        # take the first line item (li1_name) which is newEntity and remove its name, expect 500
+        # take the first line item (li1_name) which is newEntity and remove its
+        # name, expect 500
         self.data['sections'][0]["lineItems"][0]["name"] = None
         self.getOrCreateChecklistTemplate(
-            self.urlStrForSave, expectedStatus=HTTP_500_INTERNAL_SERVER_ERROR, httpMethod="PUT")
+            self.urlStrForSave,
+            expectedStatus=HTTP_500_INTERNAL_SERVER_ERROR,
+            httpMethod="PUT")
 
     def testGetChecklistTemplates(self):
         self.initBody()
         self.token = self.loginAndCreateSessionToken(self.admin_user)
         print("testSaveChecklistTemplate")
-        self.getOrCreateChecklistTemplate(self.urlStrForGetTmpls, httpMethod="GET")
+        self.getOrCreateChecklistTemplate(
+            self.urlStrForGetTmpls, httpMethod="GET")
 
     def testGetChecklistTemplate(self):
         self.initBody()
         self.token = self.loginAndCreateSessionToken(self.admin_user)
         print("testSaveChecklistTemplate")
-        self.getOrCreateChecklistTemplate(self.urlStrForGetTmpl, httpMethod="GET")
+        self.getOrCreateChecklistTemplate(
+            self.urlStrForGetTmpl, httpMethod="GET")
index 2d13f96..0d19dbc 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -48,7 +48,8 @@ logger = LoggingServiceFactory.get_logger()
 
 
 def search_page_mock(keyword):
-    result = [{u'id': 1, u'title': 'exists_title', u'children': [], u'status': '', u'_order': 1}, ]
+    result = [{u'id': 1, u'title': 'exists_title',
+               u'children': [], u'status': '', u'_order': 1}, ]
     return result
 
 
@@ -61,41 +62,54 @@ class TestCMSDocumentationSearch(TestBaseEntity):
     def childSetup(self):
         self.createVendors([Constants.service_provider_company_name, 'Other'])
         self.createDefaultRoles()
-        self.admin, self.el, self.standard_user = self.creator.createAndGetDefaultRoles()
-        self.user = self.creator.createUser(Vendor.objects.get(name='Other'),
-                                            self.randomGenerator("main-vendor-email"), 'Aa123456',
-                                            'user', self.standard_user, True)
+        self.admin, self.el, self.standard_user = \
+            self.creator.createAndGetDefaultRoles()
+        self.user = self.creator.createUser(
+            Vendor.objects.get(
+                name='Other'),
+            self.randomGenerator("main-vendor-email"),
+            'Aa123456',
+            'user',
+            self.standard_user,
+            True)
         self.token = self.loginAndCreateSessionToken(self.user)
 
     def testSearchEmptyString(self):
         urlStr = self.urlPrefix + 'cms/pages/search/?keyword='
         self.printTestName("testSearchEmptyString [Start]")
         logger.debug("action should success (200), and return empty array")
-        response = self.c.get(urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
+        response = self.c.get(
+            urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
         content = json.loads(response.content)
         self.assertEqual(content, [])
         self.printTestName("testSearchEmptyString [End]")
 
-    @mock.patch('engagementmanager.apps.cms_client.search_pages', search_empty_page_mock)
+    @mock.patch('engagementmanager.apps.cms_client.search_pages',
+                search_empty_page_mock)
     def testSearchNotExistsKeyword(self):
         urlStr = self.urlPrefix + 'cms/pages/search/?keyword=somewordnotexists'
         self.printTestName("testSearchNotExistsKeyword [Start]")
         logger.debug("action should success (200), and return empty array")
-        response = self.c.get(urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
+        response = self.c.get(
+            urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
         content = json.loads(response.content)
         self.assertEqual(content, [])
         self.printTestName("testSearchNotExistsKeyword [End]")
 
-    @mock.patch('engagementmanager.apps.cms_client.search_pages', search_page_mock)
+    @mock.patch('engagementmanager.apps.cms_client.search_pages',
+                search_page_mock)
     def testSearchExistsKeyword(self):
         urlStr = self.urlPrefix + 'cms/pages/search/?keyword=exists_title'
         self.printTestName("testSearchExistsKeyword [Start]")
-        logger.debug("action should success (200), and return array with one page (by mock)")
-        response = self.c.get(urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
+        logger.debug(
+            "action should success (200), \
+            and return array with one page (by mock)")
+        response = self.c.get(
+            urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
         content = json.loads(response.content)
index 4fd9473..d6d074b 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -48,30 +48,72 @@ logger = LoggingServiceFactory.get_logger()
 
 
 def get_pages_mock(title=""):
-    result = [{u'meta_description': u'Content of page #1', u'parent': None, u'title': u'Page #1',
-               u'login_required': True, u'children': [], u'id': 1,
-               u'content': u'<p>Content of page #1</p>', u'content_model': u'richtextpage',
-               u'publish_date': u'2017-01-01T13:47:15Z', u'slug': u'documentation/page#1', u'tags': u''},
-              {u'meta_description': u'Content of page #2', u'parent': None, u'title': u'Page #2',
-               u'login_required': True, u'children': [], u'id': 2,
-               u'content': u'<p>Content of page #2</p>', u'content_model': u'richtextpage',
-               u'publish_date': u'2017-01-01T13:47:15Z', u'slug': u'documentation/page#2', u'tags': u''},
-              {u'meta_description': u'Content of page #3', u'parent': None, u'title': u'Page #3',
-               u'login_required': True, u'children': [], u'id': 3,
-               u'content': u'<p>Content of page #3</p>', u'content_model': u'richtextpage',
-               u'publish_date': u'2017-01-01T13:47:15Z', u'slug': u'documentation/page#3', u'tags': u''},
-              {u'meta_description': u'Content of page #4', u'parent': None, u'title': u'Page #4',
-               u'login_required': True, u'children': [], u'id': 4,
-               u'content': u'<p>Content of page #4</p>', u'content_model': u'richtextpage',
-               u'publish_date': u'2017-01-01T13:47:15Z', u'slug': u'documentation/page#4', u'tags': u''},
-              {u'meta_description': u'Content of page #5', u'parent': None, u'title': u'Page #5',
-               u'login_required': True, u'children': [], u'id': 5,
-               u'content': u'<p>Content of page #5</p>', u'content_model': u'richtextpage',
-               u'publish_date': u'2017-01-01T13:47:15Z', u'slug': u'documentation/page#5', u'tags': u''},
-              {u'meta_description': u'Content of page #6', u'parent': None, u'title': u'Page #6',
-               u'login_required': True, u'children': [], u'id': 6,
-               u'content': u'<p>Content of page #6</p>', u'content_model': u'richtextpage',
-               u'publish_date': u'2017-01-01T13:47:15Z', u'slug': u'documentation/page#6', u'tags': u''}]
+    result = [{u'meta_description': u'Content of page #1',
+               u'parent': None,
+               u'title': u'Page #1',
+               u'login_required': True,
+               u'children': [],
+               u'id': 1,
+               u'content': u'<p>Content of page #1</p>',
+               u'content_model': u'richtextpage',
+               u'publish_date': u'2017-01-01T13:47:15Z',
+               u'slug': u'documentation/page#1',
+               u'tags': u''},
+              {u'meta_description': u'Content of page #2',
+               u'parent': None,
+               u'title': u'Page #2',
+               u'login_required': True,
+               u'children': [],
+               u'id': 2,
+               u'content': u'<p>Content of page #2</p>',
+               u'content_model': u'richtextpage',
+               u'publish_date': u'2017-01-01T13:47:15Z',
+               u'slug': u'documentation/page#2',
+               u'tags': u''},
+              {u'meta_description': u'Content of page #3',
+               u'parent': None,
+               u'title': u'Page #3',
+               u'login_required': True,
+               u'children': [],
+               u'id': 3,
+               u'content': u'<p>Content of page #3</p>',
+               u'content_model': u'richtextpage',
+               u'publish_date': u'2017-01-01T13:47:15Z',
+               u'slug': u'documentation/page#3',
+               u'tags': u''},
+              {u'meta_description': u'Content of page #4',
+               u'parent': None,
+               u'title': u'Page #4',
+               u'login_required': True,
+               u'children': [],
+               u'id': 4,
+               u'content': u'<p>Content of page #4</p>',
+               u'content_model': u'richtextpage',
+               u'publish_date': u'2017-01-01T13:47:15Z',
+               u'slug': u'documentation/page#4',
+               u'tags': u''},
+              {u'meta_description': u'Content of page #5',
+               u'parent': None,
+               u'title': u'Page #5',
+               u'login_required': True,
+               u'children': [],
+               u'id': 5,
+               u'content': u'<p>Content of page #5</p>',
+               u'content_model': u'richtextpage',
+               u'publish_date': u'2017-01-01T13:47:15Z',
+               u'slug': u'documentation/page#5',
+               u'tags': u''},
+              {u'meta_description': u'Content of page #6',
+               u'parent': None,
+               u'title': u'Page #6',
+               u'login_required': True,
+               u'children': [],
+               u'id': 6,
+               u'content': u'<p>Content of page #6</p>',
+               u'content_model': u'richtextpage',
+               u'publish_date': u'2017-01-01T13:47:15Z',
+               u'slug': u'documentation/page#6',
+               u'tags': u''}]
     if title != "":
         return [result[0]]
     else:
@@ -79,10 +121,18 @@ def get_pages_mock(title=""):
 
 
 def get_page_mock(id):
-    result = {u'meta_description': u'Content of page #1', u'parent': None, u'title': u'Page #1',
-              u'login_required': True, u'children': [], u'id': 1,
-              u'content': u'<p>Content of page #1</p>', u'content_model': u'richtextpage',
-              u'publish_date': u'2017-01-01T13:47:15Z', u'slug': u'documentation/page#1', u'tags': u''}
+    result = {
+        u'meta_description': u'Content of page #1',
+        u'parent': None,
+        u'title': u'Page #1',
+        u'login_required': True,
+        u'children': [],
+        u'id': 1,
+        u'content': u'<p>Content of page #1</p>',
+        u'content_model': u'richtextpage',
+        u'publish_date': u'2017-01-01T13:47:15Z',
+        u'slug': u'documentation/page#1',
+        u'tags': u''}
 
     return result
 
@@ -94,17 +144,24 @@ class CMSGetPagesTestCase(TestBaseEntity):
     def childSetup(self):
         self.createVendors([Constants.service_provider_company_name, 'Other'])
         self.createDefaultRoles()
-        self.admin, self.el, self.standard_user = self.creator.createAndGetDefaultRoles()
-        self.user = self.creator.createUser(Vendor.objects.get(name='Other'),
-                                            self.randomGenerator("main-vendor-email"), 'Aa123456',
-                                            'user', self.standard_user, True)
+        self.admin, self.el, self.standard_user = \
+            self.creator.createAndGetDefaultRoles()
+        self.user = self.creator.createUser(
+            Vendor.objects.get(
+                name='Other'),
+            self.randomGenerator("main-vendor-email"),
+            'Aa123456',
+            'user',
+            self.standard_user,
+            True)
         self.token = self.loginAndCreateSessionToken(self.user)
 
     def testGetPageById(self):
         urlStr = self.urlPrefix + 'cms/pages/1/'
         self.printTestName("testGetPageById [Start]")
         logger.debug("action should success (200), and return page by id")
-        response = self.c.get(urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
+        response = self.c.get(
+            urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
         content = json.loads(response.content)
@@ -115,10 +172,12 @@ class CMSGetPagesTestCase(TestBaseEntity):
         urlStr = self.urlPrefix + 'cms/pages/'
         self.printTestName("testGetPages [Start]")
         logger.debug("action should success (200), and return all pages")
-        response = self.c.get(urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
+        response = self.c.get(
+            urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
-        self.assertEqual(len(json.loads(response.content)), 6)  # Suppose to be 6 The amount of Pages in the mock.
+        # Suppose to be 6 The amount of Pages in the mock.
+        self.assertEqual(len(json.loads(response.content)), 6)
         self.printTestName("testGetPages [End]")
 
     def testGetPagesByTitle(self):
@@ -126,10 +185,12 @@ class CMSGetPagesTestCase(TestBaseEntity):
         print(urlStr)
         self.printTestName("testGetPagesByTitle [Start]")
         logger.debug("action should success (200), and return filtered pages")
-        response = self.c.get(urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
+        response = self.c.get(
+            urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
         content = json.loads(response.content)
-        self.assertEqual(len(content), 1)  # Suppose to be 1 The amount of Documentation titled pages in the mock.
+        # Suppose to be 1 The amount of Documentation titled pages in the mock.
+        self.assertEqual(len(content), 1)
         self.assertEqual(content[0]["title"], 'Page #1')
         self.printTestName("testGetPagesByTitle [End]")
index 7132c2c..8859d48 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -48,16 +48,144 @@ logger = LoggingServiceFactory.get_logger()
 
 
 def get_posts_mock(offset=0, limit=10, category="", date_min=""):
-    result = [{u'updated': u'2017-01-17T15:57:19.567778Z', u'title': u'announcement..new.1', u'url': u'http://127.0.0.1:8001/blog/announcementnew1/', u'short_url': u'/blog/announcementnew1/', u'tags': u'', u'excerpt': u'announcement..new.announcement..new.', u'allow_comments': True, u'comments': [], u'slug': u'announcementnew1', u'content': u'<p>announcement..new.announcement..new.</p>', u'publish_date': u'2017-01-14T19:53:52Z', u'user': {u'username': u'al942u', u'first_name': u'', u'last_name': u'', u'email': u'al942u@mail.com', u'is_staff': True, u'id': 1}, u'featured_image': u'', u'comments_count': 0, u'id': 1, u'categories': [{u'slug': u'announcement', u'id': 1, u'title': u'Announcement'}]},
-              {u'updated': u'2017-01-16T15:57:19.567778Z', u'title': u'announcement..new.2', u'url': u'http://127.0.0.1:8001/blog/announcementnew2/', u'short_url': u'/blog/announcementnew2/', u'tags': u'', u'excerpt': u'announcement..new.announcement..new.', u'allow_comments': True, u'comments': [], u'slug': u'announcementnew2',
-                  u'content': u'<p>announcement..new.announcement..new.</p>', u'publish_date': u'2017-01-15T19:53:52Z', u'user': {u'username': u'al942u', u'first_name': u'', u'last_name': u'', u'email': u'al942u@mail.com', u'is_staff': True, u'id': 1}, u'featured_image': u'', u'comments_count': 0, u'id': 2, u'categories': [{u'slug': u'announcement', u'id': 1, u'title': u'Announcement'}]},
-              {u'updated': u'2017-01-15T15:57:19.567778Z', u'title': u'announcement..new.3', u'url': u'http://127.0.0.1:8001/blog/announcementnew3/', u'short_url': u'/blog/announcementnew3/', u'tags': u'', u'excerpt': u'announcement..new.announcement..new.', u'allow_comments': True, u'comments': [], u'slug': u'announcementnew3',
-                  u'content': u'<p>announcement..new.announcement..new.</p>', u'publish_date': u'2017-01-16T19:53:52Z', u'user': {u'username': u'al942u', u'first_name': u'', u'last_name': u'', u'email': u'al942u@mail.com', u'is_staff': True, u'id': 1}, u'featured_image': u'', u'comments_count': 0, u'id': 3, u'categories': [{u'slug': u'announcement', u'id': 1, u'title': u'Announcement'}]},
-              {u'updated': u'2017-01-14T15:57:19.567778Z', u'title': u'news..new.1', u'url': u'http://127.0.0.1:8001/blog/news1/', u'short_url': u'/blog/news1/', u'tags': u'', u'excerpt': u'news..new.news..new.', u'allow_comments': True, u'comments': [], u'slug': u'news1', u'content': u'<p>news..new.news..new.</p>',
-               u'publish_date': u'2017-01-14T19:53:52Z', u'user': {u'username': u'al942u', u'first_name': u'', u'last_name': u'', u'email': u'al942u@mail.com', u'is_staff': True, u'id': 1}, u'featured_image': u'', u'comments_count': 0, u'id': 4, u'categories': [{u'slug': u'news', u'id': 1, u'title': u'News'}]},
-              {u'updated': u'2017-01-13T15:57:19.567778Z', u'title': u'news..new.2', u'url': u'http://127.0.0.1:8001/blog/news2/', u'short_url': u'/blog/news2/', u'tags': u'', u'excerpt': u'news..new.news..new.', u'allow_comments': True, u'comments': [], u'slug': u'news2', u'content': u'<p>news..new.news..new.</p>',
-               u'publish_date': u'2017-01-15T19:53:52Z', u'user': {u'username': u'al942u', u'first_name': u'', u'last_name': u'', u'email': u'al942u@mail.com', u'is_staff': True, u'id': 1}, u'featured_image': u'', u'comments_count': 0, u'id': 5, u'categories': [{u'slug': u'news', u'id': 1, u'title': u'News'}]},
-              {u'updated': u'2017-01-12T15:57:19.567778Z', u'title': u'news..new.3', u'url': u'http://127.0.0.1:8001/blog/news3/', u'short_url': u'/blog/news3/', u'tags': u'', u'excerpt': u'news..new.news..new.', u'allow_comments': True, u'comments': [], u'slug': u'news3', u'content': u'<p>news..new.news..new.</p>', u'publish_date': u'2017-01-16T19:53:52Z', u'user': {u'username': u'al942u', u'first_name': u'', u'last_name': u'', u'email': u'al942u@mail.com', u'is_staff': True, u'id': 1}, u'featured_image': u'', u'comments_count': 0, u'id': 6, u'categories': [{u'slug': u'news', u'id': 1, u'title': u'News'}]}]
+    result = [{u'updated': u'2017-01-17T15:57:19.567778Z',
+               u'title': u'announcement..new.1',
+               u'url': u'http://127.0.0.1:8001/blog/announcementnew1/',
+               u'short_url': u'/blog/announcementnew1/',
+               u'tags': u'',
+               u'excerpt': u'announcement..new.announcement..new.',
+               u'allow_comments': True,
+               u'comments': [],
+               u'slug': u'announcementnew1',
+               u'content': u'<p>announcement..new.announcement..new.</p>',
+               u'publish_date': u'2017-01-14T19:53:52Z',
+               u'user': {u'username': u'al942u',
+                         u'first_name': u'',
+                         u'last_name': u'',
+                         u'email': u'al942u@mail.com',
+                         u'is_staff': True,
+                         u'id': 1},
+               u'featured_image': u'',
+               u'comments_count': 0,
+               u'id': 1,
+               u'categories': [{u'slug': u'announcement',
+                                u'id': 1,
+                                u'title': u'Announcement'}]},
+              {u'updated': u'2017-01-16T15:57:19.567778Z',
+               u'title': u'announcement..new.2',
+               u'url': u'http://127.0.0.1:8001/blog/announcementnew2/',
+               u'short_url': u'/blog/announcementnew2/',
+               u'tags': u'',
+               u'excerpt': u'announcement..new.announcement..new.',
+               u'allow_comments': True,
+               u'comments': [],
+               u'slug': u'announcementnew2',
+               u'content': u'<p>announcement..new.announcement..new.</p>',
+               u'publish_date': u'2017-01-15T19:53:52Z',
+               u'user': {u'username': u'al942u',
+                         u'first_name': u'',
+                         u'last_name': u'',
+                         u'email': u'al942u@mail.com',
+                         u'is_staff': True,
+                         u'id': 1},
+               u'featured_image': u'',
+               u'comments_count': 0,
+               u'id': 2,
+               u'categories': [{u'slug': u'announcement',
+                                u'id': 1,
+                                u'title': u'Announcement'}]},
+              {u'updated': u'2017-01-15T15:57:19.567778Z',
+               u'title': u'announcement..new.3',
+               u'url': u'http://127.0.0.1:8001/blog/announcementnew3/',
+               u'short_url': u'/blog/announcementnew3/',
+               u'tags': u'',
+               u'excerpt': u'announcement..new.announcement..new.',
+               u'allow_comments': True,
+               u'comments': [],
+               u'slug': u'announcementnew3',
+               u'content': u'<p>announcement..new.announcement..new.</p>',
+               u'publish_date': u'2017-01-16T19:53:52Z',
+               u'user': {u'username': u'al942u',
+                         u'first_name': u'',
+                         u'last_name': u'',
+                         u'email': u'al942u@mail.com',
+                         u'is_staff': True,
+                         u'id': 1},
+               u'featured_image': u'',
+               u'comments_count': 0,
+               u'id': 3,
+               u'categories': [{u'slug': u'announcement',
+                                u'id': 1,
+                                u'title': u'Announcement'}]},
+              {u'updated': u'2017-01-14T15:57:19.567778Z',
+               u'title': u'news..new.1',
+               u'url': u'http://127.0.0.1:8001/blog/news1/',
+               u'short_url': u'/blog/news1/',
+               u'tags': u'',
+               u'excerpt': u'news..new.news..new.',
+               u'allow_comments': True,
+               u'comments': [],
+               u'slug': u'news1',
+               u'content': u'<p>news..new.news..new.</p>',
+               u'publish_date': u'2017-01-14T19:53:52Z',
+               u'user': {u'username': u'al942u',
+                         u'first_name': u'',
+                         u'last_name': u'',
+                         u'email': u'al942u@mail.com',
+                         u'is_staff': True,
+                         u'id': 1},
+               u'featured_image': u'',
+               u'comments_count': 0,
+               u'id': 4,
+               u'categories': [{u'slug': u'news',
+                                u'id': 1,
+                                u'title': u'News'}]},
+              {u'updated': u'2017-01-13T15:57:19.567778Z',
+               u'title': u'news..new.2',
+               u'url': u'http://127.0.0.1:8001/blog/news2/',
+               u'short_url': u'/blog/news2/',
+               u'tags': u'',
+               u'excerpt': u'news..new.news..new.',
+               u'allow_comments': True,
+               u'comments': [],
+               u'slug': u'news2',
+               u'content': u'<p>news..new.news..new.</p>',
+               u'publish_date': u'2017-01-15T19:53:52Z',
+               u'user': {u'username': u'al942u',
+                         u'first_name': u'',
+                         u'last_name': u'',
+                         u'email': u'al942u@mail.com',
+                         u'is_staff': True,
+                         u'id': 1},
+               u'featured_image': u'',
+               u'comments_count': 0,
+               u'id': 5,
+               u'categories': [{u'slug': u'news',
+                                u'id': 1,
+                                u'title': u'News'}]},
+              {u'updated': u'2017-01-12T15:57:19.567778Z',
+               u'title': u'news..new.3',
+               u'url': u'http://127.0.0.1:8001/blog/news3/',
+               u'short_url': u'/blog/news3/',
+               u'tags': u'',
+               u'excerpt': u'news..new.news..new.',
+               u'allow_comments': True,
+               u'comments': [],
+               u'slug': u'news3',
+               u'content': u'<p>news..new.news..new.</p>',
+               u'publish_date': u'2017-01-16T19:53:52Z',
+               u'user': {u'username': u'al942u',
+                         u'first_name': u'',
+                         u'last_name': u'',
+                         u'email': u'al942u@mail.com',
+                         u'is_staff': True,
+                         u'id': 1},
+               u'featured_image': u'',
+               u'comments_count': 0,
+               u'id': 6,
+               u'categories': [{u'slug': u'news',
+                                u'id': 1,
+                                u'title': u'News'}]}]
 
     if category == "News":
         return [result[3], result[4], result[5]]
@@ -77,10 +205,16 @@ class CMSGetPostsTestCase(TestBaseEntity):
     def childSetup(self):
         self.createVendors([Constants.service_provider_company_name, 'Other'])
         self.createDefaultRoles()
-        self.admin, self.el, self.standard_user = self.creator.createAndGetDefaultRoles()
-        self.user = self.creator.createUser(Vendor.objects.get(name='Other'),
-                                            self.randomGenerator("main-vendor-email"), 'Aa123456',
-                                            'user', self.standard_user, True)
+        self.admin, self.el, self.standard_user = \
+            self.creator.createAndGetDefaultRoles()
+        self.user = self.creator.createUser(
+            Vendor.objects.get(
+                name='Other'),
+            self.randomGenerator("main-vendor-email"),
+            'Aa123456',
+            'user',
+            self.standard_user,
+            True)
         self.token = self.loginAndCreateSessionToken(self.user)
 
     def testGetPostsByCategory(self):
@@ -88,17 +222,20 @@ class CMSGetPostsTestCase(TestBaseEntity):
         print(urlStr)
         self.printTestName("GetPostsByCategoryTest [Start]")
         logger.debug("action should success (200), and return filtered posts")
-        response = self.c.get(urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
+        response = self.c.get(
+            urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
-        self.assertEqual(len(json.loads(response.content)), 3)  # Suppose to be 3 The amount of News in the mock.
+        # Suppose to be 3 The amount of News in the mock.
+        self.assertEqual(len(json.loads(response.content)), 3)
         self.printTestName("GetPostsByCategoryTest [End]")
 
     def testGetAllPosts(self):
         urlStr = self.urlPrefix + 'cms/posts/?limit=10'
         self.printTestName("GetAllPostsTest [Start]")
         logger.debug("action should success (200), and return all posts")
-        response = self.c.get(urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
+        response = self.c.get(
+            urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
         # Suppose to be 6 items like the amount of items of the mock.
@@ -109,29 +246,37 @@ class CMSGetPostsTestCase(TestBaseEntity):
         limit = 2
         urlStr = self.urlPrefix + 'cms/posts/?limit=' + str(limit)
         self.printTestName("GetLimitedPostsTest [Start]")
-        logger.debug("action should success (200), and filtered with limit all posts")
-        response = self.c.get(urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
+        logger.debug(
+            "action should success (200), and filtered with limit all posts")
+        response = self.c.get(
+            urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
-        self.assertEqual(len(json.loads(response.content)), limit)  # Suppose to be {{limit}} amount of items
+        # Suppose to be {{limit}} amount of items
+        self.assertEqual(len(json.loads(response.content)), limit)
         self.printTestName("GetLimitedPostsTest [End]")
 
     def testGetPostsByDateMin(self):
         urlStr = self.urlPrefix + 'cms/posts/?fromLastDays=2&limit=10'
         self.printTestName("GetPostsByDateMinTest [Start]")
         logger.debug("action should success (200), and return filtered posts")
-        response = self.c.get(urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
+        response = self.c.get(
+            urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
-        self.assertEqual(len(json.loads(response.content)), 2)  # Suppose to be 2 items that are after this date
+        # Suppose to be 2 items that are after this date
+        self.assertEqual(len(json.loads(response.content)), 2)
         self.printTestName("GetPostsByDateMinTest [End]")
 
     def testGetOneAnnouncementPost(self):
         urlStr = self.urlPrefix + 'cms/posts/?limit=1&category=Announcement'
         self.printTestName("GetOneAnnouncementPostTest [Start]")
-        logger.debug("action should success (200), and return one announcement post")
-        response = self.c.get(urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
+        logger.debug(
+            "action should success (200), and return one announcement post")
+        response = self.c.get(
+            urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
-        self.assertEqual(len(json.loads(response.content)), 1)  # Suppose to be just 1 item like that.
+        # Suppose to be just 1 item like that.
+        self.assertEqual(len(json.loads(response.content)), 1)
         self.printTestName("GetOneAnnouncementPostTest [End]")
index ddfb448..a81d7e6 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -52,19 +52,35 @@ class DeploymentTargetSitesTestCase(TestBaseEntity):
         self.createDefaultRoles()
 
         # Create users:
-        self.admin, self.el, self.standard_user = self.creator.createAndGetDefaultRoles()
-        self.el_user = self.creator.createUser(Vendor.objects.get(name=Constants.service_provider_company_name),
-                                               self.randomGenerator("main-vendor-email"), 'Aa123456',
-                                               'el user1', self.el, True)
+        self.admin, self.el, self.standard_user = \
+            self.creator.createAndGetDefaultRoles()
+        self.el_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            'Aa123456',
+            'el user1',
+            self.el,
+            True)
         self.peer_reviewer = self.creator.createUser(Vendor.objects.get(
             name='Other'), self.randomGenerator("main-vendor-email"),
             '55501000199', 'peer-reviewer user', self.el, True)
-        self.user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"), 'Aa123456',
-                                            'user', self.standard_user, True)
-        self.admin_user = self.creator.createUser(Vendor.objects.get(name=Constants.service_provider_company_name),
-                                                  Constants.service_provider_admin_mail, 'Aa123456',
-                                                  'admin user', self.admin, True)
+        self.user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            'Aa123456',
+            'user',
+            self.standard_user,
+            True)
+        self.admin_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            Constants.service_provider_admin_mail,
+            'Aa123456',
+            'admin user',
+            self.admin,
+            True)
 
         # Create an Engagement with team
         self.engagement = self.creator.createEngagement(
@@ -73,11 +89,17 @@ class DeploymentTargetSitesTestCase(TestBaseEntity):
         self.engagement.peer_reviewer = self.peer_reviewer
         self.engagement.engagement_team.add(self.user, self.el_user)
         self.engagement.save()
-        self.deploymentTarget = self.creator.createDeploymentTarget(self.randomGenerator("randomString"),
-                                                                    self.randomGenerator("randomString"))
-        self.vendor = Vendor.objects.get(name=Constants.service_provider_company_name)
-        self.vf = self.creator.createVF(self.randomGenerator("randomString"), self.engagement,
-                                        self.deploymentTarget, False, self.vendor)
+        self.deploymentTarget = self.creator.createDeploymentTarget(
+            self.randomGenerator("randomString"),
+            self.randomGenerator("randomString"))
+        self.vendor = Vendor.objects.get(
+            name=Constants.service_provider_company_name)
+        self.vf = self.creator.createVF(
+            self.randomGenerator("randomString"),
+            self.engagement,
+            self.deploymentTarget,
+            False,
+            self.vendor)
 
         # Login with users:
         self.user_token = self.loginAndCreateSessionToken(self.user)
@@ -91,8 +113,11 @@ class DeploymentTargetSitesTestCase(TestBaseEntity):
             str(self.vf.uuid) + '"}'
         print(myjson)
 
-        response = self.c.post(urlStr, myjson, content_type='application/json',
-                               **{'HTTP_AUTHORIZATION': "token " + self.user_token})
+        response = self.c.post(
+            urlStr,
+            myjson,
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.user_token})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_401_UNAUTHORIZED)
 
@@ -103,8 +128,11 @@ class DeploymentTargetSitesTestCase(TestBaseEntity):
             str(self.vf.uuid) + '"}'
         print(myjson)
 
-        response = self.c.post(urlStr, myjson, content_type='application/json',
-                               **{'HTTP_AUTHORIZATION': "token " + self.el_token})
+        response = self.c.post(
+            urlStr,
+            myjson,
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.el_token})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
 
@@ -115,8 +143,11 @@ class DeploymentTargetSitesTestCase(TestBaseEntity):
             str(self.vf.uuid) + '"}'
         print(myjson)
 
-        response = self.c.post(urlStr, myjson, content_type='application/json',
-                               **{'HTTP_AUTHORIZATION': "token " + self.admin_token})
+        response = self.c.post(
+            urlStr,
+            myjson,
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.admin_token})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
 
index b3e75df..cba67aa 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
 import json
 import mock
 from rest_framework.status import HTTP_202_ACCEPTED
-from engagementmanager.bus.messages.activity_event_message import ActivityEventMessage
-from engagementmanager.bus.messages.daily_scheduled_message import DailyScheduledMessage
+from engagementmanager.bus.messages.activity_event_message import \
+    ActivityEventMessage
+from engagementmanager.bus.messages.daily_scheduled_message import \
+    DailyScheduledMessage
 from engagementmanager.models import Vendor
-from engagementmanager.utils.activities_data import UserJoinedEngagementActivityData
+from engagementmanager.utils.activities_data import \
+    UserJoinedEngagementActivityData
 from engagementmanager.tests.test_base_entity import TestBaseEntity
 from engagementmanager.utils.constants import Constants, EngagementStage
 from engagementmanager.apps import bus_service
@@ -67,14 +70,30 @@ class DigestEmailNotificationsTestCase(TestBaseEntity):
         self.createVendors([Constants.service_provider_company_name, 'Other'])
 
         self.createDefaultRoles()
-        vendor = Vendor.objects.get(name=Constants.service_provider_company_name)
-        self.el_user = self.creator.createUser(vendor, self.randomGenerator(
-            "main-vendor-email"), self.randomGenerator("randomNumber"), self.randomGenerator("randomString"), self.el, True)
+        vendor = Vendor.objects.get(
+            name=Constants.service_provider_company_name)
+        self.el_user = self.creator.createUser(
+            vendor,
+            self.randomGenerator("main-vendor-email"),
+            self.randomGenerator("randomNumber"),
+            self.randomGenerator("randomString"),
+            self.el,
+            True)
         vendor = Vendor.objects.get(name='Other')
-        self.user = self.creator.createUser(vendor, self.randomGenerator("email"), self.randomGenerator(
-            "randomNumber"), self.randomGenerator("randomString"), self.standard_user, True)
-        self.pruser = self.creator.createUser(vendor, self.randomGenerator("email"), self.randomGenerator(
-            "randomNumber"), self.randomGenerator("randomString"), self.standard_user, True)
+        self.user = self.creator.createUser(
+            vendor,
+            self.randomGenerator("email"),
+            self.randomGenerator("randomNumber"),
+            self.randomGenerator("randomString"),
+            self.standard_user,
+            True)
+        self.pruser = self.creator.createUser(
+            vendor,
+            self.randomGenerator("email"),
+            self.randomGenerator("randomNumber"),
+            self.randomGenerator("randomString"),
+            self.standard_user,
+            True)
 
         self.engagement = self.creator.createEngagement(self.randomGenerator(
             "randomString"), self.randomGenerator("randomString"), None)
@@ -84,22 +103,32 @@ class DigestEmailNotificationsTestCase(TestBaseEntity):
         self.engagement.save()
 
         self.deploymentTarget = self.creator.createDeploymentTarget(
-            self.randomGenerator("randomString"), self.randomGenerator("randomString"))
-        self.vf = self.creator.createVF(self.randomGenerator("randomString"),
-                                        self.engagement, self.deploymentTarget, False, vendor)
+            self.randomGenerator("randomString"),
+            self.randomGenerator("randomString"))
+        self.vf = self.creator.createVF(
+            self.randomGenerator("randomString"),
+            self.engagement,
+            self.deploymentTarget,
+            False,
+            vendor)
 
     def testDigestEmailForActivities(self):
         """
-        Will check if the service bus deliver the message of sending digested mails
-        No need to check if the mail is sent or if the python scheduling is working
+        Will check if the service bus deliver the
+        message of sending digested mails
+        No need to check if the mail is sent or if the
+        python scheduling is working
         """
         # Create the activities:
-        self.urlStr = self.urlPrefix + "single-engagement/" + str(self.engagement.uuid) + "/stage/@stage"
+        self.urlStr = self.urlPrefix + "single-engagement/" + \
+            str(self.engagement.uuid) + "/stage/@stage"
 
         random_user = self.creator.createUser(Vendor.objects.get(name='Other'),
                                               self.randomGenerator("email"),
-                                              self.randomGenerator("randomNumber"),
-                                              self.randomGenerator("randomString"),
+                                              self.randomGenerator(
+                                                  "randomNumber"),
+                                              self.randomGenerator(
+                                                  "randomString"),
                                               self.el, True)
 
         self.engagement.engagement_team.add(random_user)
@@ -107,18 +136,22 @@ class DigestEmailNotificationsTestCase(TestBaseEntity):
 
         users_list = []
         users_list.append(random_user)
-        activity_data = UserJoinedEngagementActivityData(self.vf, users_list, self.engagement)
+        activity_data = UserJoinedEngagementActivityData(
+            self.vf, users_list, self.engagement)
         bus_service.send_message(ActivityEventMessage(activity_data))
 
         token = self.loginAndCreateSessionToken(random_user)
-        response = self.c.put(self.urlStr.replace("@stage", EngagementStage.Active.name),
-                              json.dumps(dict(), ensure_ascii=False), content_type='application/json',
+        response = self.c.put(self.urlStr.replace("@stage",
+                                                  EngagementStage.Active.name),
+                              json.dumps(dict(),
+                                         ensure_ascii=False),
+                              content_type='application/json',
                               **{'HTTP_AUTHORIZATION': "token " + token})
         self.assertEqual(response.status_code, HTTP_202_ACCEPTED)
 
         urlStr = self.urlPrefix + 'engagement/${uuid}/activities/'
-        response = self.c.get(urlStr.replace('${uuid}', str(self.engagement.uuid)),
-                              **{'HTTP_AUTHORIZATION': "token " + token})
+        response = self.c.get(urlStr.replace('${uuid}', str(
+            self.engagement.uuid)), **{'HTTP_AUTHORIZATION': "token " + token})
         content = json.loads(response.content)
         self.assertEqual(len(content), 2)
 
index 563c3cd..49ee024 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -36,7 +36,8 @@
 # ============LICENSE_END============================================
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
-from rest_framework.status import HTTP_401_UNAUTHORIZED, HTTP_202_ACCEPTED, HTTP_500_INTERNAL_SERVER_ERROR
+from rest_framework.status import HTTP_401_UNAUTHORIZED, \
+    HTTP_202_ACCEPTED, HTTP_500_INTERNAL_SERVER_ERROR
 from engagementmanager.models import Vendor
 from engagementmanager.tests.test_base_entity import TestBaseEntity
 from engagementmanager.utils.constants import Constants
@@ -50,12 +51,18 @@ class EngProgressTestCase(TestBaseEntity):
     def childSetup(self):  # Variables to use in this class.
         self.createVendors([Constants.service_provider_company_name, 'Other'])
         self.createDefaultRoles()
-        self.admin, self.el, self.standard_user = self.creator.createAndGetDefaultRoles()
+        self.admin, self.el, self.standard_user = \
+            self.creator.createAndGetDefaultRoles()
 
         # Create a user with role el
-        self.el_user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'el user', self.el, True)
+        self.el_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'el user',
+            self.el,
+            True)
         self.peer_reviewer = self.creator.createUser(Vendor.objects.get(
             name='Other'), self.randomGenerator("main-vendor-email"),
             '55501000199', 'peer-reviewer user', self.el, True)
@@ -80,19 +87,29 @@ class EngProgressTestCase(TestBaseEntity):
         self.printTestName("START")
 
         logger.debug(
-            "action should fail (401), Only Engagement Lead can set Engagement Progress")
-        response = self.c.put(urlStr, '{ "progress" : 50 }', content_type='application/json',
-                              **{'HTTP_AUTHORIZATION': "token " + self.token})
+            "action should fail (401), Only Engagement \
+            Lead can set Engagement Progress")
+        response = self.c.put(
+            urlStr,
+            '{ "progress" : 50 }',
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.token})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_401_UNAUTHORIZED)
 
-        response = self.c.put(urlStr, '{ "progress" : 50 }', content_type='application/json',
-                              **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        response = self.c.put(
+            urlStr,
+            '{ "progress" : 50 }',
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_202_ACCEPTED)
 
-        response = self.c.put(urlStr, '{ "progress" : 101 }', content_type='application/json',
-                              **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        response = self.c.put(
+            urlStr,
+            '{ "progress" : 101 }',
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_500_INTERNAL_SERVER_ERROR)
 
index 62f787d..9536a3e 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -52,15 +52,26 @@ class EngagementStatusTestCase(TestBaseEntity):
     def childSetup(self):  # Variables to use in this class.
         self.createVendors([Constants.service_provider_company_name, 'Other'])
         self.createDefaultRoles()
-        self.admin, self.el, self.standard_user = self.creator.createAndGetDefaultRoles()
+        self.admin, self.el, self.standard_user = \
+            self.creator.createAndGetDefaultRoles()
 
         # Create a user with role el
-        self.el_user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'el user', self.el, True)
-        self.peer_review_user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'peer-reviewer user', self.el, True)
+        self.el_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'el user',
+            self.el,
+            True)
+        self.peer_review_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'peer-reviewer user',
+            self.el,
+            True)
         # Create a user with role standard_user
         self.user = self.creator.createUser(Vendor.objects.get(
             name='Other'), self.randomGenerator("main-vendor-email"),
@@ -69,19 +80,25 @@ class EngagementStatusTestCase(TestBaseEntity):
             name='Other'), self.randomGenerator("main-vendor-email"),
             '55501000199', 'user not team', self.standard_user, True)
         # Create an Engagement with team
-        self.engagement = self.creator.createEngagement(uuid4(), 'Validation', None)
+        self.engagement = self.creator.createEngagement(
+            uuid4(), 'Validation', None)
         self.engagement.engagement_team.add(self.user, self.el_user)
         self.engagement.reviewer = self.el_user
         self.engagement.peer_reviewer = self.peer_review_user
         self.engagement.save()
         self.token = self.loginAndCreateSessionToken(self.user)
         self.ELtoken = self.loginAndCreateSessionToken(self.el_user)
-        self.user_not_team_token = self.loginAndCreateSessionToken(self.user_not_team)
+        self.user_not_team_token = self.loginAndCreateSessionToken(
+            self.user_not_team)
 
         urlStr = self.urlPrefix + 'engagements/${uuid}/status'
         myjson = json.dumps({"description": "blah blah"}, ensure_ascii=False)
-        response = self.c.post(urlStr.replace('${uuid}', str(self.engagement.uuid)), myjson,
-                               content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        response = self.c.post(
+            urlStr.replace(
+                '${uuid}', str(
+                    self.engagement.uuid)), myjson,
+            content_type='application/json', **{
+                'HTTP_AUTHORIZATION': "token " + self.ELtoken})
         self.created_status = json.loads(response.content)
 
     def testPutStatus(self):
@@ -89,19 +106,34 @@ class EngagementStatusTestCase(TestBaseEntity):
 
         self.printTestName("START - testPutStatus")
 
-        logger.debug("action should fail (401), Only Engagement Lead can set Engagement Progress")
+        logger.debug(
+            "action should fail (401), Only \
+            Engagement Lead can set Engagement Progress")
 
         myjson = json.dumps(
-            {"eng_status_uuid": self.created_status['uuid'], "description": "blah2 blah2"}, ensure_ascii=False)
-        response = self.c.put(urlStr.replace('${uuid}', str(self.engagement.uuid)), myjson,
-                              content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.token})
+            {
+                "eng_status_uuid": self.created_status['uuid'],
+                "description": "blah2 blah2"},
+            ensure_ascii=False)
+        response = self.c.put(urlStr.replace('${uuid}',
+                                             str(self.engagement.uuid)),
+                              myjson,
+                              content_type='application/json',
+                              **{'HTTP_AUTHORIZATION': "token " + self.token})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_401_UNAUTHORIZED)
 
         myjson = json.dumps(
-            {"eng_status_uuid": self.created_status['uuid'], "description": "blah2 blah2"}, ensure_ascii=False)
-        response = self.c.put(urlStr.replace('${uuid}', str(self.engagement.uuid)), myjson,
-                              content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+            {
+                "eng_status_uuid": self.created_status['uuid'],
+                "description": "blah2 blah2"},
+            ensure_ascii=False)
+        response = self.c.put(
+            urlStr.replace(
+                '${uuid}', str(
+                    self.engagement.uuid)), myjson,
+            content_type='application/json', **{
+                'HTTP_AUTHORIZATION': "token " + self.ELtoken})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
 
@@ -112,24 +144,36 @@ class EngagementStatusTestCase(TestBaseEntity):
 
         self.printTestName("START - testPostStatus")
 
-        logger.debug("action should fail (401), Only Engagement Lead can set Engagement Progress")
+        logger.debug(
+            "action should fail (401), Only Engagement \
+            Lead can set Engagement Progress")
 
         myjson = json.dumps({"description": "blah blah"}, ensure_ascii=False)
-        response = self.c.post(urlStr.replace('${uuid}', str(self.engagement.uuid)), myjson,
-                               content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.token})
+        response = self.c.post(urlStr.replace('${uuid}',
+                                              str(self.engagement.uuid)),
+                               myjson,
+                               content_type='application/json',
+                               **{'HTTP_AUTHORIZATION': "token " + self.token})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_401_UNAUTHORIZED)
 
         logger.debug("action should fail (400), For fake engagement uuid")
         myjson = json.dumps({"description": "blah blah"}, ensure_ascii=False)
-        response = self.c.post(urlStr.replace(
-            '${uuid}', str(uuid4())), myjson, content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        response = self.c.post(
+            urlStr.replace(
+                '${uuid}', str(
+                    uuid4())), myjson, content_type='application/json', **{
+                'HTTP_AUTHORIZATION': "token " + self.ELtoken})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_401_UNAUTHORIZED)
 
         myjson = json.dumps({"description": "blah blah"}, ensure_ascii=False)
-        response = self.c.post(urlStr.replace('${uuid}', str(self.engagement.uuid)), myjson,
-                               content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        response = self.c.post(
+            urlStr.replace(
+                '${uuid}', str(
+                    self.engagement.uuid)), myjson,
+            content_type='application/json', **{
+                'HTTP_AUTHORIZATION': "token " + self.ELtoken})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
 
@@ -140,21 +184,30 @@ class EngagementStatusTestCase(TestBaseEntity):
 
         self.printTestName("START - testGetStatus")
 
-        response = self.c.get(urlStr.replace('${uuid}', str(self.engagement.uuid)),
-                              content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.token})
+        response = self.c.get(urlStr.replace('${uuid}',
+                                             str(self.engagement.uuid)),
+                              content_type='application/json',
+                              **{'HTTP_AUTHORIZATION': "token " + self.token})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
 
-        logger.debug("action should fail (401), Only team members can get status")
+        logger.debug(
+            "action should fail (401), Only team members can get status")
 
-        response = self.c.get(urlStr.replace('${uuid}', str(
-            self.engagement.uuid)), content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.user_not_team_token})
+        response = self.c.get(
+            urlStr.replace(
+                '${uuid}',
+                str(self.engagement.uuid)),
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.user_not_team_token})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_401_UNAUTHORIZED)
 
-        logger.debug("action should fail (401), Only existing eng_uuid cab ne fetched")
+        logger.debug(
+            "action should fail (401), Only existing eng_uuid cab ne fetched")
         response = self.c.get(urlStr.replace('${uuid}', str(
-            uuid4())), content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.token})
+            uuid4())), content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.token})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_401_UNAUTHORIZED)
 
index a50e49f..22e23b2 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -36,8 +36,8 @@
 # ============LICENSE_END============================================
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
-from engagementmanager.models import Vendor, Engagement, IceUserProfile, \
-    Checklist
+from engagementmanager.models import Engagement, IceUserProfile, \
+    Checklist, Vendor
 from engagementmanager.tests.test_base_entity import TestBaseEntity
 from engagementmanager.utils.constants import EngagementStage, Constants
 from rest_framework.status import HTTP_200_OK, HTTP_401_UNAUTHORIZED
@@ -52,23 +52,44 @@ class EngagementAdminOperationsTestCase(TestBaseEntity):
     def childSetup(self):
         self.createVendors([Constants.service_provider_company_name, 'Other'])
         self.createDefaultRoles()
-        self.admin, self.el, self.standard_user = self.creator.createAndGetDefaultRoles()
-        self.el_user = self.creator.createUser(Vendor.objects.get(name=Constants.service_provider_company_name),
-                                               self.randomGenerator("main-vendor-email"), '55501000199',
-                                               'el user', self.el, True)
-        self.second_el_user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"), '55501000199',
-                                                      'el user2', self.el, True)
+        self.admin, self.el, self.standard_user = \
+            self.creator.createAndGetDefaultRoles()
+        self.el_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'el user',
+            self.el,
+            True)
+        self.second_el_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'el user2',
+            self.el,
+            True)
         self.el_user_to_update = self.creator.createUser(
             Vendor.objects.get(name=Constants.service_provider_company_name),
             self.randomGenerator("main-vendor-email"), '55501000199',
             'el user 3', self.el, True)
-        self.user = self.creator.createUser(Vendor.objects.get(name='Other'),
-                                            self.randomGenerator("main-vendor-email"), '55501000199',
-                                            'user', self.standard_user, True)
-        self.admin_user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), Constants.service_provider_admin_mail, '55501000199',
-                                                  'admin user', self.admin, True)
+        self.user = self.creator.createUser(
+            Vendor.objects.get(
+                name='Other'),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'user',
+            self.standard_user,
+            True)
+        self.admin_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            Constants.service_provider_admin_mail,
+            '55501000199',
+            'admin user',
+            self.admin,
+            True)
 
         self.engagement = self.creator.createEngagement(
             'just-a-fake-uuid', 'Validation', None)
@@ -78,10 +99,16 @@ class EngagementAdminOperationsTestCase(TestBaseEntity):
         self.engagement.peer_reviewer = self.second_el_user
         self.engagement.save()
         # Create a VF
-        self.deploymentTarget = self.creator.createDeploymentTarget(self.randomGenerator("randomString"),
-                                                                    self.randomGenerator("randomString"))
-        self.vf = self.creator.createVF(self.randomGenerator("randomString"), self.engagement, self.deploymentTarget,
-                                        False, Vendor.objects.get(name='Other'))
+        self.deploymentTarget = self.creator.createDeploymentTarget(
+            self.randomGenerator("randomString"),
+            self.randomGenerator("randomString"))
+        self.vf = self.creator.createVF(
+            self.randomGenerator("randomString"),
+            self.engagement,
+            self.deploymentTarget,
+            False,
+            Vendor.objects.get(
+                name='Other'))
 
         self.userToken = self.loginAndCreateSessionToken(self.user)
         self.elToken = self.loginAndCreateSessionToken(self.el_user)
@@ -95,7 +122,8 @@ class EngagementAdminOperationsTestCase(TestBaseEntity):
         print(urlStr)
         self.printTestName("testGetAllEls [Start]")
         logger.debug(
-            "action should success (200), and return all els exists in the system")
+            "action should success (200), and return \
+            all els exists in the system")
         response = self.c.get(
             urlStr, **{'HTTP_AUTHORIZATION': "token " + self.adminToken})
         print('Got response : ' + str(response.status_code))
@@ -115,8 +143,11 @@ class EngagementAdminOperationsTestCase(TestBaseEntity):
         print(urlStr)
         self.printTestName("testArchiveEngagement [Start]")
         logger.debug("action should success (202), and archive the engagement")
-        response = self.c.put(urlStr, json.dumps({'reason': 'test_reason'}), content_type='application/json',
-                              **{'HTTP_AUTHORIZATION': "token " + self.adminToken})
+        response = self.c.put(
+            urlStr,
+            json.dumps({'reason': 'test_reason'}),
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.adminToken})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
 
@@ -133,8 +164,11 @@ class EngagementAdminOperationsTestCase(TestBaseEntity):
         print(urlStr)
         self.printTestName("testArchiveEngagement [Start]")
         logger.debug("action should success (202), and archive the engagement")
-        response = self.c.put(urlStr, json.dumps({'reason': 'test_reason'}), content_type='application/json',
-                              **{'HTTP_AUTHORIZATION': "token " + self.adminToken})
+        response = self.c.put(
+            urlStr,
+            json.dumps({'reason': 'test_reason'}),
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.adminToken})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
 
@@ -152,8 +186,11 @@ class EngagementAdminOperationsTestCase(TestBaseEntity):
         self.printTestName("testSetEngagementReviewer [Start]")
         logger.debug(
             "action should success (200), and set the engagement reviewer")
-        response = self.c.put(urlStr, json.dumps({'reviewer': str(self.el_user_to_update.uuid)}), content_type='application/json',
-                              **{'HTTP_AUTHORIZATION': "token " + self.adminToken})
+        response = self.c.put(
+            urlStr,
+            json.dumps({'reviewer': str(self.el_user_to_update.uuid)}),
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.adminToken})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
 
@@ -168,9 +205,13 @@ class EngagementAdminOperationsTestCase(TestBaseEntity):
         print(urlStr)
         self.printTestName("testSetEngagementPeerReviewer [Start]")
         logger.debug(
-            "action should success (200), and set the engagement peer reviewer")
-        response = self.c.put(urlStr, json.dumps({'peerreviewer': str(self.el_user_to_update.uuid)}), content_type='application/json',
-                              **{'HTTP_AUTHORIZATION': "token " + self.adminToken})
+            "action should success (200), and set the \
+            engagement peer reviewer")
+        response = self.c.put(
+            urlStr,
+            json.dumps({'peerreviewer': str(self.el_user_to_update.uuid)}),
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.adminToken})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
 
@@ -196,8 +237,11 @@ class EngagementAdminOperationsTestCase(TestBaseEntity):
         print(urlStr)
         self.printTestName("testNegativeArchiveEngagement [Start]")
         logger.debug("action should failed due to missing permissions (401)")
-        response = self.c.put(urlStr, json.dumps({'reason': 'test_reason'}), content_type='application/json',
-                              **{'HTTP_AUTHORIZATION': "token " + self.elToken})
+        response = self.c.put(
+            urlStr,
+            json.dumps({'reason': 'test_reason'}),
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.elToken})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_401_UNAUTHORIZED)
         self.printTestName("testNegativeArchiveEngagement [End]")
@@ -208,8 +252,11 @@ class EngagementAdminOperationsTestCase(TestBaseEntity):
         print(urlStr)
         self.printTestName("testNegativeSetEngagementReviewer [Start]")
         logger.debug("action should failed due to missing permissions (401)")
-        response = self.c.put(urlStr, json.dumps({'reviewer': str(self.el_user_to_update.uuid)}), content_type='application/json',
-                              **{'HTTP_AUTHORIZATION': "token " + self.elToken})
+        response = self.c.put(
+            urlStr,
+            json.dumps({'reviewer': str(self.el_user_to_update.uuid)}),
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.elToken})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_401_UNAUTHORIZED)
         self.printTestName("testNegativeSetEngagementReviewer [End]")
@@ -220,8 +267,11 @@ class EngagementAdminOperationsTestCase(TestBaseEntity):
         print(urlStr)
         self.printTestName("testNegativeSetEngagementPeerReviewer [Start]")
         logger.debug("action should failed due to missing permissions (401)")
-        response = self.c.put(urlStr, json.dumps({'peerreviewer': str(self.el_user_to_update.uuid)}), content_type='application/json',
-                              **{'HTTP_AUTHORIZATION': "token " + self.elToken})
+        response = self.c.put(
+            urlStr,
+            json.dumps({'peerreviewer': str(self.el_user_to_update.uuid)}),
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.elToken})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_401_UNAUTHORIZED)
         self.printTestName("testNegativeSetEngagementPeerReviewer [End]")
@@ -232,11 +282,19 @@ class EngagementAdminOperationsTestCase(TestBaseEntity):
         print(urlStr)
         self.printTestName("testSetEngagementReviewer [Start]")
         logger.debug(
-            "action should success (200), and switch between the engagement reviewer and peer reviewer")
+            "action should success (200), and switch between the engagement \
+            reviewer and peer reviewer")
         logger.debug("Reviewer: %s, PeerReviewer: %s" %
-                     (self.engagement.reviewer, self.engagement.peer_reviewer))
-        response = self.c.put(urlStr, json.dumps({'reviewer': str(self.second_el_user.uuid), 'peerreviewer': str(
-            self.el_user.uuid)}), content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.adminToken})
+                     (self.engagement.reviewer,
+                      self.engagement.peer_reviewer))
+        response = self.c.put(urlStr,
+                              json.dumps({'reviewer':
+                                          str(self.second_el_user.uuid),
+                                          'peerreviewer':
+                                          str(self.el_user.uuid)}),
+                              content_type='application/json',
+                              **{'HTTP_AUTHORIZATION': "token "
+                                 + self.adminToken})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
 
@@ -259,9 +317,14 @@ class EngagementAdminOperationsTestCase(TestBaseEntity):
             "cl-name", "review", 1, None, self.engagement, cl_template,
             self.admin_user, self.el_user)
         logger.debug(
-            "action should success (200), set the engagement reviewer and change checklist owner")
-        response = self.c.put(urlStr, json.dumps({'reviewer': str(self.el_user_to_update.uuid)}), content_type='application/json',
-                              **{'HTTP_AUTHORIZATION': "token " + self.adminToken})
+            "action should success (200), set the engagement reviewer \
+            and change checklist owner")
+        response = self.c.put(urlStr,
+                              json.dumps({'reviewer':
+                                          str(self.el_user_to_update.uuid)}),
+                              content_type='application/json',
+                              **{'HTTP_AUTHORIZATION': "token "
+                                 + self.adminToken})
         print('Got response : ' + str(response.status_code))
         checklist = Checklist.objects.get(uuid=checklist.uuid)
         self.assertEqual(checklist.owner, self.el_user_to_update)
@@ -271,15 +334,21 @@ class EngagementAdminOperationsTestCase(TestBaseEntity):
         urlStr = self.urlPrefix + 'engagements/' + \
             str(self.engagement.uuid) + '/peerreviewer/'
         print(urlStr)
-        self.printTestName("testChecklistOwnerAfterChangePeerReviewer [Start]")
+        self.printTestName("testChecklistOwnerAfterChangePeerReviewer \
+        [Start]")
         cl_template = self.creator.createDefaultCheckListTemplate()
         checklist = self.creator.createCheckList(
             "cl-name", "peer_review", 1, None, self.engagement, cl_template,
             self.admin_user, self.second_el_user)
         logger.debug(
-            "action should success (200), set the engagement peer reviewer and change checklist owner")
-        response = self.c.put(urlStr, json.dumps({'peerreviewer': str(self.el_user_to_update.uuid)}), content_type='application/json',
-                              **{'HTTP_AUTHORIZATION': "token " + self.adminToken})
+            "action should success (200), set the engagement \
+            peer reviewer and change checklist owner")
+        response = self.c.put(urlStr,
+                              json.dumps({'peerreviewer':
+                                          str(self.el_user_to_update.uuid)}),
+                              content_type='application/json',
+                              **{'HTTP_AUTHORIZATION': "token "
+                                 + self.adminToken})
         print('Got response : ' + str(response.status_code))
         checklist = Checklist.objects.get(uuid=checklist.uuid)
         self.assertEqual(checklist.owner, self.el_user_to_update)
@@ -295,11 +364,18 @@ class EngagementAdminOperationsTestCase(TestBaseEntity):
             "cl-name", "review", 1, None, self.engagement, cl_template,
             self.admin_user, self.el_user)
         logger.debug(
-            "action should success (200), switch between the engagement reviewer and peer reviewer and change checklist owner")
+            "action should success (200), switch between the engagement \
+            reviewer and peer reviewer and change checklist owner")
         logger.debug("Reviewer: %s, PeerReviewer: %s" %
                      (self.engagement.reviewer, self.engagement.peer_reviewer))
-        response = self.c.put(urlStr, json.dumps({'reviewer': str(self.second_el_user.uuid), 'peerreviewer': str(
-            self.el_user.uuid)}), content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.adminToken})
+        response = self.c.put(urlStr,
+                              json.dumps({'reviewer':
+                                          str(self.second_el_user.uuid),
+                                          'peerreviewer':
+                                          str(self.el_user.uuid)}),
+                              content_type='application/json',
+                              **{'HTTP_AUTHORIZATION': "token "
+                                 + self.adminToken})
         print('Got response : ' + str(response.status_code))
         checklist = Checklist.objects.get(uuid=checklist.uuid)
         self.assertEqual(checklist.owner, self.second_el_user)
index 7438658..ec93330 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -39,7 +39,8 @@
 from rest_framework.status import HTTP_200_OK,\
     HTTP_500_INTERNAL_SERVER_ERROR
 from engagementmanager.models import Vendor, ECOMPRelease
-from engagementmanager.service.engagement_service import get_expanded_engs_for_export
+from engagementmanager.service.engagement_service \
+    import get_expanded_engs_for_export
 from engagementmanager.tests.test_base_entity import TestBaseEntity
 from engagementmanager.utils.constants import EngagementStage, Constants
 from engagementmanager.service.logging_service import LoggingServiceFactory
@@ -53,13 +54,19 @@ class EngagementExportTestCase(TestBaseEntity):
     def childSetup(self):
         self.createVendors([Constants.service_provider_company_name, 'Other'])
         self.createDefaultRoles()
-        self.admin, self.el, self.standard_user = self.creator.createAndGetDefaultRoles()
+        self.admin, self.el, self.standard_user = \
+            self.creator.createAndGetDefaultRoles()
         self.peer_reviewer = self.creator.createUser(Vendor.objects.get(
             name='Other'), self.randomGenerator("main-vendor-email"),
             '55501000199', 'peer-reviewer user', self.el, True)
-        self.admin = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), Constants.service_provider_admin_mail,
-            'Aa123456', 'admin user', self.el, True)
+        self.admin = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            Constants.service_provider_admin_mail,
+            'Aa123456',
+            'admin user',
+            self.el,
+            True)
         self.user = self.creator.createUser(Vendor.objects.get(
             name='Other'), self.randomGenerator("main-vendor-email"),
             'Aa123456', 'user', self.standard_user, True)
@@ -73,9 +80,15 @@ class EngagementExportTestCase(TestBaseEntity):
         self.engagement.engagement_stage = EngagementStage.Active.name
         self.engagement.save()
         self.deploymentTarget = self.creator.createDeploymentTarget(
-            self.randomGenerator("randomString"), self.randomGenerator("randomString"))
-        self.vf = self.creator.createVF(self.randomGenerator("randomString"), self.engagement,
-                                        self.deploymentTarget, False, Vendor.objects.get(name=Constants.service_provider_company_name))
+            self.randomGenerator("randomString"),
+            self.randomGenerator("randomString"))
+        self.vf = self.creator.createVF(
+            self.randomGenerator("randomString"),
+            self.engagement,
+            self.deploymentTarget,
+            False,
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name))
         self.vf.ecomp_release = ECOMPRelease.objects.create(
             uuid='uuid1', name='ActiveECOMPRelease')
         self.vf.save()
@@ -89,9 +102,15 @@ class EngagementExportTestCase(TestBaseEntity):
         self.engagement2.engagement_stage = EngagementStage.Intake.name
         self.engagement2.save()
         self.deploymentTarget = self.creator.createDeploymentTarget(
-            self.randomGenerator("randomString"), self.randomGenerator("randomString"))
-        self.vf2 = self.creator.createVF(self.randomGenerator("randomString"), self.engagement2,
-                                         self.deploymentTarget, False, Vendor.objects.get(name='Other'))
+            self.randomGenerator("randomString"),
+            self.randomGenerator("randomString"))
+        self.vf2 = self.creator.createVF(
+            self.randomGenerator("randomString"),
+            self.engagement2,
+            self.deploymentTarget,
+            False,
+            Vendor.objects.get(
+                name='Other'))
         self.vf2.ecomp_release = ECOMPRelease.objects.create(
             uuid='uuid2', name='IntakeECOMPRelease')
         self.vf2.save()
@@ -113,7 +132,8 @@ class EngagementExportTestCase(TestBaseEntity):
     def testSuccessExport(self):
         self.printTestName("Success export [start]")
 
-        if settings.DATABASES["default"]["ENGINE"] == "django.db.backends.sqlite3":
+        if settings.DATABASES["default"]["ENGINE"] == \
+                "django.db.backends.sqlite3":
             return
 
         urlStr = self.urlPrefix + 'engagement/export/?stage=Active&keyword'
@@ -158,8 +178,10 @@ class EngagementExportTestCase(TestBaseEntity):
         self.assertEqual(len(vfs) == 0, True)
 
         # Check overview sheet data procedure:
-        logger.debug("Check if the store procedure return data as expected (suppose to return 4 rows of overview "
-                     "sheet) and by that assume that it exists")
+        logger.debug(
+            "Check if the store procedure return data as expected \
+            (suppose to return 4 rows of overview "
+            "sheet) and by that assume that it exists")
         self.assertEqual(len(deployment_targets), 4)
 
         self.printTestName("Success export [end]")
index ec89d0b..de2a622 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -53,9 +53,15 @@ class testGetExpandedEngsAndSearch(TestBaseEntity):
 
         self.createDefaultRoles()
         # Create a user with role el
-        vendor = Vendor.objects.get(name=Constants.service_provider_company_name)
-        self.el_user = self.creator.createUser(vendor, self.randomGenerator(
-            "main-vendor-email"), self.randomGenerator("randomNumber"), self.randomGenerator("randomString"), self.el, True)
+        vendor = Vendor.objects.get(
+            name=Constants.service_provider_company_name)
+        self.el_user = self.creator.createUser(
+            vendor,
+            self.randomGenerator("main-vendor-email"),
+            self.randomGenerator("randomNumber"),
+            self.randomGenerator("randomString"),
+            self.el,
+            True)
         self.peer_reviewer = self.creator.createUser(Vendor.objects.get(
             name='Other'), self.randomGenerator("main-vendor-email"),
             '55501000199', 'peer-reviewer user', self.el, True)
@@ -67,16 +73,27 @@ class testGetExpandedEngsAndSearch(TestBaseEntity):
 
         # Create a user with role standard_user
         self.vendor = Vendor.objects.get(name='Other')
-        self.user = self.creator.createUser(self.vendor, "Johnny@d2ice.com", self.randomGenerator(
-            "randomNumber"), self.randomGenerator("randomString"), self.standard_user, True)
+        self.user = self.creator.createUser(
+            self.vendor,
+            "Johnny@d2ice.com",
+            self.randomGenerator("randomNumber"),
+            self.randomGenerator("randomString"),
+            self.standard_user,
+            True)
         print('-----------------------------------------------------')
         print('Created User:')
         print('UUID: ' + str(self.user.uuid))
         print('Full Name: ' + self.user.full_name)
         print('-----------------------------------------------------')
-        self.service_provider = Vendor.objects.get(name=Constants.service_provider_company_name)
-        self.peer_reviewer = self.creator.createUser(self.service_provider, self.randomGenerator(
-            "main-vendor-email"), self.randomGenerator("randomNumber"), self.randomGenerator("randomString"), self.el, True)
+        self.service_provider = Vendor.objects.get(
+            name=Constants.service_provider_company_name)
+        self.peer_reviewer = self.creator.createUser(
+            self.service_provider,
+            self.randomGenerator("main-vendor-email"),
+            self.randomGenerator("randomNumber"),
+            self.randomGenerator("randomString"),
+            self.el,
+            True)
         logger.debug('-----------------------------------------------------')
         logger.debug('Created Peer Reviewer:')
         logger.debug('UUID: ' + str(self.peer_reviewer.uuid))
@@ -84,13 +101,18 @@ class testGetExpandedEngsAndSearch(TestBaseEntity):
         logger.debug('-----------------------------------------------------')
 
         # Create an Engagement with team
-        engStageList = [EngagementStage.Intake.name, EngagementStage.Active.name,
-                        EngagementStage.Validated.name, EngagementStage.Completed.name]  # @UndefinedVariable
+        engStageList = [
+            EngagementStage.Intake.name,
+            EngagementStage.Active.name,
+            EngagementStage.Validated.name,
+            EngagementStage.Completed.name]  # @UndefinedVariable
         self.random_stage = engStageList[(random.randint(0, 3) * 2 + 1) % 4]
         self.names_array = list()
         for i in range(0, 14):
             self.engagement = self.creator.createEngagement(
-                self.randomGenerator("randomString"), self.randomGenerator("randomString"), None)
+                self.randomGenerator(
+                    "randomString"),
+                self.randomGenerator("randomString"), None)
             self.engagement.reviewer = self.el_user
             self.engagement.peer_reviewer = self.peer_reviewer
             self.engagement.engagement_manual_id = self.randomGenerator(
@@ -107,10 +129,14 @@ class testGetExpandedEngsAndSearch(TestBaseEntity):
             self.names_array.append(self.engagement.engagement_manual_id)
             # Create a VF
             self.deploymentTarget = self.creator.createDeploymentTarget(
-                self.randomGenerator("randomString"), self.randomGenerator("randomString"))
-    #         self.asInfrastructure = self.creator.createApplicationServiceInfrastructure(self.randomGenerator("randomString"))
+                self.randomGenerator("randomString"),
+                self.randomGenerator("randomString"))
             self.vf = self.creator.createVF(
-                "vf_" + str(i), self.engagement, self.deploymentTarget, False, vendor)
+                "vf_" + str(i),
+                self.engagement,
+                self.deploymentTarget,
+                False,
+                vendor)
             self.vf.save()
             self.names_array.append(self.vf.name)
             print('-----------------------------------------------------')
@@ -120,7 +146,11 @@ class testGetExpandedEngsAndSearch(TestBaseEntity):
             if (i % 2 == 0):
                 self.engagement.engagement_team.add(self.user)
                 vfc = self.creator.createVFC(
-                    "vfc_" + str(i), self.randomGenerator("randomNumber"), self.vendor, self.vf, self.el_user)
+                    "vfc_" + str(i),
+                    self.randomGenerator("randomNumber"),
+                    self.vendor,
+                    self.vf,
+                    self.el_user)
                 self.names_array.append(vfc.name)
                 self.engagement.save()
 
@@ -128,8 +158,8 @@ class testGetExpandedEngsAndSearch(TestBaseEntity):
             random.randint(0, len(self.names_array) - 1))]
         self.token = self.loginAndCreateSessionToken(self.user)
 
-    def loggerTestFailedOrSucceded(self, bool):
-        if bool:
+    def loggerTestFailedOrSucceded(self, bool_flag):
+        if bool_flag:
             logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
             logger.debug(" Test Succeeded")
             logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n")
@@ -142,13 +172,16 @@ class testGetExpandedEngsAndSearch(TestBaseEntity):
         urlStr = self.urlPrefix + 'engagement/expanded/'
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
         logger.debug(
-            " Test started: test_get_expanded_even_numbered_engs_by_standard_user_no_keyword")
+            " Test started: test_get_expanded_even_numbered_\
+            engs_by_standard_user_no_keyword")
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n")
 
         postData = {'stage': 'All', 'keyword': '', 'offset': 0, 'limit': 15}
         datajson = json.dumps(postData, ensure_ascii=False)
-        response = self.c.post(
-            urlStr, datajson, content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.token})
+        response = self.c.post(urlStr,
+                               datajson,
+                               content_type='application/json',
+                               **{'HTTP_AUTHORIZATION': "token " + self.token})
         status = response.status_code
         logger.debug("Got response : " + str(status))
         if (status != 200):
@@ -180,8 +213,10 @@ class testGetExpandedEngsAndSearch(TestBaseEntity):
         postData = {'stage': self.random_stage,
                     'keyword': '', 'offset': 0, 'limit': 15}
         datajson = json.dumps(postData, ensure_ascii=False)
-        response = self.c.post(
-            urlStr, datajson, content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.token})
+        response = self.c.post(urlStr,
+                               datajson,
+                               content_type='application/json',
+                               **{'HTTP_AUTHORIZATION': "token " + self.token})
         status = response.status_code
         logger.debug("Got response : " + str(status))
         if (status != 200):
@@ -196,7 +231,8 @@ class testGetExpandedEngsAndSearch(TestBaseEntity):
             if (x['engagement__engagement_stage'] != self.random_stage):
                 self.loggerTestFailedOrSucceded(False)
                 logger.error(
-                    "VF With different stage than defined filter was retrieved")
+                    "VF With different stage than \
+                    defined filter was retrieved")
                 self.assertEqual(
                     x['engagement__engagement_stage'], self.random_stage)
         self.loggerTestFailedOrSucceded(True)
@@ -212,7 +248,10 @@ class testGetExpandedEngsAndSearch(TestBaseEntity):
                     'offset': 0, 'limit': 15}
         datajson = json.dumps(postData, ensure_ascii=False)
         response = self.c.post(
-            urlStr, datajson, content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.token})
+            urlStr,
+            datajson,
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.token})
         status = response.status_code
         logger.debug("Got response : " + str(status))
         self.assertEqual(response.status_code, 200)
@@ -220,8 +259,10 @@ class testGetExpandedEngsAndSearch(TestBaseEntity):
         data = json.loads(response.content)
         print("random keyword chosen: " + self.random_keyword)
         for x in data['array']:
-            bool = False
-            if (x['engagement__engagement_manual_id'] != self.random_keyword and x['vf__name'] != self.random_keyword):
+            bool_flag = False
+            if (
+                x['engagement__engagement_manual_id'] != self.random_keyword
+                    and x['vf__name'] != self.random_keyword):
                 vf = VF.objects.get(engagement__uuid=x['engagement__uuid'])
                 urlStr = self.urlPrefix + 'vf/' + str(vf.uuid) + '/vfcs/'
                 vfc_of_x_response = self.c.get(
@@ -229,13 +270,13 @@ class testGetExpandedEngsAndSearch(TestBaseEntity):
                 vfc_list = json.loads(vfc_of_x_response.content)
                 for vfc in vfc_list:
                     if vfc['name'] == self.random_keyword:
-                        bool = True
+                        bool_flag = True
                         break
                     else:
                         continue
             else:
-                bool = True
-            if (not bool):
+                bool_flag = True
+            if (not bool_flag):
                 self.loggerTestFailedOrSucceded(False)
                 logger.error(
                     "VF With different stage than filter was retrieved")
@@ -253,8 +294,10 @@ class testGetExpandedEngsAndSearch(TestBaseEntity):
         postData = {'stage': self.random_stage,
                     'keyword': self.random_keyword, 'offset': 0, 'limit': 15}
         datajson = json.dumps(postData, ensure_ascii=False)
-        response = self.c.post(
-            urlStr, datajson, content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.token})
+        response = self.c.post(urlStr,
+                               datajson,
+                               content_type='application/json',
+                               **{'HTTP_AUTHORIZATION': "token " + self.token})
         status = response.status_code
         logger.debug("Got response : " + str(status))
         if (status != 200):
@@ -265,14 +308,17 @@ class testGetExpandedEngsAndSearch(TestBaseEntity):
         data = json.loads(response.content)
         print("random keyword chosen: " + self.random_keyword)
         for x in data['array']:
-            bool = False
+            bool_flag = False
             if (x['engagement__engagement_stage'] != self.random_stage):
                 self.loggerTestFailedOrSucceded(False)
                 logger.error(
-                    "VF With different stage than defined filter was retrieved")
+                    "VF With different stage than \
+                    defined filter was retrieved")
                 self.assertEqual(
                     x['engagement__engagement_stage'], self.random_stage)
-            if (x['engagement__engagement_manual_id'] != self.random_keyword and x['vf__name'] != self.random_keyword):
+            if (
+                x['engagement__engagement_manual_id'] != self.random_keyword
+                    and x['vf__name'] != self.random_keyword):
                 vf = VF.objects.get(engagement__uuid=x['engagement__uuid'])
                 urlStr = self.urlPrefix + 'vf' + str(vf.uuid) + '/vfcs/'
                 vfc_of_x_response = self.c.get(
@@ -280,13 +326,13 @@ class testGetExpandedEngsAndSearch(TestBaseEntity):
                 vfc_list = json.loads(vfc_of_x_response.content)
                 for vfc in vfc_list:
                     if (vfc['name'] == self.random_keyword):
-                        bool = True
+                        bool_flag = True
                         break
                     else:
                         continue
             else:
-                bool = True
-            if (not bool):
+                bool_flag = True
+            if (not bool_flag):
                 self.loggerTestFailedOrSucceded(False)
                 logger.error(
                     "VF With different stage than filter was retrieved")
@@ -304,8 +350,10 @@ class testGetExpandedEngsAndSearch(TestBaseEntity):
         postData = {'stage': 'All', 'keyword': email_test,
                     'offset': 0, 'limit': 15}
         datajson = json.dumps(postData, ensure_ascii=False)
-        response = self.c.post(
-            urlStr, datajson, content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.token})
+        response = self.c.post(urlStr,
+                               datajson,
+                               content_type='application/json',
+                               **{'HTTP_AUTHORIZATION': "token " + self.token})
         status = response.status_code
         logger.debug("Got response : " + str(status))
         self.assertEqual(response.status_code, 200)
@@ -316,7 +364,8 @@ class testGetExpandedEngsAndSearch(TestBaseEntity):
             for vf_record in data['array']:
                 vf = VF.objects.get(
                     engagement__uuid=vf_record['engagement__uuid'])
-                if (not vf.engagement.engagement_team.filter(uuid=self.user.uuid).exists()):
+                if (not vf.engagement.engagement_team.filter(
+                        uuid=self.user.uuid).exists()):
                     self.loggerTestFailedOrSucceded(False)
                     logger.error(
                         "VF With different stage than filter was retrieved")
index 8513998..5136af2 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -41,7 +41,8 @@ import os
 
 from django.core import management
 
-from engagementmanager.management.commands.initial_populate_db import execute_bootstrap_actions
+from engagementmanager.management.commands.initial_populate_db \
+    import execute_bootstrap_actions
 from engagementmanager.tests.test_base_entity import TestBaseEntity
 
 
@@ -54,10 +55,10 @@ class TestImportEngagementXLSTestCase(TestBaseEntity):
     def initBody(self):
         pass
 
-    ### TESTS ###
     def testImportEngagementXLSTestCase(self):
         self.initBody()
-        xls_path = 'engagementmanager/tests/D2_ICE_Engagements_Import_Example.xlsx'
+        xls_path = \
+            'engagementmanager/tests/D2_ICE_Engagements_Import_Example.xlsx'
 
         if not os.path.exists(xls_path):
             print("File doesnt exists")
index 460eded..eface25 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -83,11 +83,17 @@ class TestInviteMembersTestCase(TestBaseEntity):
 
         # Create a VF
         self.deploymentTarget = self.creator.createDeploymentTarget(
-            self.randomGenerator("randomString"), self.randomGenerator("randomString"))
+            self.randomGenerator("randomString"),
+            self.randomGenerator("randomString"))
 
         for eng in self.engList:
-            vf = self.creator.createVF(self.randomGenerator("randomString"), eng,
-                                       self.deploymentTarget, False, Vendor.objects.get(name='Other'))
+            vf = self.creator.createVF(
+                self.randomGenerator("randomString"),
+                eng,
+                self.deploymentTarget,
+                False,
+                Vendor.objects.get(
+                    name='Other'))
             self.vfList.append(vf)
 
         self.urlStr = self.urlPrefix + "invite-team-members/"
@@ -108,22 +114,30 @@ class TestInviteMembersTestCase(TestBaseEntity):
 
     def inviteContact(self, expectedStatus=HTTP_200_OK):
         self.invitedDataStr = json.dumps(self.invitedData, ensure_ascii=False)
-        response = self.c.post(self.urlStr, self.invitedDataStr, content_type='application/json',
+        response = self.c.post(self.urlStr,
+                               self.invitedDataStr,
+                               content_type='application/json',
                                **{'HTTP_AUTHORIZATION': "token " + self.token})
-        print('Got response : ' + str(response.status_code), str(response.content))
+        print('Got response : ' + str(response.status_code),
+              str(response.content))
         self.assertEqual(response.status_code, expectedStatus)
         return response
 
     def createContactUser(self):
-        self.contact = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.data['email'], self.data['phone_number'], self.data['full_name'], self.standard_user, True)
+        self.contact = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.data['email'],
+            self.data['phone_number'],
+            self.data['full_name'],
+            self.standard_user,
+            True)
         print('-----------------------------------------------------')
         print('Created User:')
         print('UUID: ' + str(self.contact.uuid))
         print('Full Name: ' + self.contact.full_name)
         print('-----------------------------------------------------')
 
-    ### TESTS ###
     def testAddContactForNonExistingContact(self):
         self.initBody()
         self.inviteContact()
@@ -161,4 +175,5 @@ class TestInviteMembersTestCase(TestBaseEntity):
             self.invitedData.append(data)
             self.inviteContact(expectedStatus=HTTP_200_OK)
             invitedUser = IceUserProfile.objects.get(email=data['email'])
-            self.assertTrue(invitedUser in self.engList[i].engagement_team.all())
+            self.assertTrue(
+                invitedUser in self.engList[i].engagement_team.all())
index 95a8227..d58cad5 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -53,7 +53,7 @@ class NextStepTest(unittest.TestCase):
         pass
 
     def testStandardUserActions(self):
-        print('---------------------------------- Testing standard_user Actions ------------------------------------')
+        print('----- Testing standard_user Actions ----- ')
         user = MagicMock()
         user.role.name = 'standard_user'
 
@@ -64,7 +64,7 @@ class NextStepTest(unittest.TestCase):
             user, NextStepState.Completed, NextStepState.Incomplete)
 
     def testELUserActions(self):
-        print('---------------------------------- Testing EL Actions ------------------------------------')
+        print('----- Testing EL Actions ----- ')
         user = MagicMock()
         user.role.name = 'el'
 
index b0be468..f9b94ab 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -57,9 +57,14 @@ class TestNextStepsAPI(TestBaseEntity):
         self.createDefaultRoles()
 
         # Create a user with role el
-        self.el_user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'el user', self.el, True)
+        self.el_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'el user',
+            self.el,
+            True)
         print('-----------------------------------------------------')
         print('Created User:')
         print('UUID: ' + str(self.el_user.uuid))
@@ -87,9 +92,15 @@ class TestNextStepsAPI(TestBaseEntity):
         print('-----------------------------------------------------')
 
         # Create a user with role standard_user with SSH key
-        self.user_with_ssh = self.creator.createUser(Vendor.objects.get(
-            name='Other'), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'ssh user', self.standard_user, True, 'just-a-fake-ssh-key')
+        self.user_with_ssh = self.creator.createUser(
+            Vendor.objects.get(
+                name='Other'),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'ssh user',
+            self.standard_user,
+            True,
+            'just-a-fake-ssh-key')
         print('-----------------------------------------------------')
         print('Created User:')
         print('UUID: ' + str(self.user_with_ssh.uuid))
@@ -97,7 +108,8 @@ class TestNextStepsAPI(TestBaseEntity):
         print('-----------------------------------------------------')
 
         # Create an Engagement with team
-        self.engagement = self.creator.createEngagement('just-a-fake-uuid', 'Validation', None)
+        self.engagement = self.creator.createEngagement(
+            'just-a-fake-uuid', 'Validation', None)
         self.engagement.reviewer = self.el_user
         self.engagement.peer_reviewer = self.el_user
         self.engagement.engagement_team.add(self.user, self.el_user)
@@ -108,8 +120,10 @@ class TestNextStepsAPI(TestBaseEntity):
         print('-----------------------------------------------------')
 
         # Create another Engagement with team with SSH Key
-        self.engagement_ssh = self.creator.createEngagement('just-another-fake-uuid', 'Validation', None)
-        self.engagement_ssh.engagement_team.add(self.user_with_ssh, self.el_user)
+        self.engagement_ssh = self.creator.createEngagement(
+            'just-another-fake-uuid', 'Validation', None)
+        self.engagement_ssh.engagement_team.add(
+            self.user_with_ssh, self.el_user)
         self.engagement_ssh.peer_reviewer = self.pruser
         self.engagement_ssh.save()
 
@@ -119,8 +133,10 @@ class TestNextStepsAPI(TestBaseEntity):
         print('-----------------------------------------------------')
 
         # Create another Engagement with Main Contact
-        self.engagement_with_contact = self.creator.createEngagement('yet-just-another-fake-uuid', 'Validation', None)
-        self.engagement_with_contact.engagement_team.add(self.user, self.el_user)
+        self.engagement_with_contact = self.creator.createEngagement(
+            'yet-just-another-fake-uuid', 'Validation', None)
+        self.engagement_with_contact.engagement_team.add(
+            self.user, self.el_user)
         self.engagement_with_contact.contact_user = self.user
         self.engagement_with_contact.peer_reviewer = self.pruser
         self.engagement_with_contact.save()
@@ -131,26 +147,35 @@ class TestNextStepsAPI(TestBaseEntity):
         print('-----------------------------------------------------')
 
         # Create another Engagement with Main Contact
-        self.engagement_4_createNS = self.creator.createEngagement('yet-just-another-fake-uuid2', 'Validation', None)
+        self.engagement_4_createNS = self.creator.createEngagement(
+            'yet-just-another-fake-uuid2', 'Validation', None)
         self.engagement_4_createNS.reviewer = self.el_user
         self.engagement_4_createNS.peer_reviewer = self.el_user
-        self.engagement_4_createNS.engagement_team.add(self.user_with_ssh, self.el_user)
+        self.engagement_4_createNS.engagement_team.add(
+            self.user_with_ssh, self.el_user)
         self.engagement_4_createNS.contact_user = self.user_with_ssh
         self.engagement_4_createNS.save()
 
         # Create engagement for order
-        self.engagement_4_order = self.creator.createEngagement('yet-just-another-fake-uuid3', 'Validation', None)
+        self.engagement_4_order = self.creator.createEngagement(
+            'yet-just-another-fake-uuid3', 'Validation', None)
         self.engagement_4_order.reviewer = self.el_user
         self.engagement_4_order.peer_reviewer = self.el_user
-        self.engagement_4_order.engagement_team.add(self.user_with_ssh, self.el_user)
+        self.engagement_4_order.engagement_team.add(
+            self.user_with_ssh, self.el_user)
         self.engagement_4_order.contact_user = self.user_with_ssh
         self.engagement_4_order.save()
 
         self.deploymentTarget = self.creator.createDeploymentTarget(
-            self.randomGenerator("randomString"), self.randomGenerator("randomString"))
+            self.randomGenerator("randomString"),
+            self.randomGenerator("randomString"))
         self.vendor = Vendor.objects.get(name='Other')
-        self.vf = self.creator.createVF(self.randomGenerator("randomString"),
-                                        self.engagement_4_createNS, self.deploymentTarget, False, self.vendor)
+        self.vf = self.creator.createVF(
+            self.randomGenerator("randomString"),
+            self.engagement_4_createNS,
+            self.deploymentTarget,
+            False,
+            self.vendor)
 
         print('-----------------------------------------------------')
         print('Created Engagement:')
@@ -163,12 +188,15 @@ class TestNextStepsAPI(TestBaseEntity):
 
     def testCreateDefaultNextStepsAndSetNextStepsState(self):
         urlStr = self.urlPrefix + 'engagements/${uuid}/nextsteps/Intake'
-        NextStepSvc().create_default_next_steps(self.user, self.engagement, self.el_user)
-        NextStepSvc().create_default_next_steps_for_user(self.user, self.el_user)
+        NextStepSvc().create_default_next_steps(
+            self.user, self.engagement, self.el_user)
+        NextStepSvc().create_default_next_steps_for_user(
+            self.user, self.el_user)
         num_of_steps = 3
 
-        response = self.c.get(urlStr.replace('${uuid}', str(self.engagement.uuid)),
-                              **{'HTTP_AUTHORIZATION': "token " + self.token})
+        response = self.c.get(
+            urlStr.replace('${uuid}', str(self.engagement.uuid)),
+            **{'HTTP_AUTHORIZATION': "token " + self.token})
         print('Got response : ' + str(response.status_code))
         print("DATA After JSON Parse:" + str(response.content))
 
@@ -180,32 +208,45 @@ class TestNextStepsAPI(TestBaseEntity):
         print('Test that GET nextsteps in Intake state returns 3 items ')
         self.assertEqual(len(response.json()), num_of_steps)
 
-        print('Test First item state is Incomplete: ' + response.json()[0]['state'])
+        print('Test First item state is Incomplete: ' +
+              response.json()[0]['state'])
         self.assertEqual(response.json()[0]['state'], 'Incomplete')
 
         step_uuid = response.json()[0]['uuid']
         urlStr = self.urlPrefix + 'nextsteps/' + step_uuid + '/state'
 
-        print('attempt change state of next step Incomplete->COMPLETED by standard_user. This should succeed...')
-        response = self.c.put(urlStr, '{ "state" : "Completed" }',
-                              content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        print('attempt change state of next step Incomplete->' +
+              'COMPLETED by standard_user. This should succeed...')
+        response = self.c.put(
+            urlStr,
+            '{ "state" : "Completed" }',
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
 
-        print('Negative: attempt change state of next step COMPLETED->Incomplete by EL. This should success')
-        response = self.c.put(urlStr, '{ "state" : "Incomplete" }',
-                              content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        print('Negative: attempt change state of next step COMPLETED->' +
+              'Incomplete by EL. This should success')
+        response = self.c.put(
+            urlStr,
+            '{ "state" : "Incomplete" }',
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
 
     def testCreateDefaultNextStepsForUserWithSSHKey(self):
         urlStr = self.urlPrefix + 'engagements/${uuid}/nextsteps/Intake'
-        NextStepSvc().create_default_next_steps(self.user_with_ssh, self.engagement_ssh, self.el_user)
-        # Would not create any next step, due to the reason that the user already has an SSH
-        NextStepSvc().create_default_next_steps_for_user(self.user_with_ssh, self.el_user)
+        NextStepSvc().create_default_next_steps(
+            self.user_with_ssh, self.engagement_ssh, self.el_user)
+        # Would not create any next step, due to the reason that the user
+        # already has an SSH
+        NextStepSvc().create_default_next_steps_for_user(self.user_with_ssh,
+                                                         self.el_user)
         num_of_steps = 2
 
-        response = self.c.get(urlStr.replace('${uuid}', str(self.engagement_ssh.uuid)),
+        response = self.c.get(urlStr.replace('${uuid}',
+                                             str(self.engagement_ssh.uuid)),
                               **{'HTTP_AUTHORIZATION': "token " + self.token})
         print('Got response : ' + str(response.status_code))
         print("DATA After JSON Parse:" + str(response.content))
@@ -222,33 +263,51 @@ class TestNextStepsAPI(TestBaseEntity):
         nsDict["position"] = 4
         nsDict["creator_uuid"] = str(self.el_user.uuid)
         nsDict[
-            "description"] = "Please submit the first version of the VF package. If you have any problems or questions please contact your Engagement Lead (EL)"
+            "description"] = "Please submit the first version of the " +\
+            "VF package. If you have any problems or questions please " +\
+            "contact your Engagement Lead (EL)"
         nsDict["state"] = "Incomplete"
         nsDict["engagement_stage"] = "Active"
 
         myjson = json.dumps([nsDict], ensure_ascii=False)
 
-        create_nextsteps_url = self.urlPrefix + "engagements/" + str(self.engagement_4_order.uuid) + "/nextsteps/"
-        response = self.c.post(create_nextsteps_url, myjson, content_type='application/json',
-                               **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
-        response = self.c.post(create_nextsteps_url, myjson, content_type='application/json',
-                               **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
-        response = self.c.post(create_nextsteps_url, myjson, content_type='application/json',
-                               **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
-
-        get_nextsteps_url = self.urlPrefix + 'engagements/${uuid}/nextsteps/Intake'
+        create_nextsteps_url = self.urlPrefix + "engagements/" + \
+            str(self.engagement_4_order.uuid) + "/nextsteps/"
+        response = self.c.post(create_nextsteps_url,
+                               myjson,
+                               content_type='application/json',
+                               **{'HTTP_AUTHORIZATION': "token "
+                                  + self.ELtoken})
+        response = self.c.post(create_nextsteps_url,
+                               myjson,
+                               content_type='application/json',
+                               **{'HTTP_AUTHORIZATION': "token "
+                                  + self.ELtoken})
+        response = self.c.post(create_nextsteps_url,
+                               myjson,
+                               content_type='application/json',
+                               **{'HTTP_AUTHORIZATION': "token "
+                                  + self.ELtoken})
+
+        get_nextsteps_url = self.urlPrefix + \
+            'engagements/${uuid}/nextsteps/Intake'
         response = self.c.get(get_nextsteps_url.replace('${uuid}', str(
-            self.engagement_4_order.uuid)), **{'HTTP_AUTHORIZATION': "token " + self.sshtoken})
+            self.engagement_4_order.uuid)), **{'HTTP_AUTHORIZATION': "token "
+                                               + self.sshtoken})
 
         decoded_ns = json.loads(response.content)
         myjson = json.dumps(decoded_ns, ensure_ascii=False)
         order_nextsteps_url = self.urlPrefix + 'engagements/' + \
             str(self.engagement_4_order.uuid) + '/nextsteps/order_next_steps/'
-        response = self.c.put(order_nextsteps_url, myjson, content_type='application/json',
-                              **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        response = self.c.put(
+            order_nextsteps_url,
+            myjson,
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
 
         response = self.c.get(get_nextsteps_url.replace('${uuid}', str(
-            self.engagement_4_order.uuid)), **{'HTTP_AUTHORIZATION': "token " + self.sshtoken})
+            self.engagement_4_order.uuid)), **{'HTTP_AUTHORIZATION': "token "
+                                               + self.sshtoken})
 
         decoded_ns = json.loads(response.content)
         counter = 0
@@ -258,12 +317,15 @@ class TestNextStepsAPI(TestBaseEntity):
 
     def testCreateDefaultNextStepsWhenENGContactExist(self):
         urlStr = self.urlPrefix + 'engagements/${uuid}/nextsteps/Intake'
-        NextStepSvc().create_default_next_steps(self.user, self.engagement_with_contact, self.el_user)
-        NextStepSvc().create_default_next_steps_for_user(self.user, self.el_user)
+        NextStepSvc().create_default_next_steps(
+            self.user, self.engagement_with_contact, self.el_user)
+        NextStepSvc().create_default_next_steps_for_user(
+            self.user, self.el_user)
         num_of_steps = 2
 
         response = self.c.get(urlStr.replace('${uuid}', str(
-            self.engagement_with_contact.uuid)), **{'HTTP_AUTHORIZATION': "token " + self.token})
+            self.engagement_with_contact.uuid)), **{
+                'HTTP_AUTHORIZATION': "token " + self.token})
 
         print('Got response : ' + str(response.status_code))
         print("DATA After JSON Parse:" + str(response.content))
@@ -275,61 +337,90 @@ class TestNextStepsAPI(TestBaseEntity):
         self.assertEqual(len(response.json()), num_of_steps)
 
     def testAddNextStepToEng(self):
-        urlStr = self.urlPrefix + "engagements/" + str(self.engagement_4_createNS.uuid) + "/nextsteps/"
+        urlStr = self.urlPrefix + "engagements/" + \
+            str(self.engagement_4_createNS.uuid) + "/nextsteps/"
 
-        NextStepSvc().create_default_next_steps(self.user_with_ssh, self.engagement_4_createNS, self.el_user)
-        # Would not create any next step, due to the reason that the user already has an SSH
-        NextStepSvc().create_default_next_steps_for_user(self.user_with_ssh, self.el_user)
+        NextStepSvc().create_default_next_steps(
+            self.user_with_ssh, self.engagement_4_createNS, self.el_user)
+        # Would not create any next step, due to the reason that the user
+        # already has an SSH
+        NextStepSvc().create_default_next_steps_for_user(
+            self.user_with_ssh, self.el_user)
 
         nsDict = {}
         nsDict["position"] = "4"
         nsDict["creator_uuid"] = str(self.el_user.uuid)
         nsDict[
-            "description"] = "Please submit the first version of the VF package. If you have any problems or questions please contact your Engagement Lead (EL)"
+            "description"] = "Please submit the first version of the VF " +\
+            "package. If you have any problems or questions please contact " +\
+            "your Engagement Lead (EL)"
         nsDict["state"] = "Incomplete"
         nsDict["engagement_stage"] = "Active"
 
         myjson = json.dumps([nsDict], ensure_ascii=False)
         print(myjson)
 
-        response = self.c.post(urlStr, myjson, content_type='application/json',
-                               **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        response = self.c.post(urlStr,
+                               myjson,
+                               content_type='application/json',
+                               **{'HTTP_AUTHORIZATION': "token "
+                                  + self.ELtoken})
         print('Got response : ' + str(response.status_code))
         print("DATA After JSON Parse:" + str(response.content))
 
         self.assertEqual(response.status_code, HTTP_200_OK)
 
     def testDelNextStepToEng(self):
-        nsObj = NextStep.objects.create(uuid=uuid4(), creator=self.el_user, position=2, description="testDelNextStepToEng",
-                                        state='Incomplete', engagement_stage="Intake", engagement=self.engagement)
+        nsObj = NextStep.objects.create(
+            uuid=uuid4(),
+            creator=self.el_user,
+            position=2,
+            description="testDelNextStepToEng",
+            state='Incomplete',
+            engagement_stage="Intake",
+            engagement=self.engagement)
         urlStr = self.urlPrefix + "nextsteps/" + str(nsObj.uuid)
 
-        response = self.c.delete(urlStr, **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        response = self.c.delete(
+            urlStr, **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
         print('Got response : ' + str(response.status_code))
         print("DATA After JSON Parse:" + str(response.content))
 
         self.assertEqual(response.status_code, HTTP_204_NO_CONTENT)
 
     def testNegativeDelNextStepToEngNoHeader(self):
-        nsObj = NextStep.objects.create(uuid=uuid4(), creator=self.el_user, position=2, description="testDelNextStepToEng",
-                                        state='Incomplete', engagement_stage="Intake", engagement=self.engagement)
+        nsObj = NextStep.objects.create(
+            uuid=uuid4(),
+            creator=self.el_user,
+            position=2,
+            description="testDelNextStepToEng",
+            state='Incomplete',
+            engagement_stage="Intake",
+            engagement=self.engagement)
         urlStr = self.urlPrefix + "nextsteps/" + str(nsObj.uuid)
 
         response = self.c.delete(urlStr)
-        print('Negative: Expecting response 403, got: ' + str(response.status_code))
+        print('Negative: Expecting response 403, got: ' +
+              str(response.status_code))
         print("DATA After JSON Parse:" + str(response.content))
 
         self.assertEqual(response.status_code, HTTP_403_FORBIDDEN)
 
     def testEditNextSteps(self):
         print(
-            '---------------------------------- testEditNextSteps, Expecting 200 ------------------------------------')
-        print('---------------------------------- Creating a next step ------------------------------------')
-        step = NextStep.objects.create(position="4", creator=self.el_user, engagement=self.engagement,
-                                       description="Please submit the first version of the VF package. If you have any problems or questions please contact your Engagement Lead (EL)",
-                                       state="TODO", engagement_stage="Active",
-                                       uuid=uuid4())
-        print('---------------------------------- Editing the next step ------------------------------------')
+            '---------- testEditNextSteps, Expecting 200 ----------')
+        print('---------- Creating a next step ----------')
+        step = NextStep.objects.create(
+            position="4",
+            creator=self.el_user,
+            engagement=self.engagement,
+            description="Please submit the first version of the VF package. " +
+            "If you have any problems or questions please contact " +
+            "your Engagement Lead (EL)",
+            state="TODO",
+            engagement_stage="Active",
+            uuid=uuid4())
+        print('---------- Editing the next step ----------')
         urlStr = self.urlPrefix + "nextsteps/" + str(step.uuid)
         body = {}
         files = []
@@ -341,17 +432,23 @@ class TestNextStepsAPI(TestBaseEntity):
         body['assigneesUuids'] = [str(self.user.uuid), str(self.el_user.uuid)]
         myjson = json.dumps(body, ensure_ascii=False)
         print(myjson)
-        response = self.c.put(urlStr, myjson, content_type='application/json',
-                              **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        response = self.c.put(
+            urlStr,
+            myjson,
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
         print(urlStr)
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, status.HTTP_200_OK)
 
     def testUserNextSteps(self):
-        NextStepSvc().create_default_next_steps(self.user_with_ssh, self.engagement_4_createNS, self.el_user)
-        # Needs to return 0 elements for regular user which is not the assignee:
+        NextStepSvc().create_default_next_steps(
+            self.user_with_ssh, self.engagement_4_createNS, self.el_user)
+        # Needs to return 0 elements for regular user which is not the
+        # assignee:
         urlStr = self.urlPrefix + 'engagements/user/nextsteps/'
-        response = self.c.get(urlStr, **{'HTTP_AUTHORIZATION': "token " + self.sshtoken})
+        response = self.c.get(
+            urlStr, **{'HTTP_AUTHORIZATION': "token " + self.sshtoken})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
 
@@ -360,7 +457,8 @@ class TestNextStepsAPI(TestBaseEntity):
         self.assertEqual(data["count"], 0)
 
         # Needs to return 3 elements to el user which is the assignee:
-        response = self.c.get(urlStr, **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        response = self.c.get(
+            urlStr, **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
         print('Got response : ' + str(response.status_code))
         self.assertEqual(response.status_code, HTTP_200_OK)
         data = json.loads(response.content)
index afeb835..19369d2 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -44,9 +44,11 @@ import mock
 from engagementmanager.tests.test_base_entity import TestBaseEntity
 
 from engagementmanager.apps import bus_service
-from engagementmanager.bus.messages.daily_scheduled_message import DailyScheduledMessage
+from engagementmanager.bus.messages.daily_scheduled_message \
+    import DailyScheduledMessage
 from engagementmanager.models import Vendor, Engagement, Activity, Notification
-from engagementmanager.utils.constants import EngagementStage, ActivityType, Constants
+from engagementmanager.utils.constants import \
+    EngagementStage, ActivityType, Constants
 from django.utils import timezone
 
 
@@ -96,22 +98,33 @@ class TestNotifyInactiveEngagements(TestBaseEntity):
 
     def childSetup(self):
 
-        self.createVendors([Constants.service_provider_company_name, 'Amdocs', 'Other'])
+        self.createVendors(
+            [Constants.service_provider_company_name, 'Amdocs', 'Other'])
         self.createDefaultRoles()
 
         # Create a user with role el
-        self.el_user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'el user', self.el, True)
+        self.el_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'el user',
+            self.el,
+            True)
         # For negative tests
-        self.user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'user', self.standard_user, True)
+        self.user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'user',
+            self.standard_user,
+            True)
         self.urlStr = self.urlPrefix + "engagement/@eng_uuid/checklist/new/"
         self.data = dict()
         self.template = self.creator.createDefaultCheckListTemplate()
-#         self.engagement = Engagement.objects.create(uuid='just-a-fake-uuid',engagement_stage='Validation')
-        self.engagement = self.creator.createEngagement(uuid4(), 'Validation', None)
+        self.engagement = self.creator.createEngagement(
+            uuid4(), 'Validation', None)
         self.engagement.reviewer = self.el_user
         self.engagement.peer_reviewer = self.el_user
         self.engagement.engagement_team.add(self.user)
@@ -121,11 +134,19 @@ class TestNotifyInactiveEngagements(TestBaseEntity):
         self.engagement.save()
         self.vendor = Vendor.objects.get(name='Other')
         self.deploymentTarget = self.creator.createDeploymentTarget(
-            self.randomGenerator("randomString"), self.randomGenerator("randomString"))
-        self.vf = self.creator.createVF(self.randomGenerator("randomString"),
-                                        self.engagement, self.deploymentTarget, False, self.vendor)
-
-    @mock.patch('validationmanager.em_integration.vm_api.get_list_of_repo_files_callback', with_files)
+            self.randomGenerator("randomString"),
+            self.randomGenerator("randomString"))
+        self.vf = self.creator.createVF(
+            self.randomGenerator("randomString"),
+            self.engagement,
+            self.deploymentTarget,
+            False,
+            self.vendor)
+
+    @mock.patch(
+        'validationmanager.em_integration.vm_api.' +
+        'get_list_of_repo_files_callback',
+        with_files)
     def testOnlyNotActiveEngagementsAreNotEffected(self):
         self.engagement.engagement_stage = EngagementStage.Archived.name
         self.engagement.save()
@@ -135,31 +156,49 @@ class TestNotifyInactiveEngagements(TestBaseEntity):
 
         self.assertEqual(updated_engagement.is_with_files, False)
 
-    @mock.patch('engagementmanager.bus.handlers.daily_notify_inactive_engagements_handler.DailyNotifyInactiveEngagementsHandler.get_max_empty_date', mocked_max_empty_date_negative)
-    @mock.patch('validationmanager.em_integration.vm_api.get_list_of_repo_files_callback', no_files)
+    @mock.patch(
+        'engagementmanager.bus.handlers.' +
+        'daily_notify_inactive_engagements_handler.' +
+        'DailyNotifyInactiveEngagementsHandler.get_max_empty_date',
+        mocked_max_empty_date_negative)
+    @mock.patch(
+        'validationmanager.em_integration.' +
+        'vm_api.get_list_of_repo_files_callback',
+        no_files)
     def testEngagementsWithouthFilesOlderThan30DaysAreArchive(self):
         bus_service.send_message(DailyScheduledMessage())
         updated_engagement = Engagement.objects.get(uuid=self.engagement.uuid)
 
         self.assertEqual(updated_engagement.is_with_files, False)
-        self.assertEqual(updated_engagement.engagement_stage, EngagementStage.Archived.name)
+        self.assertEqual(updated_engagement.engagement_stage,
+                         EngagementStage.Archived.name)
 
-    @mock.patch('validationmanager.em_integration.vm_api.get_list_of_repo_files_callback', no_files)
+    @mock.patch(
+        'validationmanager.em_integration.vm_api.' +
+        'get_list_of_repo_files_callback',
+        no_files)
     def testEngagementsWithouthFilesYoungerThan30DaysNotArchive(self):
         bus_service.send_message(DailyScheduledMessage())
         updated_engagement = Engagement.objects.get(uuid=self.engagement.uuid)
 
         self.assertEqual(updated_engagement.is_with_files, False)
-        self.assertEqual(updated_engagement.engagement_stage, EngagementStage.Active.name)
+        self.assertEqual(updated_engagement.engagement_stage,
+                         EngagementStage.Active.name)
 
-    @mock.patch('validationmanager.em_integration.vm_api.get_list_of_repo_files_callback', no_files)
+    @mock.patch(
+        'validationmanager.em_integration.vm_api.' +
+        'get_list_of_repo_files_callback',
+        no_files)
     def testEngagementsWithouthFilesIsNotMarked(self):
         bus_service.send_message(DailyScheduledMessage())
         updated_engagement = Engagement.objects.get(uuid=self.engagement.uuid)
 
         self.assertEqual(updated_engagement.is_with_files, False)
 
-    @mock.patch('validationmanager.em_integration.vm_api.get_list_of_repo_files_callback', with_files)
+    @mock.patch(
+        'validationmanager.em_integration.vm_api.' +
+        'get_list_of_repo_files_callback',
+        with_files)
     def testEngagementsWithoFilesNotSentEmail(self):
         bus_service.send_message(DailyScheduledMessage())
         new_activity = Activity.objects.filter(
@@ -168,8 +207,15 @@ class TestNotifyInactiveEngagements(TestBaseEntity):
         )
         self.assertEqual(0, len(new_activity))
 
-    @mock.patch('validationmanager.em_integration.vm_api.get_list_of_repo_files_callback', no_files)
-    @mock.patch('engagementmanager.bus.handlers.daily_notify_inactive_engagements_handler.DailyNotifyInactiveEngagementsHandler.get_days_delta', get_days_delta_plus_1)
+    @mock.patch(
+        'validationmanager.em_integration.vm_api.' +
+        'get_list_of_repo_files_callback',
+        no_files)
+    @mock.patch(
+        'engagementmanager.bus.handlers.' +
+        'daily_notify_inactive_engagements_handler.' +
+        'DailyNotifyInactiveEngagementsHandler.get_days_delta',
+        get_days_delta_plus_1)
     def testEngagementsWithoutFilesOneDayEmailNotSent(self):
         bus_service.send_message(DailyScheduledMessage())
         new_activity = Activity.objects.filter(
@@ -178,8 +224,15 @@ class TestNotifyInactiveEngagements(TestBaseEntity):
         )
         self.assertEqual(0, len(new_activity))
 
-    @mock.patch('validationmanager.em_integration.vm_api.get_list_of_repo_files_callback', no_files)
-    @mock.patch('engagementmanager.bus.handlers.daily_notify_inactive_engagements_handler.DailyNotifyInactiveEngagementsHandler.get_days_delta', get_days_delta_plus_7)
+    @mock.patch(
+        'validationmanager.em_integration.vm_api.' +
+        'get_list_of_repo_files_callback',
+        no_files)
+    @mock.patch(
+        'engagementmanager.bus.handlers.' +
+        'daily_notify_inactive_engagements_handler.' +
+        'DailyNotifyInactiveEngagementsHandler.get_days_delta',
+        get_days_delta_plus_7)
     def testEngagementsWithoutFiles7DayEmailSent(self):
         bus_service.send_message(DailyScheduledMessage())
         new_activity = Activity.objects.get(
@@ -193,8 +246,15 @@ class TestNotifyInactiveEngagements(TestBaseEntity):
         for notifcation in new_notifications:
             self.assertEqual(notifcation.is_sent, True)
 
-    @mock.patch('validationmanager.em_integration.vm_api.get_list_of_repo_files_callback', no_files)
-    @mock.patch('engagementmanager.bus.handlers.daily_notify_inactive_engagements_handler.DailyNotifyInactiveEngagementsHandler.get_days_delta', get_days_delta_plus_23)
+    @mock.patch(
+        'validationmanager.em_integration.' +
+        'vm_api.get_list_of_repo_files_callback',
+        no_files)
+    @mock.patch(
+        'engagementmanager.bus.handlers.' +
+        'daily_notify_inactive_engagements_handler.' +
+        'DailyNotifyInactiveEngagementsHandler.get_days_delta',
+        get_days_delta_plus_23)
     def testEngagementsWithoutFiles23DayEmailSent(self):
         bus_service.send_message(DailyScheduledMessage())
         new_activity = Activity.objects.get(
@@ -208,8 +268,15 @@ class TestNotifyInactiveEngagements(TestBaseEntity):
         for notifcation in new_notifications:
             self.assertEqual(notifcation.is_sent, True)
 
-    @mock.patch('validationmanager.em_integration.vm_api.get_list_of_repo_files_callback', no_files)
-    @mock.patch('engagementmanager.bus.handlers.daily_notify_inactive_engagements_handler.DailyNotifyInactiveEngagementsHandler.get_days_delta', get_days_delta_plus_29)
+    @mock.patch(
+        'validationmanager.em_integration.vm_api.' +
+        'get_list_of_repo_files_callback',
+        no_files)
+    @mock.patch(
+        'engagementmanager.bus.handlers.' +
+        'daily_notify_inactive_engagements_handler.' +
+        'DailyNotifyInactiveEngagementsHandler.get_days_delta',
+        get_days_delta_plus_29)
     def testEngagementsWithoutFiles29DayEmailSent(self):
         bus_service.send_message(DailyScheduledMessage())
         new_activity = Activity.objects.get(
@@ -223,7 +290,10 @@ class TestNotifyInactiveEngagements(TestBaseEntity):
         for notifcation in new_notifications:
             self.assertEqual(notifcation.is_sent, True)
 
-    @mock.patch('validationmanager.em_integration.vm_api.get_list_of_repo_files_callback', with_files)
+    @mock.patch(
+        'validationmanager.em_integration.' +
+        'vm_api.get_list_of_repo_files_callback',
+        with_files)
     def testEngagementsWithFilesIsMarked(self):
 
         bus_service.send_message(DailyScheduledMessage())
index 1c22437..24843ce 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
 from engagementmanager.tests.test_base_entity import TestBaseEntity
 from engagementmanager.apps import bus_service
-from engagementmanager.bus.messages.activity_event_message import ActivityEventMessage
+from engagementmanager.bus.messages.activity_event_message import \
+    ActivityEventMessage
 from engagementmanager.models import Vendor
-from engagementmanager.utils.constants import Constants, ActivityType
-from engagementmanager.utils.activities_data import ActivityData, UserJoinedEngagementActivityData
+from engagementmanager.utils.constants import Constants
+from engagementmanager.utils.activities_data import \
+    UserJoinedEngagementActivityData
 from engagementmanager.service.logging_service import LoggingServiceFactory
 
 logger = LoggingServiceFactory.get_logger()
@@ -54,14 +56,23 @@ class NotificationsTestCase(TestBaseEntity):
 
         self.createDefaultRoles()
         # Create a user with role el
-        vendor = Vendor.objects.get(name=Constants.service_provider_company_name)
-        self.peer_reviewer = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'peer-reviewer user', self.el, True)
-        self.el_user = self.creator.createUser(vendor,
-                                               self.randomGenerator("main-vendor-email"),
-                                               self.randomGenerator("randomNumber"),
-                                               self.randomGenerator("randomString"), self.el, True)
+        vendor = Vendor.objects.get(
+            name=Constants.service_provider_company_name)
+        self.peer_reviewer = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'peer-reviewer user',
+            self.el,
+            True)
+        self.el_user = self.creator.createUser(
+            vendor,
+            self.randomGenerator("main-vendor-email"),
+            self.randomGenerator("randomNumber"),
+            self.randomGenerator("randomString"),
+            self.el,
+            True)
         print('-----------------------------------------------------')
         print('Created User:')
         print('UUID: ' + str(self.el_user.uuid))
@@ -70,8 +81,13 @@ class NotificationsTestCase(TestBaseEntity):
 
         # Create a user with role standard_user
         vendor = Vendor.objects.get(name='Other')
-        self.user = self.creator.createUser(vendor, self.randomGenerator("email"), self.randomGenerator(
-            "randomNumber"), self.randomGenerator("randomString"), self.standard_user, True)
+        self.user = self.creator.createUser(
+            vendor,
+            self.randomGenerator("email"),
+            self.randomGenerator("randomNumber"),
+            self.randomGenerator("randomString"),
+            self.standard_user,
+            True)
         print('-----------------------------------------------------')
         print('Created User:')
         print('UUID: ' + str(self.user.uuid))
@@ -90,9 +106,14 @@ class NotificationsTestCase(TestBaseEntity):
         self.engagement.peer_reviewer = self.peer_reviewer
         # Create a VF
         self.deploymentTarget = self.creator.createDeploymentTarget(
-            self.randomGenerator("randomString"), self.randomGenerator("randomString"))
-        self.vf = self.creator.createVF(self.randomGenerator("randomString"),
-                                        self.engagement, self.deploymentTarget, False, vendor)
+            self.randomGenerator("randomString"),
+            self.randomGenerator("randomString"))
+        self.vf = self.creator.createVF(
+            self.randomGenerator("randomString"),
+            self.engagement,
+            self.deploymentTarget,
+            False,
+            vendor)
 
         print('-----------------------------------------------------')
         print('Created VF:')
@@ -108,13 +129,19 @@ class NotificationsTestCase(TestBaseEntity):
         logger.debug("Starting pull notification test")
         logger.debug("Creating a random new user")
         vendor = Vendor.objects.get(name='Other')
-        randomUser = self.creator.createUser(vendor, self.randomGenerator("email"), self.randomGenerator(
-            "randomNumber"), self.randomGenerator("randomString"), self.standard_user, True)
+        randomUser = self.creator.createUser(
+            vendor,
+            self.randomGenerator("email"),
+            self.randomGenerator("randomNumber"),
+            self.randomGenerator("randomString"),
+            self.standard_user,
+            True)
         self.engagement.engagement_team.add(randomUser)
         self.engagement.save()
 
         logger.debug(
-            "created a new user & added them to the engagement team, going to create the activity and consider it as a notification")
+            "created a new user & added them to the engagement team, \
+            going to create the activity and consider it as a notification")
         usersList = []
         usersList.append(randomUser)
         activity_data = UserJoinedEngagementActivityData(
@@ -122,7 +149,8 @@ class NotificationsTestCase(TestBaseEntity):
         bus_service.send_message(ActivityEventMessage(activity_data))
 
         response = self.c.get(urlStr + str(randomUser.uuid) +
-                              "/0/1", **{'HTTP_AUTHORIZATION': "token " + self.token})
+                              "/0/1", **{'HTTP_AUTHORIZATION':
+                                         "token " + self.token})
         content = response.content
         status = response.status_code
         logger.debug("Got response : " + str(status))
index 0d81ecc..4a48f58 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
 import json
 import time
+
+from engagementmanager.bus.messages.hourly_scheduled_message import HourlyScheduledMessage
 from engagementmanager.tests.test_base_transaction_entity import TestBaseTransactionEntity
-from django.test.testcases import TransactionTestCase
+from engagementmanager.apps import bus_service
 from django.conf import settings
 import mock
 from rest_framework.status import HTTP_202_ACCEPTED
-from engagementmanager.models import Vendor, Engagement, VF
-from engagementmanager.utils.constants import Constants, EngagementStage
+from engagementmanager.models import Vendor, Checklist
+from engagementmanager.utils.constants import Constants, EngagementStage, CheckListState
 from wheel.signatures import assertTrue
 
 
@@ -58,7 +60,7 @@ def get_or_create_bucket_mock(name):
                    'successful_ops': 4}],
               'epoch': 1499821200,
               'owner': 'staticfiles',
-              'time': '2017-07-12 01:00:00.000000Z'} 
+              'time': '2017-07-12 01:00:00.000000Z'}
 
     return bucket
 
@@ -66,12 +68,13 @@ def get_or_create_bucket_mock(name):
 def add_bucket_user_mock(user, bucket):
     RadosGatewayTestCase.users_added_to_mock.append(user)
     RadosGatewayTestCase.added_bucket = bucket
-    print("*****RadosGatewayTestCase.added_bucket*****",RadosGatewayTestCase.added_bucket)
+    print("*****RadosGatewayTestCase.added_bucket*****",
+          RadosGatewayTestCase.added_bucket)
 
 
 def remove_bucket_user_grants_mock(bucket, user):
     RadosGatewayTestCase.added_bucket = bucket
-    RadosGatewayTestCase.users_added_to_mock.remove(user) 
+    RadosGatewayTestCase.users_added_to_mock.remove(user)
 
 
 def blank_mock(vf):
@@ -79,32 +82,77 @@ def blank_mock(vf):
     pass
 
 
-@mock.patch('validationmanager.em_integration.vm_api.get_or_create_bucket', get_or_create_bucket_mock)
-@mock.patch('validationmanager.em_integration.vm_api.add_bucket_user', add_bucket_user_mock)
-@mock.patch('validationmanager.em_integration.vm_api.remove_bucket_user_grants', remove_bucket_user_grants_mock)
-@mock.patch('validationmanager.em_integration.vm_api.ensure_git_entities', blank_mock)
-@mock.patch('validationmanager.em_integration.vm_api.ensure_jenkins_job', blank_mock)
-@mock.patch('validationmanager.em_integration.vm_api.ensure_checklists', blank_mock)
+def get_rgwa_uasge_mock(
+        uid=None,
+        start=None,
+        end=None,
+        show_entries=False,
+        show_summary=False):
+    print("===--get_rgwa_uasge_mock was invoked--===")
+    return {
+        "entries": [
+            {
+                "buckets": [
+                    {
+                        "bucket": "static-engagement-manual-id_static-vf-name",
+                        "owner": "staticfiles",
+                        "categories": [
+                                 {
+                                     "category": "put_obj",
+                                     "bytes_sent": 0,
+                                     "bytes_received": 2948046,
+                                     "ops": 102,
+                                     "successful_ops": 102
+                                 }
+                        ],
+                        "time": "2017-09-07 21:00:00.000000Z",
+                        "epoch": 1504818000
+                    }
+                ],
+                "user": "staticfiles"
+            }
+        ]
+    }
+
+
+@mock.patch('validationmanager.em_integration.vm_api.get_or_create_bucket',
+            get_or_create_bucket_mock)
+@mock.patch('validationmanager.em_integration.vm_api.add_bucket_user',
+            add_bucket_user_mock)
+@mock.patch(
+    'validationmanager.em_integration.vm_api.remove_bucket_user_grants',
+    remove_bucket_user_grants_mock)
+@mock.patch(
+    'validationmanager.em_integration.vm_api.ensure_git_entities', blank_mock)
+@mock.patch(
+    'validationmanager.em_integration.vm_api.ensure_jenkins_job', blank_mock)
+@mock.patch(
+    'validationmanager.em_integration.vm_api.ensure_checklists', blank_mock)
 class RadosGatewayTestCase(TestBaseTransactionEntity):
     users_added_to_mock = []
     added_bucket = None
 
     def changeEngagementStage(self, stage):
-        self.urlStr = self.urlPrefix + "single-engagement/" + str(self.engagement.uuid) + "/stage/@stage"
+        self.urlStr = self.urlPrefix + "single-engagement/" + \
+            str(self.engagement.uuid) + "/stage/@stage"
         datajson = json.dumps(self.data, ensure_ascii=False)
-        response = self.c.put(self.urlStr.replace("@stage", stage), datajson,
-                              content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        response = self.c.put(
+            self.urlStr.replace("@stage",
+                                stage),
+            datajson,
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
         self.assertEqual(response.status_code, HTTP_202_ACCEPTED)
-        
+
     def waitForBucket(self):
         counter = 1
-        while (RadosGatewayTestCase.added_bucket == None and counter <=20):
+        while (RadosGatewayTestCase.added_bucket is None and counter <= 20):
             time.sleep(1)
         time.sleep(1)
-        if RadosGatewayTestCase.added_bucket == None :
+        if RadosGatewayTestCase.added_bucket is None:
             raise Exception("Max retries exceeded, failing test...")
             return False
-        elif RadosGatewayTestCase.added_bucket != None:
+        elif RadosGatewayTestCase.added_bucket is not None:
             return True
 
     def childSetup(self):
@@ -114,36 +162,72 @@ class RadosGatewayTestCase(TestBaseTransactionEntity):
         self.s3_host = settings.AWS_S3_HOST
         self.s3_port = settings.AWS_S3_PORT
 
-        vendor_uuid, self.service_provider = self.creator.createVendor(Constants.service_provider_company_name)
+        vendor_uuid, self.service_provider = self.creator.createVendor(
+            Constants.service_provider_company_name)
         self.urlStr = self.urlPrefix + "signup/"
-        self.admin, self.el, self.standard_user = self.creator.createAndGetDefaultRoles()
+        self.admin, self.el, self.standard_user = \
+            self.creator.createAndGetDefaultRoles()
 
         self.data = dict()
-        uuid, vendor = self.creator.createVendor(Constants.service_provider_company_name)
-        self.user = self.creator.createUser(vendor, self.randomGenerator("email"), self.randomGenerator(
-            "randomNumber"), self.randomGenerator("randomString"), self.standard_user, True)
+        uuid, vendor = self.creator.createVendor(
+            Constants.service_provider_company_name)
+        self.user = self.creator.createUser(
+            vendor,
+            self.randomGenerator("email"),
+            self.randomGenerator("randomNumber"),
+            self.randomGenerator("randomString"),
+            self.standard_user,
+            True)
 
-        self.params = '{"company":"' + str(self.user.company) + '","full_name":"' + self.user.full_name + '","email":"' \
-                      + self.user.email + '","phone_number":"' + self.user.phone_number + \
-                      '","password":"' + self.user.user.password + '","regular_email_updates":"' + \
+        self.params = '{"company":"' + str(self.user.company) + \
+            '","full_name":"' + self.user.full_name + '","email":"' \
+                      + self.user.email + '","phone_number":"' \
+                      + self.user.phone_number + \
+                      '","password":"' + self.user.user.password \
+                      + '","regular_email_updates":"' + \
                       str(self.user.regular_email_updates) + \
-                      '","is_service_provider_contact":"' + str(self.user.is_service_provider_contact) + '"}'
-        self.el_user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'el user', self.el, True)
-        self.peer_reviewer = self.creator.createUser(self.service_provider, self.randomGenerator(
-            "main-vendor-email"), self.randomGenerator("randomNumber"), self.randomGenerator("randomString"), self.el, True)
-
-        self.engagement = self.creator.createEngagement('just-a-fake-uuid', 'Validation', None)
+                      '","is_service_provider_contact":"' + \
+            str(self.user.is_service_provider_contact) + '"}'
+        self.el_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'el user',
+            self.el,
+            True)
+        self.admin_user = self.creator.createUser(
+            Vendor.objects.get(name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '12323245435',
+            'admin user',
+            self.admin,
+            True)
+        self.peer_reviewer = self.creator.createUser(
+            self.service_provider,
+            self.randomGenerator("main-vendor-email"),
+            self.randomGenerator("randomNumber"),
+            self.randomGenerator("randomString"),
+            self.el,
+            True)
+
+        self.engagement = self.creator.createEngagement(
+            'just-a-fake-uuid', 'Validation', None)
         self.engagement.reviewer = self.el_user
         self.engagement.peer_reviewer = self.peer_reviewer
         self.engagement.engagement_team.add(self.el_user, self.user)
-        self.engagement.engagement_manual_id = self.randomGenerator("randomString")
+        self.engagement.engagement_manual_id = self.randomGenerator(
+            "randomString")
         self.engagement.save()
         self.deploymentTarget = self.creator.createDeploymentTarget(
-            self.randomGenerator("randomString"), self.randomGenerator("randomString"))
-        self.vf = self.creator.createVF(self.randomGenerator("randomString"),
-                                        self.engagement, self.deploymentTarget, False, self.service_provider)
+            self.randomGenerator("randomString"),
+            self.randomGenerator("randomString"))
+        self.vf = self.creator.createVF(
+            self.randomGenerator("randomString"),
+            self.engagement,
+            self.deploymentTarget,
+            False,
+            self.service_provider)
         self.userToken = self.loginAndCreateSessionToken(self.user)
         self.ELtoken = self.loginAndCreateSessionToken(self.el_user)
 
@@ -151,28 +235,58 @@ class RadosGatewayTestCase(TestBaseTransactionEntity):
         self.assertTrue(self.added_bucket is None)
         self.changeEngagementStage(EngagementStage.Active.name)
         self.assertTrue(RadosGatewayTestCase.added_bucket is not None)
-        team_members_list = [entry for entry in self.engagement.engagement_team.all()]
+        team_members_list = [
+            entry for entry in self.engagement.engagement_team.all()]
         for team_member in team_members_list:
-            assertTrue(any(team_member.full_name == entity.full_name for entity in RadosGatewayTestCase.users_added_to_mock))
+            assertTrue(any(team_member.full_name ==
+                           entity.full_name for entity in
+                           RadosGatewayTestCase.users_added_to_mock))
 
-    
     def testDeleteUsersFromBucket(self):
         self.changeEngagementStage(EngagementStage.Active.name)
         self.changeEngagementStage(EngagementStage.Validated.name)
         self.waitForBucket()
         self.assertTrue(RadosGatewayTestCase.added_bucket is not None)
         self.assertTrue(RadosGatewayTestCase.users_added_to_mock == [])
-        
+
     def testDeleteUsersFromBucketWhichNotCreated(self):
         self.assertTrue(RadosGatewayTestCase.added_bucket is None)
         self.changeEngagementStage(EngagementStage.Validated.name)
         self.waitForBucket()
         self.assertTrue(RadosGatewayTestCase.added_bucket is not None)
         self.assertTrue(RadosGatewayTestCase.users_added_to_mock == [])
-        
+
     def testDeleteUsersFromBucketWhwenStageArchive(self):
         self.assertTrue(RadosGatewayTestCase.added_bucket is None)
         self.changeEngagementStage(EngagementStage.Archived.name)
         self.waitForBucket()
         self.assertTrue(RadosGatewayTestCase.added_bucket is not None)
         self.assertTrue(RadosGatewayTestCase.users_added_to_mock == [])
+
+    @mock.patch(
+        'validationmanager.rados.rgwa_client.RGWAClient.get_usage',
+        get_rgwa_uasge_mock)
+    def testImagePushedPolling(self):
+        self.engagement.engagement_manual_id = "static-engagement-manual-id"
+        self.engagement.save()
+        self.vf.name = "static-vf-name"
+        self.vf.save()
+        self.template = self.creator.createDefaultCheckListTemplate()
+        checklist = self.creator.createCheckList(
+            "cl-name",
+            "review",
+            1,
+            None,
+            self.engagement,
+            self.template,
+            self.admin_user,
+            self.el_user)
+        self.changeEngagementStage(EngagementStage.Active.name)
+        bus_service.send_message(HourlyScheduledMessage())
+        self.assertEqual(
+            Checklist.objects.get(
+                engagement=self.engagement,
+                state=CheckListState.automation.name).state,
+            CheckListState.automation.name)
+        # TODO: After adding Michael's Celery invoke function -> check that the
+        # image scan actually ran O.K.
index 15bcf2d..0c45ccb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -50,49 +50,81 @@ class TestEngagementSetStage(TestBaseEntity):
 
     def childSetup(self):
 
-        self.createVendors([Constants.service_provider_company_name, 'Amdocs'])
+        self.createVendors([Constants.service_provider_company_name,
+                            'Amdocs'])
         self.vendor = Vendor.objects.get(name='Amdocs')
-        self.service_provider = Vendor.objects.get(name=Constants.service_provider_company_name)
+        self.service_provider = Vendor.objects.get(
+            name=Constants.service_provider_company_name)
         self.createDefaultRoles()
 
         # For negative tests
-        self.user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'user', self.standard_user, True)
-        self.user2 = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'user2', self.standard_user, True)
+        self.user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'user',
+            self.standard_user,
+            True)
+        self.user2 = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'user2',
+            self.standard_user,
+            True)
         # Create users with role el (el+peer reviwer)
-        self.el_user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'el user', self.el, True)
-        self.peer_reviewer = self.creator.createUser(self.service_provider, self.randomGenerator(
-            "main-vendor-email"), self.randomGenerator("randomNumber"), self.randomGenerator("randomString"), self.el, True)
+        self.el_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'el user',
+            self.el,
+            True)
+        self.peer_reviewer = self.creator.createUser(
+            self.service_provider,
+            self.randomGenerator("main-vendor-email"),
+            self.randomGenerator("randomNumber"),
+            self.randomGenerator("randomString"),
+            self.el,
+            True)
         # Create a user with admin role
-        self.admin_user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), Constants.service_provider_admin_mail,
-            '55501000199', 'admin user', self.admin, True)
+        self.admin_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            Constants.service_provider_admin_mail,
+            '55501000199',
+            'admin user',
+            self.admin,
+            True)
 
-        self.engagement = self.creator.createEngagement('just-a-fake-uuid', 'Validation', None)
+        self.engagement = self.creator.createEngagement(
+            'just-a-fake-uuid', 'Validation', None)
         self.engagement.reviewer = self.el_user
         self.engagement.peer_reviewer = self.peer_reviewer
-        self.engagement.engagement_team.add(self.el_user, self.user, self.user2)
+        self.engagement.engagement_team.add(
+            self.el_user, self.user, self.user2)
         self.engagement.save()
 
         self.deploymentTarget = self.creator.createDeploymentTarget(
-            self.randomGenerator("randomString"), self.randomGenerator("randomString"))
-#         self.asInfrastructure = self.creator.createApplicationServiceInfrastructure(self.randomGenerator("randomString"))
-        self.vf = self.creator.createVF(self.randomGenerator("randomString"),
-                                        self.engagement, self.deploymentTarget, False, self.vendor)
-#         self.vf.service_infrastructures.add(self.asInfrastructure)
+            self.randomGenerator("randomString"),
+            self.randomGenerator("randomString"))
+        self.vf = self.creator.createVF(
+            self.randomGenerator("randomString"),
+            self.engagement,
+            self.deploymentTarget,
+            False,
+            self.vendor)
 
         self.data = dict()
         self.user_token = self.loginAndCreateSessionToken(self.user)
         self.user2_token = self.loginAndCreateSessionToken(self.user2)
         self.admin_token = self.loginAndCreateSessionToken(self.admin_user)
 
-    def loggerTestFailedOrSucceded(self, bool):
-        if bool:
+    def loggerTestFailedOrSucceded(self, bool_flag):
+        if bool_flag:
             logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
             logger.debug(" Test Succeeded")
             logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n")
@@ -106,23 +138,32 @@ class TestEngagementSetStage(TestBaseEntity):
         logger.debug(" Test 2 started: Admin removes user from the eng team!")
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n")
 
-        self.get_engagement_url = self.urlPrefix + "single-engagement/" + str(self.engagement.uuid)
+        self.get_engagement_url = self.urlPrefix + \
+            "single-engagement/" + str(self.engagement.uuid)
         self.urlStr = self.urlPrefix + "engagements/engagement-team/"
         self.data['eng_uuid'] = str(self.engagement.uuid)
         self.data['user_uuid'] = str(self.user.uuid)
 
         datajson = json.dumps(self.data, ensure_ascii=False)
 
-        logger.debug("**********************************************************************")
+        logger.debug(
+            "**************************************************")
         logger.debug("----- sending put request with body -----")
-        logger.debug("**********************************************************************")
+        logger.debug(
+            "**************************************************")
 
-        response = self.c.put(self.urlStr, datajson, content_type='application/json',
-                              **{'HTTP_AUTHORIZATION': "token " + self.admin_token})
+        response = self.c.put(self.urlStr,
+                              datajson,
+                              content_type='application/json',
+                              **{'HTTP_AUTHORIZATION': "token "
+                                 + self.admin_token})
         if (response.status_code != HTTP_204_NO_CONTENT):
             print(response.status_code)
-        response2 = self.c.get(self.get_engagement_url, {}, content_type='application/json',
-                               **{'HTTP_AUTHORIZATION': "token " + self.admin_token})
+        response2 = self.c.get(self.get_engagement_url,
+                               {},
+                               content_type='application/json',
+                               **{'HTTP_AUTHORIZATION': "token "
+                                  + self.admin_token})
 
         # Check if the user it still in the engagement team
         received_eng = json.loads(response2.content)
@@ -139,28 +180,40 @@ class TestEngagementSetStage(TestBaseEntity):
 
     def test_negative_remove_user_from_eng_team_by_another_user(self):
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
-        logger.debug(" Test 3 (Negative) started: User2 removes user1 from the eng team!")
+        logger.debug(
+            " Test 3 (Negative) started: User2 removes \
+            user1 from the eng team!")
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n")
 
-        self.get_engagement_url = self.urlPrefix + "single-engagement/" + str(self.engagement.uuid)
+        self.get_engagement_url = self.urlPrefix + \
+            "single-engagement/" + str(self.engagement.uuid)
         self.urlStr = self.urlPrefix + "engagements/engagement-team/"
         self.data['eng_uuid'] = str(self.engagement.uuid)
         self.data['user_uuid'] = str(self.user.uuid)
 
         datajson = json.dumps(self.data, ensure_ascii=False)
 
-        logger.debug("**********************************************************************")
+        logger.debug(
+            "**************************************************")
         logger.debug("----- sending put request with body -----")
-        logger.debug("**********************************************************************")
+        logger.debug(
+            "**************************************************")
 
-        response = self.c.put(self.urlStr, datajson, content_type='application/json',
-                              **{'HTTP_AUTHORIZATION': "token " + self.user2_token})
+        response = self.c.put(self.urlStr,
+                              datajson,
+                              content_type='application/json',
+                              **{'HTTP_AUTHORIZATION': "token "
+                                 + self.user2_token})
         if (response.status_code != HTTP_204_NO_CONTENT):
             print(response.status_code)
-        response2 = self.c.get(self.get_engagement_url, {}, content_type='application/json',
-                               **{'HTTP_AUTHORIZATION': "token " + self.admin_token})
+        response2 = self.c.get(self.get_engagement_url,
+                               {},
+                               content_type='application/json',
+                               **{'HTTP_AUTHORIZATION': "token "
+                                  + self.admin_token})
 
-        # Check if the user it still in the engagement team(it is supposed to remain there)
+        # Check if the user it still in the engagement team(it is supposed to
+        # remain there)
         received_eng = json.loads(response2.content)
         found = False
         for item in received_eng["engagement"]["engagement_team"]:
@@ -175,28 +228,40 @@ class TestEngagementSetStage(TestBaseEntity):
 
     def test_negative_remove_el_user_from_eng_team_by_admin(self):
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
-        logger.debug(" Test 4 (Negative) started: admin removes el_user from the eng team!")
+        logger.debug(
+            " Test 4 (Negative) started: admin removes \
+            el_user from the eng team!")
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n")
 
-        self.get_engagement_url = self.urlPrefix + "single-engagement/" + str(self.engagement.uuid)
+        self.get_engagement_url = self.urlPrefix + \
+            "single-engagement/" + str(self.engagement.uuid)
         self.urlStr = self.urlPrefix + "engagements/engagement-team/"
         self.data['eng_uuid'] = str(self.engagement.uuid)
         self.data['user_uuid'] = str(self.el_user.uuid)
 
         datajson = json.dumps(self.data, ensure_ascii=False)
 
-        logger.debug("**********************************************************************")
+        logger.debug(
+            "**************************************************")
         logger.debug("----- sending put request with body -----")
-        logger.debug("**********************************************************************")
+        logger.debug(
+            "**************************************************")
 
-        response = self.c.put(self.urlStr, datajson, content_type='application/json',
-                              **{'HTTP_AUTHORIZATION': "token " + self.admin_token})
+        response = self.c.put(self.urlStr,
+                              datajson,
+                              content_type='application/json',
+                              **{'HTTP_AUTHORIZATION': "token "
+                                 + self.admin_token})
         if (response.status_code != HTTP_204_NO_CONTENT):
             print(response.status_code)
-        response2 = self.c.get(self.get_engagement_url, {}, content_type='application/json',
-                               **{'HTTP_AUTHORIZATION': "token " + self.admin_token})
+        response2 = self.c.get(self.get_engagement_url,
+                               {},
+                               content_type='application/json',
+                               **{'HTTP_AUTHORIZATION': "token "
+                                  + self.admin_token})
 
-        # Check if the user it still in the engagement team(it is supposed to remain there)
+        # Check if the user it still in the engagement team(it is supposed to
+        # remain there)
         received_eng = json.loads(response2.content)
         found = False
         for item in received_eng["engagement"]["engagement_team"]:
index 13e4fe0..5c5cd2b 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -60,7 +60,8 @@ logger = LoggingServiceFactory.get_logger()
 class TestRequestDataManager(TransactionTestCase):
 
     def childSetup(self):
-        logger.debug("---------------------- TestCase " + self.__class__.__name__ + " ----------------------")
+        logger.debug("---------------------- TestCase " +
+                     self.__class__.__name__ + " ----------------------")
         self.urlPrefix = "/%s/v1/engmgr/" % settings.PROGRAM_NAME_URL_PREFIX
         self.c = Client()
         self.creator = VvpEntitiesCreator()
@@ -69,24 +70,30 @@ class TestRequestDataManager(TransactionTestCase):
             vendorUuid, vendor = self.creator.createVendor(vendor)
             logger.debug(vendorUuid)
 
-        self.admin, self.el, self.standard_user = self.creator.createAndGetDefaultRoles()
+        self.admin, self.el, self.standard_user = \
+            self.creator.createAndGetDefaultRoles()
 
         # Create a user with role el
         self.el_user = self.creator.createUser(
-            Vendor.objects.get(name=Constants.service_provider_company_name), self.creator.randomGenerator("main-vendor-email"),
+            Vendor.objects.get(name=Constants.service_provider_company_name),
+            self.creator.randomGenerator("main-vendor-email"),
             '55501000199', 'el user', self.el, True)
         self.peer_review_user = self.creator.createUser(
-            Vendor.objects.get(name=Constants.service_provider_company_name), self.creator.randomGenerator("main-vendor-email"),
+            Vendor.objects.get(name=Constants.service_provider_company_name),
+            self.creator.randomGenerator("main-vendor-email"),
             '55501000199', 'peer-reviewer user', self.el, True)
         # Create a user with role standard_user
         self.user = self.creator.createUser(
-            Vendor.objects.get(name='Other'), self.creator.randomGenerator("main-vendor-email"),
+            Vendor.objects.get(name='Other'), self.creator.randomGenerator(
+                "main-vendor-email"),
             '55501000199', 'user', self.standard_user, True)
         self.user_not_team = self.creator.createUser(
-            Vendor.objects.get(name='Other'), self.creator.randomGenerator("main-vendor-email"),
+            Vendor.objects.get(name='Other'), self.creator.randomGenerator(
+                "main-vendor-email"),
             '55501000199', 'user2', self.standard_user, True)
 #         # Create an Engagement with team
-        self.engagement = self.creator.createEngagement('just-a-fake-uuid', 'Validation', None)
+        self.engagement = self.creator.createEngagement(
+            'just-a-fake-uuid', 'Validation', None)
         self.engagement.engagement_team.add(self.user, self.el_user)
         self.engagement.reviewer = self.el_user
         self.engagement.peer_reviewer = self.peer_review_user
@@ -99,7 +106,8 @@ class TestRequestDataManager(TransactionTestCase):
         urlStr = self.urlPrefix + 'engagements/${uuid}/status'
         myjson = json.dumps({"description": "blah blah"}, ensure_ascii=False)
         response = self.c.post(urlStr.replace('${uuid}', str(
-            self.engagement.uuid)), myjson, content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+            self.engagement.uuid)), myjson, content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
         self.created_status = json.loads(response.content)
 
     def my_task(self, eng_id):
@@ -121,11 +129,13 @@ class TestRequestDataManager(TransactionTestCase):
         assert request_data_mgr.get_request_data()._eng_uuid == eng_id
         assert request_data_mgr.get_eng_uuid() == eng_id
 
-        # Checks that the allocated thread from testRequestDataManager is the same thread running in inner function
+        # Checks that the allocated thread from testRequestDataManager is the
+        # same thread running in inner function
         assert request_data_mgr.get_request_data()._cl_uuid == thread_local_id
         assert request_data_mgr.get_cl_uuid() == thread_local_id
 
-        print('thread: ' + str(thread_local_id) + '. request data : ' + str(request_data_mgr.get_request_data_vars()))
+        print('thread: ' + str(thread_local_id) + '. request data : ' +
+              str(request_data_mgr.get_request_data_vars()))
         return "OK"
 
     def lauchTests(self):
@@ -135,8 +145,6 @@ class TestRequestDataManager(TransactionTestCase):
             future1 = executor.submit(self.my_task, "eng#" + str(i))
             assert future1.result() == "OK"
 
-    ########### TESTS ###########
-
     def testRequestDataManager(self):
         executor = ThreadPoolExecutor(max_workers=2)
         executor.submit(self.lauchTests)
@@ -145,11 +153,13 @@ class TestRequestDataManager(TransactionTestCase):
     def testMultipleRequestsInParallel(self):
         self.childSetup()
         number_of_concurrent_requests = 10
-        executor = ThreadPoolExecutor(max_workers=number_of_concurrent_requests)
+        executor = ThreadPoolExecutor(
+            max_workers=number_of_concurrent_requests)
 
         def close_db_connections(func, *args, **kwargs):
             """
-            Decorator to explicitly close db connections during threaded execution
+            Decorator to explicitly close db connections,
+            during threaded execution.
 
             Note this is necessary to work around:
             https://code.djangoproject.com/ticket/22420
@@ -160,7 +170,8 @@ class TestRequestDataManager(TransactionTestCase):
                     ret = func(*args, **kwargs)
                 finally:
                     for conn in connections.all():
-                        logger.debug("Closing DB connection. connection=" + str(conn))
+                        logger.debug(
+                            "Closing DB connection. connection=" + str(conn))
                         conn.close()
                 return ret
             return _close_db_connections
@@ -172,18 +183,24 @@ class TestRequestDataManager(TransactionTestCase):
             logger.debug("START - " + metadata)
 
             myjson = json.dumps(
-                {"eng_status_uuid": self.created_status['uuid'], "description": "blah2 blah2"}, ensure_ascii=False)
+                {"eng_status_uuid": self.created_status['uuid'],
+                 "description": "blah2 blah2"}, ensure_ascii=False)
             response = self.c.put(urlStr.replace('${uuid}', str(
-                self.engagement.uuid)), myjson, content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.token})
+                self.engagement.uuid)), myjson,
+                content_type='application/json',
+                **{'HTTP_AUTHORIZATION': "token " + self.token})
             print('Got response : ' + str(response.status_code))
             self.assertEqual(response.status_code, HTTP_401_UNAUTHORIZED)
 
             time.sleep(randint(0, 1))
 
             myjson = json.dumps(
-                {"eng_status_uuid": self.created_status['uuid'], "description": "blah2 blah2"}, ensure_ascii=False)
+                {"eng_status_uuid": self.created_status['uuid'],
+                 "description": "blah2 blah2"}, ensure_ascii=False)
             response = self.c.put(urlStr.replace('${uuid}', str(
-                self.engagement.uuid)), myjson, content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + token})
+                self.engagement.uuid)), myjson,
+                content_type='application/json',
+                **{'HTTP_AUTHORIZATION': "token " + token})
             print('Got response : ' + str(response.status_code))
             self.assertEqual(response.status_code, HTTP_200_OK)
 
@@ -193,10 +210,12 @@ class TestRequestDataManager(TransactionTestCase):
 
         for i in range(0, number_of_concurrent_requests):
             eluser = self.creator.createUser(
-                Vendor.objects.get(name='Other'), self.creator.randomGenerator("main-vendor-email"),
+                Vendor.objects.get(name='Other'), self.creator.randomGenerator(
+                    "main-vendor-email"),
                 '55501000199', 'user' + str(i), self.el, True)
             token = self.jwt_service.create_token(eluser.user)
-            self.engagement = self.creator.createEngagement('just-a-fake-uuid', 'Validation', None)
+            self.engagement = self.creator.createEngagement(
+                'just-a-fake-uuid', 'Validation', None)
             self.engagement.engagement_team.add(eluser)
             self.engagement.reviewer = eluser
             self.engagement.peer_reviewer = self.peer_review_user
index b544001..49a76e6 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -44,9 +44,15 @@ class TestResendActivationEmail(TestBaseEntity):
 
     def childSetup(self):
         self.createDefaultRoles()
-        uuid, vendor = self.creator.createVendor(Constants.service_provider_company_name)
-        self.user = self.creator.createUser(vendor, self.randomGenerator("email"), self.randomGenerator(
-            "randomNumber"), self.randomGenerator("randomString"), self.standard_user, False)
+        uuid, vendor = self.creator.createVendor(
+            Constants.service_provider_company_name)
+        self.user = self.creator.createUser(
+            vendor,
+            self.randomGenerator("email"),
+            self.randomGenerator("randomNumber"),
+            self.randomGenerator("randomString"),
+            self.standard_user,
+            False)
         self.urlStr = self.urlPrefix + \
             "users/activation-mail/" + self.user.uuid
         self.params = {"email": self.user.email}
index 7cfdd54..c4c8bb4 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -47,13 +47,19 @@ class TestResetPasswordTestCase(TestBaseEntity):
 
     def childSetup(self):
 
-        self.createVendors([Constants.service_provider_company_name, 'Amdocs'])
+        self.createVendors([Constants.service_provider_company_name,
+                            'Amdocs'])
         self.createDefaultRoles()
 
         # Create a user with role el
-        self.user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'user', self.standard_user, True)
+        self.user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'user',
+            self.standard_user,
+            True)
 
         self.urlStr = self.urlPrefix + "users/pwd/sendresetinstr/"
         self.data = dict()
@@ -65,11 +71,18 @@ class TestResetPasswordTestCase(TestBaseEntity):
     def resetPwd(self, expectedStatus=200, httpMethod="PUT"):
         self.accountData = json.dumps(self.data, ensure_ascii=False)
         if (httpMethod == "PUT"):
-            response = self.c.put(self.urlStr, self.accountData, content_type='application/json',
-                                  **{'HTTP_AUTHORIZATION': "token " + self.token})
+            response = self.c.put(self.urlStr,
+                                  self.accountData,
+                                  content_type='application/json',
+                                  **{'HTTP_AUTHORIZATION': "token "
+                                     + self.token})
         elif (httpMethod == "POST"):
-            response = self.c.post(self.urlStr, self.accountData, content_type='application/json',
-                                   **{'HTTP_AUTHORIZATION': "token " + self.token})
-        print('Got response : ' + str(response.status_code) + " Expecting " + str(expectedStatus))
+            response = self.c.post(self.urlStr,
+                                   self.accountData,
+                                   content_type='application/json',
+                                   **{'HTTP_AUTHORIZATION': "token "
+                                      + self.token})
+        print('Got response : ' + str(response.status_code) +
+              " Expecting " + str(expectedStatus))
         self.assertEqual(response.status_code, expectedStatus)
         return response
index a65f5b3..06bad54 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -59,7 +59,7 @@ class Test_ValidateArgs(object):
         self.valid_args = {
             'foo': ['foo1', 'foo2'],
             'bar': [1, 2, 3],
-            }
+        }
 
     def test_unconstrained(self):
         _validate_args(self.valid_args, baz="quux")
@@ -89,7 +89,7 @@ class TestRGWAClientMethods(object):
             access_key=self.access_key,
             secret_key=self.secret_key,
             base_url=Constants.rgwa_base_url
-            )
+        )
 
     def test_get_usage(self, r):
         self.conn.get_usage(uid='foo', show_entries=True)
@@ -98,9 +98,9 @@ class TestRGWAClientMethods(object):
             method='get',
             json={},
             params={'show-entries': True, 'show-summary': False, 'uid': 'foo'},
-            url=Constants.rgwa_base_url+'/usage',
+            url=Constants.rgwa_base_url + '/usage',
             verify=True,
-            )
+        )
 
     def test_trim_usage(self, r):
         self.conn.trim_usage(uid='foo', remove_all=True)
@@ -111,7 +111,7 @@ class TestRGWAClientMethods(object):
             params={'remove-all': True, 'uid': 'foo'},
             url='http://localhost:8123/admin/usage',
             verify=True,
-            )
+        )
 
     def test_get_user(self, r):
         self.conn.get_user(uid='foo')
@@ -120,9 +120,9 @@ class TestRGWAClientMethods(object):
             method='get',
             json={},
             params={'uid': 'foo'},
-            url=Constants.rgwa_base_url+'/user',
+            url=Constants.rgwa_base_url + '/user',
             verify=True,
-            )
+        )
 
     # Marked FIXME because we experience diminishing returns here. All the
     # methods in the library are basically one-liner calls to the common
@@ -134,80 +134,103 @@ class TestRGWAClientMethods(object):
 
     @expectedFailure
     def test_create_user(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
+
     @expectedFailure
     def test_modify_user(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
+
     @expectedFailure
     def test_remove_user(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
+
     @expectedFailure
     def test_create_subuser(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
+
     @expectedFailure
     def test_modify_subuser(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
+
     @expectedFailure
     def test_remove_subuser(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
+
     @expectedFailure
     def test_create_key(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
+
     @expectedFailure
     def test_remove_key(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
+
     @expectedFailure
     def test_get_bucket(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
+
     @expectedFailure
     def test_check_bucket_index(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
+
     @expectedFailure
     def test_remove_bucket(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
+
     @expectedFailure
     def test_unlink_bucket(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
+
     @expectedFailure
     def test_link_bucket(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
+
     @expectedFailure
     def test_remove_object(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
+
     @expectedFailure
     def test_get_policy(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
+
     @expectedFailure
     def test_add_capability(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
+
     @expectedFailure
     def test_remove_capability(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
+
     @expectedFailure
     def test_get_quota(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
+
     @expectedFailure
     def test_set_quota(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
+
     @expectedFailure
     def test_get_user_quota(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
+
     @expectedFailure
     def test_set_user_quota(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
+
     @expectedFailure
     def test_get_user_bucket_quota(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
+
     @expectedFailure
     def test_set_user_bucket_quota(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
 
     @expectedFailure
     def test_get_users(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
+
     @expectedFailure
     def test_get_buckets(self, r):
-        raise NotImplementedError # FIXME
+        raise NotImplementedError  # FIXME
 
 
 # FIXME TODO Add integration tests against a local ceph radosgw instance,
index 1b986ae..a7a88f8 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
 from engagementmanager.models import Vendor, Checklist, ChecklistDecision, \
-    ChecklistLineItem, ChecklistSection
+    ChecklistLineItem
 from engagementmanager.tests.test_base_entity import TestBaseEntity
-from engagementmanager.utils.constants import CheckListLineType, \
+from engagementmanager.utils.constants import \
     CheckListDecisionValue, CheckListState, ChecklistDefaultNames, Constants
 from rest_framework.status import HTTP_200_OK
 from uuid import uuid4
 import json
 from engagementmanager.service.logging_service import LoggingServiceFactory
-from mocks.jenkins_mock.services.jenkins_tests_validation_service import JenkinsTestsResultsSvc
+from mocks.jenkins_mock.services.jenkins_tests_validation_service import \
+    JenkinsTestsResultsSvc
 
 logger = LoggingServiceFactory.get_logger()
 
@@ -65,20 +66,40 @@ class TestChecklistSetState(TestBaseEntity):
         self.createDefaultRoles()
 
         # For negative tests
-        self.user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'user', self.standard_user, True)
+        self.user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'user',
+            self.standard_user,
+            True)
         # Create users with role el (el+peer reviwer)
-        self.el_user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'el user', self.el, True)
-        self.peer_review_user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'peer-reviewer user', self.el, True)
+        self.el_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'el user',
+            self.el,
+            True)
+        self.peer_review_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'peer-reviewer user',
+            self.el,
+            True)
         # Create a user with admin role
-        self.admin_user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), Constants.service_provider_admin_mail,
-            '55501000199', 'admin user', self.admin, True)
+        self.admin_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            Constants.service_provider_admin_mail,
+            '55501000199',
+            'admin user',
+            self.admin,
+            True)
 
         self.template = self.creator.createDefaultCheckListTemplate()
         self.engagement = self.creator.createEngagement(
@@ -89,23 +110,42 @@ class TestChecklistSetState(TestBaseEntity):
         self.engagement.save()
 
         self.deploymentTarget = self.creator.createDeploymentTarget(
-            self.randomGenerator("randomString"), self.randomGenerator("randomString"))
-        self.vf = self.creator.createVF(self.randomGenerator("randomString"),
-                                        self.engagement, self.deploymentTarget, False, self.vendor)
+            self.randomGenerator("randomString"),
+            self.randomGenerator("randomString"))
+        self.vf = self.creator.createVF(
+            self.randomGenerator("randomString"),
+            self.engagement,
+            self.deploymentTarget,
+            False,
+            self.vendor)
 
         self.clbodydata = dict()
         self.initCLBody()
-        self.checklist = Checklist.objects.create(uuid=uuid4(), name=self.clbodydata['checkListName'], validation_cycle=1, associated_files=self.clbodydata[
-                                                  'checkListAssociatedFiles'], engagement=self.engagement, template=self.template, creator=self.el_user, owner=self.el_user)
+        self.checklist = Checklist.objects.create(
+            uuid=uuid4(),
+            name=self.clbodydata['checkListName'],
+            validation_cycle=1,
+            associated_files=self.clbodydata['checkListAssociatedFiles'],
+            engagement=self.engagement,
+            template=self.template,
+            creator=self.el_user,
+            owner=self.el_user)
         self.checklist.save()
 
         self.line_items = ChecklistLineItem.objects.filter(
-            template=self.checklist.template)[:JenkinsTestsResultsSvc().num_of_auto_tests]
+            template=self.checklist.template)[
+            :JenkinsTestsResultsSvc().num_of_auto_tests]
 
         self.decision = ChecklistDecision.objects.create(
-            uuid=uuid4(), checklist=self.checklist, template=self.template, lineitem=self.line_items[0])
+            uuid=uuid4(),
+            checklist=self.checklist,
+            template=self.template,
+            lineitem=self.line_items[0])
         self.decision2 = ChecklistDecision.objects.create(
-            uuid=uuid4(), checklist=self.checklist, template=self.template, lineitem=self.line_items[1])
+            uuid=uuid4(),
+            checklist=self.checklist,
+            template=self.template,
+            lineitem=self.line_items[1])
         self.decision.save()
         self.decision2.save()
         self.data = dict()
@@ -114,14 +154,8 @@ class TestChecklistSetState(TestBaseEntity):
         self.ELtoken = self.loginAndCreateSessionToken(self.el_user)
         self.admin_token = self.loginAndCreateSessionToken(self.admin_user)
 
-    def initCLBody(self):
-        self.clbodydata['checkListName'] = ChecklistDefaultNames.HEAT_TEMPLATES
-        self.clbodydata['checkListTemplateUuid'] = str(self.template.uuid)
-        self.clbodydata[
-            'checkListAssociatedFiles'] = "[\"file0/f69f4ce7-51d5-409c-9d0e-ec6b1e79df28\", \"file1/f69f4ce7-51d5-409c-9d0e-ec6b1e79df28\", \"file2/f69f4ce7-51d5-409c-9d0e-ec6b1e79df28\"]"
-
-    def loggerTestFailedOrSucceded(self, bool):
-        if bool:
+    def loggerTestFailedOrSucceded(self, bool_flag):
+        if bool_flag:
             logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
             logger.debug(" Test Succeeded")
             logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n")
@@ -137,93 +171,147 @@ class TestChecklistSetState(TestBaseEntity):
 
         self.urlStr = self.urlPrefix + "checklist/@cl_uuid/state/"
         self.get_checklist_url = self.urlPrefix + "checklist/@cl_uuid"
-        self.url_for_decision = self.urlPrefix + "checklist/decision/@decision_uuid"
+        self.url_for_decision = self.urlPrefix + \
+            "checklist/decision/@decision_uuid"
 
         self.data['decline'] = "False"
         self.data['description'] = "BLA BLA BLA"
         datajson = json.dumps(self.data, ensure_ascii=False)
 
         logger.debug(
-            "**********************************************************************")
+            "***********************************************")
         logger.debug("----- 1. Current state  is " +
                      self.checklist.state + " -----")
         logger.debug(
-            "**********************************************************************")
+            "***********************************************")
 
         logger.debug(
-            "----- 1.1 Wishing to move from pending state to automation state -----")
+            "----- 1.1 Wishing to move from pending \
+            state to automation state -----")
         logger.debug(
-            "----- 1.2 Performing a request to move forward to the next state -----")
-        response = self.c.put(self.urlStr.replace("@cl_uuid", str(self.checklist.uuid)), datajson,
-                              content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
-        logger.debug('1.3 Please Notice, you got a ' + str(response.status_code) +
-                     ' response, and was expecting a ' + str(HTTP_200_OK) + ' response')
+            "----- 1.2 Performing a request to move \
+            forward to the next state -----")
+        response = self.c.put(self.urlStr.replace("@cl_uuid",
+                                                  str(self.checklist.uuid)),
+                              datajson,
+                              content_type='application/json',
+                              **{'HTTP_AUTHORIZATION': "token "
+                                 + self.ELtoken})
+        logger.debug('1.3 Please Notice, you got a ' +
+                     str(response.status_code) +
+                     ' response, and was expecting a ' +
+                     str(HTTP_200_OK) +
+                     ' response')
         self.assertEqual(response.status_code, HTTP_200_OK)
 
         logger.debug(
-            "----- 2 Test engine Mock retrieved tests results, hence checklist state moved to review state. -----")
+            "----- 2 Test engine Mock retrieved tests results, \
+            hence checklist state moved to review state. -----")
         logger.debug(
             "----- 3.1 changing decisions' review value to APPROVED -----")
         decisions = ChecklistDecision.objects.filter(checklist=self.checklist)
         for dec in decisions:
             self.data['value'] = "approved"
             datajson = json.dumps(self.data, ensure_ascii=False)
-            response = self.c.put(self.url_for_decision.replace("@decision_uuid", str(dec.uuid)), datajson,
-                                  content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+            response = self.c.put(
+                self.url_for_decision.replace(
+                    "@decision_uuid", str(
+                        dec.uuid)), datajson,
+                content_type='application/json', **{
+                    'HTTP_AUTHORIZATION': "token " + self.ELtoken})
         logger.debug(
-            "----- 3.2 Wishing to move from review state to peer_review state -----")
+            "----- 3.2 Wishing to move from review state to \
+            peer_review state -----")
         logger.debug(
-            "----- 3.3 Performing a request to move forward to the next state -----")
+            "----- 3.3 Performing a request to move forward \
+            to the next state -----")
 
-        response = self.c.put(self.urlStr.replace("@cl_uuid", str(self.checklist.uuid)), datajson,
-                              content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
-        logger.debug('3.4 you got a ' + str(response.status_code) +
-                     ' response, and was expecting a ' + str(HTTP_200_OK) + ' response')
+        response = self.c.put(self.urlStr.replace("@cl_uuid",
+                                                  str(self.checklist.uuid)),
+                              datajson,
+                              content_type='application/json',
+                              **{'HTTP_AUTHORIZATION': "token "
+                                 + self.ELtoken})
+        logger.debug('3.4 you got a ' +
+                     str(response.status_code) +
+                     ' response, and was expecting a ' +
+                     str(HTTP_200_OK) +
+                     ' response')
         self.assertEqual(response.status_code, HTTP_200_OK)
         logger.debug(
-            "----- 4.1 changing the cl peer_reviews' decisions values to NA -----")
+            "----- 4.1 changing the cl peer_reviews' \
+            decisions values to NA -----")
         for dec in decisions:
-            dec.peer_review_value = CheckListDecisionValue.not_relevant.name  # @UndefinedVariable
+            dec.peer_review_value = CheckListDecisionValue.not_relevant.name
             dec.save()
 
         logger.debug(
-            "----- 4.2 Wishing to move from peer_review state to approval state -----")
+            "----- 4.2 Wishing to move from peer_review \
+            state to approval state -----")
         logger.debug(
-            "----- 4.3 Performing a request to move forward to the next state -----")
-        response = self.c.put(self.urlStr.replace("@cl_uuid", str(self.checklist.uuid)), datajson,
-                              content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.peer_review_token})
-        logger.debug('4.4 Please Notice, you got a ' + str(response.status_code) +
-                     ' response, and was expecting a ' + str(HTTP_200_OK) + ' response')
+            "----- 4.3 Performing a request to move \
+            forward to the next state -----")
+        response = self.c.put(self.urlStr.replace("@cl_uuid",
+                                                  str(self.checklist.uuid)),
+                              datajson,
+                              content_type='application/json',
+                              **{'HTTP_AUTHORIZATION': "token "
+                                 + self.peer_review_token})
+        logger.debug('4.4 Please Notice, you got a ' +
+                     str(response.status_code) +
+                     ' response, and was expecting a ' +
+                     str(HTTP_200_OK) +
+                     ' response')
         self.assertEqual(response.status_code, HTTP_200_OK)
         logger.debug(
-            "----- 5.1 Wishing to move from approval state to handoff state -----")
+            "----- 5.1 Wishing to move from approval \
+            state to handoff state -----")
         logger.debug(
-            "----- 5.2 Performing a request to move forward to the next state -----")
-        response = self.c.put(self.urlStr.replace("@cl_uuid", str(self.checklist.uuid)), datajson,
-                              content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.admin_token})
-        logger.debug('Please Notice, you got a ' + str(response.status_code) +
-                     ' response, and was expecting a ' + str(HTTP_200_OK) + ' response')
+            "----- 5.2 Performing a request to move \
+            forward to the next state -----")
+        response = self.c.put(self.urlStr.replace("@cl_uuid",
+                                                  str(self.checklist.uuid)),
+                              datajson,
+                              content_type='application/json',
+                              **{'HTTP_AUTHORIZATION': "token "
+                                 + self.admin_token})
+        logger.debug('Please Notice, you got a ' +
+                     str(response.status_code) +
+                     ' response, and was expecting a ' +
+                     str(HTTP_200_OK) +
+                     ' response')
         self.assertEqual(response.status_code, HTTP_200_OK)
         logger.debug(
-            "----- 6.1 Wishing to move from handoff state to closed state -----")
+            "----- 6.1 Wishing to move from handoff \
+            state to closed state -----")
         logger.debug(
-            "----- 6.2 Performing a request to move forward to the last state -----")
-        response = self.c.put(self.urlStr.replace("@cl_uuid", str(self.checklist.uuid)), datajson,
-                              content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
-        logger.debug('Please Notice, you got a ' + str(response.status_code) +
-                     ' response, and was expecting a ' + str(HTTP_200_OK) + ' response')
+            "----- 6.2 Performing a request to move \
+            forward to the last state -----")
+        response = self.c.put(
+            self.urlStr.replace("@cl_uuid", str(self.checklist.uuid)),
+            datajson,
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        logger.debug('Please Notice, you got a ' +
+                     str(response.status_code) +
+                     ' response, and was expecting a ' +
+                     str(HTTP_200_OK) +
+                     ' response')
         self.assertEqual(response.status_code, HTTP_200_OK)
         self.loggerTestFailedOrSucceded(True)
 
     '''
-        This test checks that the signal is sent and responds with 200OK. Also that the signal logic change the checklist state to automation
+        This test checks that the signal is sent and \
+        responds with 200OK. Also that the signal \
+        logic change the checklist state to automation
     '''
 
     def testClFromPendingToAutomationSignal(self):
 
         self.urlStr = self.urlPrefix + "checklist/@cl_uuid/state/"
         self.get_checklist_url = self.urlPrefix + "checklist/@cl_uuid"
-        self.url_for_decision = self.urlPrefix + "checklist/decision/@decision_uuid"
+        self.url_for_decision = self.urlPrefix + \
+            "checklist/decision/@decision_uuid"
 
         self.data['decline'] = "False"
         self.data['description'] = "BLA BLA BLA"
@@ -232,6 +320,9 @@ class TestChecklistSetState(TestBaseEntity):
         cl = Checklist.objects.get(uuid=self.checklist.uuid)
         cl.state = CheckListState.pending.name  # @UndefinedVariable
         cl.save()
-        res1 = self.c.put(self.urlStr.replace("@cl_uuid", str(self.checklist.uuid)), datajson,
-                          content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        res1 = self.c.put(self.urlStr.replace("@cl_uuid",
+                                              str(self.checklist.uuid)),
+                          datajson,
+                          content_type='application/json',
+                          **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
         self.assertEqual(res1.status_code, HTTP_200_OK)
index f26b70b..70651a8 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -53,44 +53,69 @@ class TestEngagementSetStage(TestBaseEntity):
 
         self.createVendors([Constants.service_provider_company_name, 'Amdocs'])
         self.vendor = Vendor.objects.get(name='Amdocs')
-        self.service_provider = Vendor.objects.get(name=Constants.service_provider_company_name)
+        self.service_provider = Vendor.objects.get(
+            name=Constants.service_provider_company_name)
         self.createDefaultRoles()
 
         # For negative tests
-        self.user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'user', self.standard_user, True)
+        self.user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'user',
+            self.standard_user,
+            True)
         # Create users with role el (el+peer reviwer)
-        self.el_user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'el user', self.el, True)
-        self.peer_reviewer = self.creator.createUser(self.service_provider, self.randomGenerator(
-            "main-vendor-email"), self.randomGenerator("randomNumber"), self.randomGenerator("randomString"), self.el, True)
+        self.el_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'el user',
+            self.el,
+            True)
+        self.peer_reviewer = self.creator.createUser(
+            self.service_provider,
+            self.randomGenerator("main-vendor-email"),
+            self.randomGenerator("randomNumber"),
+            self.randomGenerator("randomString"),
+            self.el,
+            True)
         # Create a user with admin role
-        self.admin_user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), Constants.service_provider_admin_mail,
-            '55501000199', 'admin user', self.admin, True)
+        self.admin_user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            Constants.service_provider_admin_mail,
+            '55501000199',
+            'admin user',
+            self.admin,
+            True)
 
-        self.engagement = self.creator.createEngagement('just-a-fake-uuid', 'Validation', None)
+        self.engagement = self.creator.createEngagement(
+            'just-a-fake-uuid', 'Validation', None)
         self.engagement.reviewer = self.el_user
         self.engagement.peer_reviewer = self.peer_reviewer
         self.engagement.engagement_team.add(self.el_user, self.user)
         self.engagement.save()
 
         self.deploymentTarget = self.creator.createDeploymentTarget(
-            self.randomGenerator("randomString"), self.randomGenerator("randomString"))
-#         self.asInfrastructure = self.creator.createApplicationServiceInfrastructure(self.randomGenerator("randomString"))
-        self.vf = self.creator.createVF(self.randomGenerator("randomString"),
-                                        self.engagement, self.deploymentTarget, False, self.vendor)
-#         self.vf.service_infrastructures.add(self.asInfrastructure)
+            self.randomGenerator("randomString"),
+            self.randomGenerator("randomString"))
+        self.vf = self.creator.createVF(
+            self.randomGenerator("randomString"),
+            self.engagement,
+            self.deploymentTarget,
+            False,
+            self.vendor)
 
         self.data = dict()
         self.user_token = self.loginAndCreateSessionToken(self.user)
         self.ELtoken = self.loginAndCreateSessionToken(self.el_user)
         self.admin_token = self.loginAndCreateSessionToken(self.admin_user)
 
-    def loggerTestFailedOrSucceded(self, bool):
-        if bool:
+    def loggerTestFailedOrSucceded(self, bool_flag):
+        if bool_flag:
             logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
             logger.debug(" Test Succeeded")
             logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n")
@@ -101,107 +126,210 @@ class TestEngagementSetStage(TestBaseEntity):
 
     def testSetEngagementStageFullWorkFlowELUser(self):
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
-        logger.debug(" Test started: change from Intake to Active, using --EL-- user!")
+        logger.debug(
+            " Test started: change from Intake to Active, using --EL-- user!")
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n")
-        self.urlStr = self.urlPrefix + "single-engagement/" + str(self.engagement.uuid) + "/stage/@stage"
-        self.get_engagement_url = self.urlPrefix + "single-engagement/" + str(self.engagement.uuid)
+        self.urlStr = self.urlPrefix + "single-engagement/" + \
+            str(self.engagement.uuid) + "/stage/@stage"
+        self.get_engagement_url = self.urlPrefix + \
+            "single-engagement/" + str(self.engagement.uuid)
         datajson = json.dumps(self.data, ensure_ascii=False)
 
-        logger.debug("**********************************************************************")
-        logger.debug("----- 1. Current stage  is " + self.engagement.engagement_stage + " -----")
-        logger.debug("**********************************************************************")
+        logger.debug(
+            "************************************************")
+        logger.debug("----- 1. Current stage  is " +
+                     self.engagement.engagement_stage + " -----")
+        logger.debug(
+            "************************************************")
 
-        logger.debug("----- 1.1 Wishing to move from Intake stage to Active stage -----")
-        logger.debug("----- 1.2 Performing a request to move forward to the next stage -----")
-        response = self.c.put(self.urlStr.replace("@stage", EngagementStage.Active.name), datajson,
-                              content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
-        response2 = self.c.get(self.get_engagement_url, {}, content_type='application/json',
-                               **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        logger.debug(
+            "----- 1.1 Wishing to move from Intake \
+            stage to Active stage -----")
+        logger.debug(
+            "----- 1.2 Performing a request to move \
+            forward to the next stage -----")
+        response = self.c.put(
+            self.urlStr.replace("@stage", EngagementStage.Active.name),
+            datajson,
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        self.c.get(self.get_engagement_url,
+                   {},
+                   content_type='application/json',
+                   **{'HTTP_AUTHORIZATION': "token "
+                      + self.ELtoken})
 
         # Check if the correct activity was created for stage change to Active
-        self.notifcation_url = self.urlPrefix + "engagement/" + str(self.engagement.uuid) + "/activities/"
-        response3 = self.c.get(self.notifcation_url, {}, content_type='application/json',
-                               **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        self.notifcation_url = self.urlPrefix + "engagement/" + \
+            str(self.engagement.uuid) + "/activities/"
+        response3 = self.c.get(self.notifcation_url,
+                               {},
+                               content_type='application/json',
+                               **{'HTTP_AUTHORIZATION': "token "
+                                  + self.ELtoken})
         received_notification = json.loads(response3.content)[0]['description']
-        should_be = "Engagement stage is now Active for the following VF: ##vf_name##"
+        should_be = "Engagement stage is now Active " +\
+            "for the following VF: ##vf_name##"
         self.assertEqual(should_be, received_notification)
-        self.assertEqual(self.vf.name in json.loads(response3.content)[0]['metadata'], True)
-        logger.debug('1.3 Please Notice, you got a ' + str(response.status_code) +
-                     ' response, and was expecting a ' + str(HTTP_202_ACCEPTED) + ' response')
+        self.assertEqual(self.vf.name in json.loads(
+            response3.content)[0]['metadata'], True)
+        logger.debug('1.3 Please Notice, you got a ' +
+                     str(response.status_code) +
+                     ' response, and was expecting a ' +
+                     str(HTTP_202_ACCEPTED) +
+                     ' response')
         self.assertEqual(response.status_code, HTTP_202_ACCEPTED)
-        logger.debug("----- 2 Wishing to move from Active stage to Validated stage -----")
-        logger.debug("----- 2.1 Performing a request to move forward to the next stage -----")
-        response = self.c.put(self.urlStr.replace("@stage", EngagementStage.Validated.name), datajson,
-                              content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
-        logger.debug('2.3 Please Notice, you got a ' + str(response.status_code) +
-                     ' response, and was expecting a ' + str(HTTP_202_ACCEPTED) + ' response')
+        logger.debug(
+            "----- 2 Wishing to move from Active \
+            stage to Validated stage -----")
+        logger.debug(
+            "----- 2.1 Performing a request to move \
+            forward to the next stage -----")
+        response = self.c.put(
+            self.urlStr.replace("@stage", EngagementStage.Validated.name),
+            datajson,
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
+        logger.debug('2.3 Please Notice, you got a ' +
+                     str(response.status_code) +
+                     ' response, and was expecting a ' +
+                     str(HTTP_202_ACCEPTED) +
+                     ' response')
         self.assertEqual(response.status_code, HTTP_202_ACCEPTED)
-        logger.debug("----- 3.1 Wishing to move from Validated stage to Completed stage -----")
-        logger.debug("----- 3.2 Performing a request to move forward to the next stage -----")
-        response = self.c.put(self.urlStr.replace("@stage", EngagementStage.Completed.name), datajson,
-                              content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.ELtoken})
-        logger.debug('2.4 you got a ' + str(response.status_code) +
-                     ' response, and was expecting a ' + str(HTTP_202_ACCEPTED) + ' response')
+        logger.debug(
+            "----- 3.1 Wishing to move from Validated \
+            stage to Completed stage -----")
+        logger.debug(
+            "----- 3.2 Performing a request to move \
+            forward to the next stage -----")
+        response = self.c.put(
+            self.urlStr.replace("@stage", EngagementStage.Completed.name),
+            datajson,
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token "
+               + self.ELtoken})
+        logger.debug('2.4 you got a ' +
+                     str(response.status_code) +
+                     ' response, and was expecting a ' +
+                     str(HTTP_202_ACCEPTED) +
+                     ' response')
         self.assertEqual(response.status_code, HTTP_202_ACCEPTED)
         self.loggerTestFailedOrSucceded(True)
 
     def testSetEngagementStageFullWorkFlowAdminUser(self):
 
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
-        logger.debug(" Test started: change from Intake to Active, using --ADMIN-- user!")
+        logger.debug(
+            " Test started: change from Intake to \
+            Active, using --ADMIN-- user!")
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n")
 
-        self.urlStr = self.urlPrefix + "single-engagement/" + str(self.engagement.uuid) + "/stage/@stage"
-        self.get_engagement_url = self.urlPrefix + "single-engagement/" + str(self.engagement.uuid)
+        self.urlStr = self.urlPrefix + "single-engagement/" + \
+            str(self.engagement.uuid) + "/stage/@stage"
+        self.get_engagement_url = self.urlPrefix + \
+            "single-engagement/" + str(self.engagement.uuid)
         datajson = json.dumps(self.data, ensure_ascii=False)
 
-        logger.debug("**********************************************************************")
-        logger.debug("----- 1. Current stage  is " + self.engagement.engagement_stage + " -----")
-        logger.debug("**********************************************************************")
+        logger.debug(
+            "************************************************")
+        logger.debug("----- 1. Current stage  is " +
+                     self.engagement.engagement_stage + " -----")
+        logger.debug(
+            "************************************************")
 
-        logger.debug("----- 1.1 Wishing to move from Intake stage to Active stage -----")
-        logger.debug("----- 1.2 Performing a request to move forward to the next stage -----")
-        response = self.c.put(self.urlStr.replace("@stage", EngagementStage.Active.name), datajson,
-                              content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.admin_token})
-        logger.debug('1.3 Please Notice, you got a ' + str(response.status_code) +
-                     ' response, and was expecting a ' + str(HTTP_202_ACCEPTED) + ' response')
+        logger.debug(
+            "----- 1.1 Wishing to move from Intake stage to \
+            Active stage -----")
+        logger.debug(
+            "----- 1.2 Performing a request to move \
+            forward to the next stage -----")
+        response = self.c.put(self.urlStr.replace("@stage",
+                                                  EngagementStage.Active.name),
+                              datajson,
+                              content_type='application/json',
+                              **{'HTTP_AUTHORIZATION': "token "
+                                  + self.admin_token})
+        logger.debug('1.3 Please Notice, you got a ' +
+                     str(response.status_code) +
+                     ' response, and was expecting a ' +
+                     str(HTTP_202_ACCEPTED) +
+                     ' response')
         self.assertEqual(response.status_code, HTTP_202_ACCEPTED)
         self.loggerTestFailedOrSucceded(False)
-        logger.debug("----- 2 Wishing to move from Active stage to Validated stage -----")
-        logger.debug("----- 2.1 Performing a request to move forward to the next stage -----")
-        response = self.c.put(self.urlStr.replace("@stage", EngagementStage.Validated.name), datajson,
-                              content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.admin_token})
-        logger.debug('2.3 Please Notice, you got a ' + str(response.status_code) +
-                     ' response, and was expecting a ' + str(HTTP_202_ACCEPTED) + ' response')
+        logger.debug(
+            "----- 2 Wishing to move from Active \
+            stage to Validated stage -----")
+        logger.debug(
+            "----- 2.1 Performing a request to move \
+            forward to the next stage -----")
+        response = self.c.put(
+            self.urlStr.replace("@stage", EngagementStage.Validated.name),
+            datajson,
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token "
+               + self.admin_token})
+        logger.debug('2.3 Please Notice, you got a ' +
+                     str(response.status_code) +
+                     ' response, and was expecting a ' +
+                     str(HTTP_202_ACCEPTED) +
+                     ' response')
         self.assertEqual(response.status_code, HTTP_202_ACCEPTED)
-        logger.debug("----- 3 Wishing to move from Validated stage to Completed stage -----")
-        logger.debug("----- 3.1 Performing a request to move forward to the next stage -----")
-        response = self.c.put(self.urlStr.replace("@stage", EngagementStage.Completed.name), datajson,
-                              content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.admin_token})
-        logger.debug('2.4 you got a ' + str(response.status_code) +
-                     ' response, and was expecting a ' + str(HTTP_202_ACCEPTED) + ' response')
+        logger.debug(
+            "----- 3 Wishing to move from Validated stage \
+            to Completed stage -----")
+        logger.debug(
+            "----- 3.1 Performing a request to move forward \
+            to the next stage -----")
+        response = self.c.put(
+            self.urlStr.replace("@stage", EngagementStage.Completed.name),
+            datajson,
+            content_type='application/json',
+            **{'HTTP_AUTHORIZATION': "token " + self.admin_token})
+        logger.debug('2.4 you got a ' +
+                     str(response.status_code) +
+                     ' response, and was expecting a ' +
+                     str(HTTP_202_ACCEPTED) +
+                     ' response')
         self.assertEqual(response.status_code, HTTP_202_ACCEPTED)
         self.loggerTestFailedOrSucceded(True)
 
     def test_negative_set_eng_Stage(self):
 
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
-        logger.debug(" Test started: Negative test to change stage with un authorized user")
+        logger.debug(
+            " Test started: Negative test to change \
+            stage with un authorized user")
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n")
 
-        self.urlStr = self.urlPrefix + "single-engagement/" + str(self.engagement.uuid) + "/stage/@stage"
-        self.get_engagement_url = self.urlPrefix + "single-engagement/" + str(self.engagement.uuid)
+        self.urlStr = self.urlPrefix + "single-engagement/" + \
+            str(self.engagement.uuid) + "/stage/@stage"
+        self.get_engagement_url = self.urlPrefix + \
+            "single-engagement/" + str(self.engagement.uuid)
         datajson = json.dumps(self.data, ensure_ascii=False)
 
-        logger.debug("**********************************************************************")
-        logger.debug("----- 1. Current stage  is " + self.engagement.engagement_stage + " -----")
-        logger.debug("**********************************************************************")
+        logger.debug(
+            "************************************************")
+        logger.debug("----- 1. Current stage  is " +
+                     self.engagement.engagement_stage + " -----")
+        logger.debug(
+            "************************************************")
 
-        logger.debug("----- 1.1 Wishing to try move from Intake stage to Active stage AND FAIL! -----")
-        logger.debug("----- 1.2 Performing a request to move forward to the next stage -----")
-        response = self.c.put(self.urlStr.replace("@stage", EngagementStage.Active.name), datajson,
-                              content_type='application/json', **{'HTTP_AUTHORIZATION': "token " + self.user_token})
-        logger.debug('1.3 Please Notice, you got a ' + str(response.status_code) +
-                     ' response, and was expecting a ' + str(HTTP_401_UNAUTHORIZED) + ' response')
+        logger.debug(
+            "----- 1.1 Wishing to try move from Intake stage \
+            to Active stage AND FAIL! -----")
+        logger.debug(
+            "----- 1.2 Performing a request to move forward \
+            to the next stage -----")
+        response = self.c.put(self.urlStr.replace("@stage",
+                                                  EngagementStage.Active.name),
+                              datajson,
+                              content_type='application/json',
+                              **{'HTTP_AUTHORIZATION': "token "
+                                 + self.user_token})
+        logger.debug('1.3 Please Notice, you got a ' +
+                     str(response.status_code) +
+                     ' response, and was expecting a ' +
+                     str(HTTP_401_UNAUTHORIZED) +
+                     ' response')
         self.assertEqual(response.status_code, HTTP_401_UNAUTHORIZED)
         self.loggerTestFailedOrSucceded(True)
index 08b25b2..f4b5fbc 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -51,9 +51,14 @@ class TestUpdatePasswordTestCase(TestBaseEntity):
         self.createDefaultRoles()
 
         # Create a user with role el
-        self.user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
-            '55501000199', 'user', self.standard_user, True)
+        self.user = self.creator.createUser(
+            Vendor.objects.get(
+                name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
+            '55501000199',
+            'user',
+            self.standard_user,
+            True)
 
         self.urlStr = self.urlPrefix + "users/pwd/"
         self.data = dict()
@@ -66,16 +71,22 @@ class TestUpdatePasswordTestCase(TestBaseEntity):
     def updatePwd(self, expectedStatus=200, httpMethod="PUT"):
         self.accountData = json.dumps(self.data, ensure_ascii=False)
         if (httpMethod == "PUT"):
-            response = self.c.put(self.urlStr, self.accountData, content_type='application/json',
-                                  **{'HTTP_AUTHORIZATION': "token " + self.token})
+            response = self.c.put(self.urlStr,
+                                  self.accountData,
+                                  content_type='application/json',
+                                  **{'HTTP_AUTHORIZATION': "token "
+                                     + self.token})
         elif (httpMethod == "POST"):
-            response = self.c.post(self.urlStr, self.accountData, content_type='application/json',
-                                   **{'HTTP_AUTHORIZATION': "token " + self.token})
-        print('Got response : ' + str(response.status_code) + " Expecting " + str(expectedStatus))
+            response = self.c.post(self.urlStr,
+                                   self.accountData,
+                                   content_type='application/json',
+                                   **{'HTTP_AUTHORIZATION': "token "
+                                      + self.token})
+        print('Got response : ' + str(response.status_code) +
+              " Expecting " + str(expectedStatus))
         self.assertEqual(response.status_code, expectedStatus)
         return response
 
-    ### TESTS ###
     def testUpdatePasswordPositive(self):
         self.initBody()
         print("testUpdatePasswordPositive")
index fd0becd..5feefed 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -53,7 +53,8 @@ class TestUpdateUserAccountTestCase(TestBaseEntity):
 
         # Create a user with role el
         self.user = self.creator.createUser(Vendor.objects.get(
-            name=Constants.service_provider_company_name), self.randomGenerator("main-vendor-email"),
+            name=Constants.service_provider_company_name),
+            self.randomGenerator("main-vendor-email"),
             '55501000199', 'user', self.standard_user, True)
         print('-----------------------------------------------------')
         print('Created User:')
@@ -76,16 +77,19 @@ class TestUpdateUserAccountTestCase(TestBaseEntity):
     def updateAccount(self, expectedStatus=200, httpMethod="PUT"):
         self.accountData = json.dumps(self.data, ensure_ascii=False)
         if (httpMethod == "PUT"):
-            response = self.c.put(self.urlStr, self.accountData, content_type='application/json',
-                                  **{'HTTP_AUTHORIZATION': "token " + self.token})
+            response = self.c.put(self.urlStr, self.accountData,
+                                  content_type='application/json',
+                                  **{'HTTP_AUTHORIZATION': "token "
+                                     + self.token})
         elif (httpMethod == "POST"):
-            response = self.c.post(self.urlStr, self.accountData, content_type='application/json',
-                                   **{'HTTP_AUTHORIZATION': "token " + self.token})
+            response = self.c.post(self.urlStr, self.accountData,
+                                   content_type='application/json',
+                                   **{'HTTP_AUTHORIZATION': "token "
+                                      + self.token})
         print('Got response : ' + str(response.status_code) + " Expecting 200")
         self.assertEqual(response.status_code, expectedStatus)
         return response
 
-    ### TESTS ###
     def testUpdateNegativeWrongHttpMethodAccount(self):
         self.initBody()
         print("Negative Test: Wrong HTTP Method --> Expecting status code 405")
@@ -93,7 +97,8 @@ class TestUpdateUserAccountTestCase(TestBaseEntity):
 
     def testUpdateNegativeDiffPasswords(self):
         self.initBody()
-        print("Negative Test: password!=confirm_password --> Expecting status code 400")
+        print("Negative Test: password!=confirm_password --> \
+        Expecting status code 400")
         self.data['confirm_password'] = "fakePassword"
         self.updateAccount(400, "PUT")
 
index e7f374a..bf462b6 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -51,16 +51,22 @@ class VFCAPITestCase(TestBaseEntity):
         self.createVendors([Constants.service_provider_company_name, 'Other'])
         self.createDefaultRoles()
         # Create a user with role el
-        self.service_provider = Vendor.objects.get(name=Constants.service_provider_company_name)
-        self.el_user = self.creator.createUser(self.service_provider, self.randomGenerator(
-            "main-vendor-email"), self.randomGenerator("randomNumber"), self.randomGenerator("randomString"), self.el, True)
+        self.service_provider = Vendor.objects.get(
+            name=Constants.service_provider_company_name)
+        self.el_user = self.creator.createUser(
+            self.service_provider, self.randomGenerator(
+                "main-vendor-email"), self.randomGenerator("randomNumber"),
+            self.randomGenerator(
+                "randomString"), self.el, True)
         logger.debug('-----------------------------------------------------')
         logger.debug('Created User:')
         logger.debug('UUID: ' + str(self.el_user.uuid))
         logger.debug('Full Name: ' + self.el_user.full_name)
         logger.debug('-----------------------------------------------------')
-        self.peer_reviewer = self.creator.createUser(self.service_provider, self.randomGenerator(
-            "main-vendor-email"), self.randomGenerator("randomNumber"), self.randomGenerator("randomString"), self.el, True)
+        self.peer_reviewer = self.creator.createUser(
+            self.service_provider, self.randomGenerator(
+                "main-vendor-email"), self.randomGenerator("randomNumber"),
+            self.randomGenerator("randomString"), self.el, True)
         logger.debug('-----------------------------------------------------')
         logger.debug('Created Peer Reviewer:')
         logger.debug('UUID: ' + str(self.peer_reviewer.uuid))
@@ -69,8 +75,10 @@ class VFCAPITestCase(TestBaseEntity):
 
         # Create a user with role standard_user
         self.vendor = Vendor.objects.get(name='Other')
-        self.user = self.creator.createUser(self.vendor, self.randomGenerator("email"), self.randomGenerator(
-            "randomNumber"), self.randomGenerator("randomString"), self.standard_user, True)
+        self.user = self.creator.createUser(
+            self.vendor, self.randomGenerator("email"), self.randomGenerator(
+                "randomNumber"), self.randomGenerator("randomString"),
+            self.standard_user, True)
         logger.debug('-----------------------------------------------------')
         logger.debug('Created User:')
         logger.debug('UUID: ' + str(self.user.uuid))
@@ -80,7 +88,8 @@ class VFCAPITestCase(TestBaseEntity):
         # Create an Engagement with team
         self.engagement = self.creator.createEngagement(self.randomGenerator(
             "randomString"), self.randomGenerator("randomString"), None)
-        self.engagement.engagement_team.add(self.user, self.el_user, self.peer_reviewer)
+        self.engagement.engagement_team.add(
+            self.user, self.el_user, self.peer_reviewer)
         self.engagement.peer_reviewer = self.peer_reviewer
         self.engagement.reviewer = self.el_user
         self.engagement.save()
@@ -91,9 +100,11 @@ class VFCAPITestCase(TestBaseEntity):
 
         # Create a DT, DTSite, VF
         self.deploymentTarget = self.creator.createDeploymentTarget(
-            self.randomGenerator("randomString"), self.randomGenerator("randomString"))
+            self.randomGenerator("randomString"),
+            self.randomGenerator("randomString"))
         self.vf = self.creator.createVF(self.randomGenerator("randomString"),
-                                        self.engagement, self.deploymentTarget, False, self.vendor)
+                                        self.engagement, self.deploymentTarget,
+                                        False, self.vendor)
 
         logger.debug('-----------------------------------------------------')
         logger.debug('Created VF:')
@@ -103,16 +114,17 @@ class VFCAPITestCase(TestBaseEntity):
         self.token = self.loginAndCreateSessionToken(self.user)
         self.ELtoken = self.loginAndCreateSessionToken(self.el_user)
 
-    def retrieveCurrentObjectsOfEngagementByFilter(self, method, detailOrObject, entity):
+    def retrieveCurrentObjectsOfEngagementByFilter(self, method,
+                                                   detailOrObject, entity):
         if method == 'filter':
-            list = entity.objects.filter(engagement=detailOrObject)
-            return list
+            entity_list = entity.objects.filter(engagement=detailOrObject)
+            return entity_list
         elif method == 'get':
-            list = entity.objects.get(uuid=detailOrObject)
-            return list
+            entity_list = entity.objects.get(uuid=detailOrObject)
+            return entity_list
 
-    def loggerTestFailedOrSucceded(self, bool):
-        if bool:
+    def loggerTestFailedOrSucceded(self, flag):
+        if flag:
             logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
             logger.debug(" Test Succeeded")
             logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n")
@@ -125,7 +137,8 @@ class VFCAPITestCase(TestBaseEntity):
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
         logger.debug(" Test started: Create DTSite and add to VF")
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n")
-        self.deploymentTargetSite = self.creator.createDeploymentTargetSite(self.randomGenerator("randomString"))
+        self.deploymentTargetSite = self.creator.createDeploymentTargetSite(
+            self.randomGenerator("randomString"))
         self.vf.deployment_target_sites.add(self.deploymentTargetSite)
         sites = self.vf.deployment_target_sites.all()
         num = 1
@@ -141,14 +154,18 @@ class VFCAPITestCase(TestBaseEntity):
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
         logger.debug(" Test started: Delete VFC")
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n")
-        vfc = self.creator.createVFC(self.randomGenerator("randomString"), self.randomGenerator(
+        vfc = self.creator.createVFC(self.randomGenerator("randomString"),
+                                     self.randomGenerator(
             "randomNumber"), self.vendor, self.vf, self.el_user)
-        urlStr = self.urlPrefix + 'vf/' + str(vfc.uuid) + '/vfcs/' + str(vfc.uuid)
-        if (vfc == None):
-            logger.error("vfc wasn't created successfully before the deletion attempt")
+        urlStr = self.urlPrefix + 'vf/' + \
+            str(vfc.uuid) + '/vfcs/' + str(vfc.uuid)
+        if (not vfc):
+            logger.error(
+                "vfc wasn't created successfully before the deletion attempt")
             self.loggerTestFailedOrSucceded(False)
             self.assertEqual(500, expectedStatus)
-        response = self.c.delete(urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
+        response = self.c.delete(
+            urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
         logger.debug('Got response : ' + str(response.status_code))
         if (response.status_code == HTTP_204_NO_CONTENT):
             self.loggerTestFailedOrSucceded(True)
@@ -160,16 +177,21 @@ class VFCAPITestCase(TestBaseEntity):
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
         logger.debug(" Test started: Get VFCs")
         logger.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n\n")
-        vfc = self.creator.createVFC(self.randomGenerator("randomString"), self.randomGenerator(
+        vfc = self.creator.createVFC(self.randomGenerator("randomString"),
+                                     self.randomGenerator(
             "randomNumber"), self.vendor, self.vf, self.el_user)
-        vfc2 = self.creator.createVFC(self.randomGenerator("randomString"), self.randomGenerator(
+        vfc2 = self.creator.createVFC(self.randomGenerator("randomString"),
+                                      self.randomGenerator(
             "randomNumber"), self.service_provider, self.vf, self.el_user)
         urlStr = self.urlPrefix + 'vf/' + str(self.vf.uuid) + '/vfcs/'
-        if (vfc == None or vfc2 == None):
-            logger.error("The VFCs were not created successfully before the deletion attempt")
+        if (not vfc or not vfc2):
+            logger.error(
+                "The VFCs were not created successfully before \
+                the deletion attempt")
             self.loggerTestFailedOrSucceded(False)
             self.assertEqual(500, expectedStatus)
-        response = self.c.get(urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
+        response = self.c.get(
+            urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token})
         logger.debug('Got response : ' + str(response.status_code))
         logger.debug("VFCs found in the VF(through the GET request):")
         logger.debug(str(response.content))
index 0ba619e..77ed260 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -42,8 +42,10 @@ import string
 import random
 from engagementmanager.service.logging_service import LoggingServiceFactory
 from engagementmanager.utils.authentication import JWTAuthentication
-from engagementmanager.models import Vendor, IceUserProfile, Role, Engagement, DeploymentTarget, ApplicationServiceInfrastructure, VF,\
-    NextStep, ChecklistTemplate, DeploymentTargetSite, VFC, Checklist, ChecklistSection, ChecklistLineItem,\
+from engagementmanager.models import Vendor, IceUserProfile, Role, \
+    Engagement, DeploymentTarget, ApplicationServiceInfrastructure, VF,\
+    NextStep, ChecklistTemplate, DeploymentTargetSite, VFC, \
+    Checklist, ChecklistSection, ChecklistLineItem,\
     CustomUser
 from engagementmanager.utils.constants import Constants
 
@@ -55,7 +57,8 @@ class VvpEntitiesCreator:
     def __init__(self):
         pass
 
-    def createUserTemplate(self, company, email, full_name, role, is_service_provider_contact, ssh_key=None, ):
+    def createUserTemplate(self, company, email, full_name, role,
+                           is_service_provider_contact, ssh_key=None, ):
         return {
             'company': company,
             'email': email,
@@ -112,16 +115,25 @@ class VvpEntitiesCreator:
         admin = self.getOrCreateIfNotExist(
             Role, {'name': 'admin'}, {'name': 'admin'})
         el = self.getOrCreateIfNotExist(Role, {'name': 'el'}, {'name': 'el'})
-        standard_user = self.getOrCreateIfNotExist(Role, {'name': 'standard_user'}, {
-                                                   'name': 'standard_user'})
+        standard_user = self.getOrCreateIfNotExist(
+            Role, {'name': 'standard_user'}, {
+                'name': 'standard_user'})
         return admin, el, standard_user
 
-    def createUser(self, company, email, phone, fullName, role, is_active=False, ssh_key=None, activation_token_create_time=timezone.now()):
+    def createUser(self, company, email, phone, fullName, role,
+                   is_active=False, ssh_key=None,
+                   activation_token_create_time=timezone.now()):
         try:
-            user, is_user_created = CustomUser.objects.get_or_create(username=email, defaults={'email': email, 'password': '12345678', 'activation_token': uuid4(
-            ), 'activation_token_create_time': timezone.now(), 'last_login': timezone.now(), 'is_active': is_active})
-            user_profile, is_profile_created = IceUserProfile.objects.update_or_create(
-                email=email, defaults=self.createUserTemplate(company, email, fullName, role, False, ssh_key))
+            user, is_user_created = CustomUser.objects.get_or_create(
+                username=email, defaults={
+                    'email': email, 'password': '12345678',
+                    'activation_token': uuid4(),
+                    'activation_token_create_time': timezone.now(),
+                    'last_login': timezone.now(), 'is_active': is_active})
+            user_profile, is_profile_created = \
+                IceUserProfile.objects.update_or_create(
+                    email=email, defaults=self.createUserTemplate(
+                        company, email, fullName, role, False, ssh_key))
         except Exception as e:
             logger.error("VvpEntitiesCreator - createUser - error:")
             logger.error(e)
@@ -129,18 +141,23 @@ class VvpEntitiesCreator:
         return user_profile
 
     def createEngagement(self, uuid, engagement_type, engagement_team):
-        return self.getOrCreateIfNotExist(Engagement, {'uuid': uuid}, self.createEngagementTemplate(engagement_type, engagement_team))
+        return self.getOrCreateIfNotExist(
+            Engagement, {'uuid': uuid}, self.createEngagementTemplate(
+                engagement_type, engagement_team))
 
-    def createVF(self, name, engagement, deployment, is_service_provider_internal, vendor, **kwargs):
-        vf = VF.objects.create(name=name, engagement=engagement,
-                               deployment_target=deployment,
-                               is_service_provider_internal=is_service_provider_internal,
-                               vendor=vendor,
-                               target_lab_entry_date=timezone.now(), **kwargs)
+    def createVF(self, name, engagement, deployment,
+                 is_service_provider_internal, vendor, **kwargs):
+        vf = VF.objects.create(
+            name=name, engagement=engagement,
+            deployment_target=deployment,
+            is_service_provider_internal=is_service_provider_internal,
+            vendor=vendor,
+            target_lab_entry_date=timezone.now(), **kwargs)
         return vf
 
     def createNextStep(self, uuid, createFields):
-        return self.getOrCreateIfNotExist(NextStep, {'uuid': uuid}, createFields)
+        return self.getOrCreateIfNotExist(
+            NextStep, {'uuid': uuid}, createFields)
 
     def createDefaultCheckListTemplate(self):
         checklist_templates = [
@@ -158,22 +175,45 @@ class VvpEntitiesCreator:
                             {
                                 'name': 'Parameters',
                                 'weight': 1,
-                                'description': 'Numeric parameters should include range and/or allowed values.',
-                                'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                                'description': 'Numeric parameters ' +
+                                'should include range and/or allowed values.',
+                                'validation_instructions': 'Here are some ' +
+                                'useful tips for how to validate this item ' +
+                                ' in the most awesome way:<br><br><ul><li>' +
+                                'Here is my awesome tip 1</li><li>Here is ' +
+                                'my awesome tip 2</li><li>' +
+                                'Here is my awesome ' +
+                                'tip 3</li></ul>',
                                 'line_type': 'auto',
                             },
                             {
                                 'name': 'String parameters',
                                 'weight': 1,
-                                'description': 'Numeric parameters should include range and/or allowed values.',
-                                'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                                'description': 'Numeric parameters ' +
+                                'should include range and/or allowed values.',
+                                'validation_instructions': 'Here are some ' +
+                                'useful tips for how to validate this item ' +
+                                'in the most awesome way:<br><br><ul><li>' +
+                                'Here is my awesome tip 1</li><li>Here is ' +
+                                'my awesome tip 2</li><li>' +
+                                'Here is my awesome ' +
+                                'tip 3</li></ul>',
                                 'line_type': 'auto',
                             },
                             {
                                 'name': 'Numeric parameters',
                                 'weight': 1,
-                                'description': 'Numeric parameters should include range and/or allowed values.',
-                                'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                                'description': 'Numeric parameters should ' +
+                                'include range and/or allowed values.',
+                                'validation_instructions': 'Here are some ' +
+                                'useful tips for how to ' +
+                                'validate this item in ' +
+                                'the most awesome way:<br><br><ul><li>' +
+                                'Here is ' +
+                                'my awesome tip 1</li><li>' +
+                                'Here is my awesome ' +
+                                'tip 2</li><li>Here is my awesome tip 3' +
+                                '</li></ul>',
                                 'line_type': 'auto',
                             }
                         ]
@@ -187,15 +227,27 @@ class VvpEntitiesCreator:
                             {
                                 'name': 'Normal references',
                                 'weight': 1,
-                                'description': 'Numeric parameters should include range and/or allowed values.',
-                                'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                                'description': 'Numeric parameters should ' +
+                                'include range and/or allowed values.',
+                                'validation_instructions': 'Here are ' +
+                                'some useful tips for how to validate ' +
+                                'this item in the most awesome way:' +
+                                '<br><br><ul><li>Here is my awesome ' +
+                                'tip 1</li><li>Here is my awesome tip 2' +
+                                '</li><li>Here is my awesome tip 3</li></ul>',
                                 'line_type': 'manual',
                             },
                             {
                                 'name': 'VF image',
                                 'weight': 1,
-                                'description': 'Numeric parameters should include range and/or allowed values.',
-                                'validation_instructions': 'Here are some useful tips for how to validate this item in the most awesome way:<br><br><ul><li>Here is my awesome tip 1</li><li>Here is my awesome tip 2</li><li>Here is my awesome tip 3</li></ul>',
+                                'description': 'Numeric parameters should ' +
+                                'include range and/or allowed values.',
+                                'validation_instructions': 'Here are some ' +
+                                'useful tips for how to validate this item ' +
+                                'in the most awesome way:<br><br><ul><li>' +
+                                'Here is my awesome tip 1</li><li>Here ' +
+                                'is my awesome tip 2</li><li>Here is my ' +
+                                'awesome tip 3</li></ul>',
                                 'line_type': 'auto',
                             }
                         ]
@@ -206,32 +258,36 @@ class VvpEntitiesCreator:
         ]
 
         for template in checklist_templates:
-            created_template = ChecklistTemplate.objects.get_or_create(name=template['name'], defaults={
-                'category': template['category'],
-                'version': template['version'],
-                'create_time': timezone.now()
-            })
+            created_template = ChecklistTemplate.objects.get_or_create(
+                name=template['name'], defaults={
+                    'category': template['category'],
+                    'version': template['version'],
+                    'create_time': timezone.now()
+                })
             created_template = ChecklistTemplate.objects.get(
                 name=template['name'])
             for section in template['sections']:
                 created_section = ChecklistSection.objects.get_or_create(
                     name=section['name'],
-                    template_id=created_template.uuid, defaults={
+                    template_id=created_template.uuid,
+                    defaults={
                         'weight': section['weight'],
                         'description': section['description'],
-                        'validation_instructions': section['validation_instructions']
+                        'validation_instructions': section[
+                            'validation_instructions']
 
                     })
                 created_section = ChecklistSection.objects.get(
                     name=section['name'], template_id=created_template.uuid)
                 for lineitem in section['lineitems']:
-                    created_lineitem = ChecklistLineItem.objects.get_or_create(
+                    ChecklistLineItem.objects.get_or_create(
                         name=lineitem['name'],
                         template_id=created_template.uuid,
                         defaults={
                             'weight': lineitem['weight'],
                             'description': lineitem['description'],
-                            'validation_instructions': lineitem['validation_instructions'],
+                            'validation_instructions': lineitem[
+                                'validation_instructions'],
                             'line_type': lineitem['line_type'],
                             'section_id': created_section.uuid,
                         })
@@ -241,8 +297,9 @@ class VvpEntitiesCreator:
 
         return self.defaultCheklistTemplate
 
-    def createCheckList(self, name, state, validation_cycle, associated_files, engagement, template, creator, owner):
-        if (associated_files == None):
+    def createCheckList(self, name, state, validation_cycle, associated_files,
+                        engagement, template, creator, owner):
+        if (not associated_files):
             associated_files = '{}'
         return self.getOrCreateIfNotExist(Checklist, {'name': name}, {
             'state': state,
@@ -260,21 +317,26 @@ class VvpEntitiesCreator:
         try:
             obj = VFC.objects.get(name=name)
         except VFC.DoesNotExist:
-            return VFC.objects.create(name=name, external_ref_id=ext_ref, company=company, creator=creator, vf=vf)
+            return VFC.objects.create(name=name, external_ref_id=ext_ref,
+                                      company=company, creator=creator, vf=vf)
         return obj
 
     def randomGenerator(self, typeOfValue, numberOfDigits=0):
         lettersAndNumbers = string.ascii_letters + string.digits
         if typeOfValue == 'email':
-            myEmail = ''.join(random.choice(lettersAndNumbers) for _ in range(4)) + "@" + \
-                ''.join(random.choice(string.ascii_uppercase) for _ in range(4)) + ".com"
+            myEmail = ''.join(
+                random.choice(lettersAndNumbers) for _ in range(4)) + "@" + \
+                ''.join(random.choice(string.ascii_uppercase)
+                        for _ in range(4)) + ".com"
             return myEmail
         elif typeOfValue == 'main-vendor-email':
-            myEmail = ''.join(random.choice(lettersAndNumbers) for _ in range(4)) + "@" + \
-                      Constants.service_provider_mail_domain[0]
+            myEmail = ''.join(
+                random.choice(lettersAndNumbers) for _ in range(4)) + "@" + \
+                Constants.service_provider_mail_domain[0]
             return myEmail
         elif typeOfValue == 'randomNumber':
-            randomNumber = ''.join("%s" % random.randint(0, 9) for _ in range(0, (numberOfDigits + 1)))
+            randomNumber = ''.join("%s" % random.randint(0, 9)
+                                   for _ in range(0, (numberOfDigits + 1)))
             return randomNumber
         elif typeOfValue == 'randomString':
             randomString = "".join(random.sample(lettersAndNumbers, 5))
index 9cc5be3..f0aca9f 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
 from django.conf.urls import url
 
 from engagementmanager.rest import checklist_audit_log
-from engagementmanager.rest import user, activation, activity, vf, invite, feedback, nextsteps, engagement, \
-    login, signup, notification, checklist, deployment_target_site, vendor, data_loader, checklist_decision, \
+from engagementmanager.rest import user, activation, activity, vf,\
+    invite, feedback, nextsteps, engagement, \
+    login, signup, notification, checklist, deployment_target_site,\
+    vendor, data_loader, checklist_decision, \
     vfc, checklist_set_state, deployment_target, ecomp, validation_details
 from engagementmanager.rest.cms.pages import Pages, PageById, PageSearch
 from engagementmanager.rest.cms.posts import Posts
-from engagementmanager.rest.engagement import EngagementProgressBar, ChangeTargetLabEntryDate, EngagementOps, \
-    EngagementReviewer, EngagementPeerReviewer, ArchiveEngagement, SwitchEngagementReviewers
+from engagementmanager.rest.engagement import EngagementProgressBar,\
+    ChangeTargetLabEntryDate, EngagementOps, \
+    EngagementReviewer, EngagementPeerReviewer,\
+    ArchiveEngagement, SwitchEngagementReviewers
 from engagementmanager.rest.user import User
 from engagementmanager.service.logging_service import LoggingServiceFactory
 
@@ -99,7 +103,8 @@ urlpatterns = [
         re_uuid, nextsteps.NextSteps.as_view()),
     url(r'^engagements/(?P<eng_uuid>%s)/nextsteps/order_next_steps$' %
         re_uuid, nextsteps.OrderNextSteps.as_view()),
-    url(r'^engagements/(?P<eng_uuid>%s)/nextsteps/(?P<eng_stage>%s)/?$' % (re_uuid, re_enum),
+    url(r'^engagements/(?P<eng_uuid>%s)/' % re_uuid +\
+        'nextsteps/(?P<eng_stage>%s)/?$' % re_enum,
         nextsteps.NextSteps.as_view()),  # Set Next Step State
     # Set Progress bar for Engagement
     url(r'^engagements/(?P<eng_uuid>%s)/progress/?$' %
@@ -127,21 +132,22 @@ urlpatterns = [
         re_uuid, activity.PullActivities.as_view()),
 
     # DeploymentTarget(version)
-    url(r'^engagement/(?P<engagement_uuid>%s)/deployment-targets/(?P<dt_uuid>%s)$'
-        % (re_uuid, re_uuid),
+    url(r'^engagement/(?P<engagement_uuid>%s)' % re_uuid +\
+        '/deployment-targets/(?P<dt_uuid>%s)$' % (re_uuid),
         deployment_target.DeploymentTargetRESTMethods.as_view()),
     url(r'^deployment-targets/?$',
         deployment_target.DeploymentTargetRESTMethods.as_view()),
 
     # ECOMP
-    url(r'^engagement/(?P<engagement_uuid>%s)/ecomp-releases/(?P<ecomp_uuid>%s)$' % (re_uuid, re_uuid),
+    url(r'^engagement/(?P<engagement_uuid>%s)' % re_uuid +\
+        '/ecomp-releases/(?P<ecomp_uuid>%s)$' % (re_uuid),
         ecomp.ECOMPReleaseRESTMethods.as_view()),
     url(r'^ecomp-releases/?$', ecomp.ECOMPReleaseRESTMethods.as_view()),
     # VFVERSION
     url(r'^vf/(?P<vf_uuid>%s)/vf-version/$' % re_uuid, vf.VF.as_view()),
     # DeploymentTargetSite%s
-    url(r'^vf/(?P<vf_uuid>%s)/validation-details/$' %
-        re_uuid, validation_details.UpdateValidationDetails.as_view()),
+    url(r'^vf/(?P<vf_uuid>%s)/validation-details/$' % re_uuid,
+        validation_details.UpdateValidationDetails.as_view()),
     url(r'^vf/(?P<vf_uuid>%s)/dtsites/$' %
         re_uuid, deployment_target_site.DTSites.as_view()),
     url(r'^vf/(?P<vf_uuid>%s)/dtsites/(?P<dts_uuid>%s)$' %
@@ -158,7 +164,8 @@ urlpatterns = [
         (re_uuid, re_uuid), vfc.VFCRest.as_view()),
 
     # Next Steps
-    url(r'^nextsteps/(?P<ns_uuid>%s)/engagement/(?P<eng_uuid>%s)?$' % (re_uuid, re_uuid),
+    url(r'^nextsteps/(?P<ns_uuid>%s)/' % re_uuid +\
+        'engagement/(?P<eng_uuid>%s)?$' % re_uuid,
         nextsteps.EditNextSteps.as_view()),  # Set State for a next step
     url(r'^nextsteps/(?P<ns_uuid>%s)/(?P<attr>state)/?$' %
         re_uuid, nextsteps.NextSteps.as_view()),  # Set State for a next step
@@ -212,7 +219,9 @@ urlpatterns = [
         re_uuid, checklist.CheckListTemplates.as_view()),
 
     # get Checklist (returns files and all templates)
-    url(r'^engagement/(?P<eng_uuid>%s)/checklist/(?P<checklistUuid>%s)/nextstep/$' % (re_uuid, re_uuid),
+    url(
+        r'^engagement/(?P<eng_uuid>%s)/checklist/' % re_uuid +\
+        '(?P<checklistUuid>%s)/nextstep/$' % re_uuid,\
         nextsteps.ChecklistNextStep.as_view()),
     url(r'^engagement/(?P<eng_uuid>%s)/checklist/new/$' %
         re_uuid, checklist.NewCheckList.as_view()),
index 371b694..c223eb3 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 24275d6..7928ff7 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -53,44 +53,54 @@ class ActivityData:
 
 class UserJoinedEngagementActivityData(ActivityData):
     def __init__(self, vf, users_list, engagement, owner=None):
-        super(UserJoinedEngagementActivityData, self).__init__(engagement, ActivityType.user_joined_eng, owner)
+        super(UserJoinedEngagementActivityData, self).__init__(
+            engagement, ActivityType.user_joined_eng, owner)
         self.vf = vf
         self.users_list = users_list
 
 
 class VFProvisioningActivityData(ActivityData):
-    def __init__(self, vf, users_list, engagement, description="There was an error provisioning the VF", owner=None):
-        super(VFProvisioningActivityData, self).__init__(engagement, ActivityType.vf_provisioning_event, owner)
+    def __init__(self, vf, users_list, engagement,
+                 description="There was an error provisioning the VF",
+                 owner=None):
+        super(VFProvisioningActivityData, self).__init__(
+            engagement, ActivityType.vf_provisioning_event, owner)
         self.vf = vf
         self.description = description
         self.users_list = users_list
 
 
 class TestFinishedActivityData(ActivityData):
-    def __init__(self, users_list, engagement, description="There was an error in Test"
-                                                           " Finished signal from Jenkins", owner=None):
-        super(TestFinishedActivityData, self).__init__(engagement, ActivityType.test_finished_event, owner)
+    def __init__(self, users_list, engagement,
+                 description="There was an error in Test"
+                 " Finished signal from Jenkins", owner=None):
+        super(TestFinishedActivityData, self).__init__(
+            engagement, ActivityType.test_finished_event, owner)
         self.description = description
         self.users_list = users_list
 
 
 class ChangeEngagementStageActivityData(ActivityData):
     def __init__(self, vf, stage, engagement, owner=None):
-        super(ChangeEngagementStageActivityData, self).__init__(engagement, ActivityType.change_engagement_stage, owner)
+        super(ChangeEngagementStageActivityData, self).__init__(
+            engagement, ActivityType.change_engagement_stage, owner)
         self.vf = vf
         self.stage = stage
 
 
 class AddNextStepsActivityData(ActivityData):
     def __init__(self, vf, user, engagement, owner=None):
-        super(AddNextStepsActivityData, self).__init__(engagement, ActivityType.add_next_steps, owner)
+        super(AddNextStepsActivityData, self).__init__(
+            engagement, ActivityType.add_next_steps, owner)
         self.vf = vf
         self.user = user
 
 
 class NoticeEmptyEngagementData(ActivityData):
-    def __init__(self, vf_name, max_empty_time, git_repo_url, delta_days_from_creation, engagement, owner=None):
-        super(NoticeEmptyEngagementData, self).__init__(engagement, ActivityType.notice_empty_engagement, owner)
+    def __init__(self, vf_name, max_empty_time, git_repo_url,
+                 delta_days_from_creation, engagement, owner=None):
+        super(NoticeEmptyEngagementData, self).__init__(
+            engagement, ActivityType.notice_empty_engagement, owner)
         self.max_empty_time = max_empty_time
         self.vf_name = vf_name
         self.git_repo_url = git_repo_url
@@ -99,18 +109,21 @@ class NoticeEmptyEngagementData(ActivityData):
 
 class UpdateNextStepsActivityData(ActivityData):
     def __init__(self, update_type, user, engagement, owner=None):
-        super(UpdateNextStepsActivityData, self).__init__(engagement, ActivityType.update_next_steps, owner)
+        super(UpdateNextStepsActivityData, self).__init__(
+            engagement, ActivityType.update_next_steps, owner)
         self.update_type = update_type
         self.user = user
 
 
 class DeleteNextStepsActivityData(ActivityData):
     def __init__(self, user, engagement, owner=None):
-        super(DeleteNextStepsActivityData, self).__init__(engagement, ActivityType.delete_next_steps, owner)
+        super(DeleteNextStepsActivityData, self).__init__(
+            engagement, ActivityType.delete_next_steps, owner)
         self.user = user
 
 
 class SSHKeyAddedActivityData(ActivityData):
     def __init__(self, action, engagement, owner=None):
-        super(SSHKeyAddedActivityData, self).__init__(engagement, ActivityType.ssh_key_added, owner)
+        super(SSHKeyAddedActivityData, self).__init__(
+            engagement, ActivityType.ssh_key_added, owner)
         self.action = action
index 6a857d6..cd25620 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -58,7 +58,8 @@ def ice_jwt_decode_handler(token):
 class JWTAuthentication(object):
     """
     Simple token based authentication.
-    Clients should authenticate by passing the token key in the "Authorization" HTTP header, prepended with the string "Token ".
+    Clients should authenticate by passing the token key in the
+    "Authorization" HTTP header, prepended with the string "Token ".
     For example: Authorization: Token 401f7ac837da42b97f613d789819ff93537bee6a
     """
 
@@ -75,11 +76,13 @@ class JWTAuthentication(object):
         Create token for reset password flow.
         """
         encryptor = URLSafeTimedSerializer(api_settings.JWT_SECRET_KEY)
-        return encryptor.dumps(user_data.email, salt=api_settings.JWT_SECRET_KEY)
+        return encryptor.dumps(user_data.email,
+                               salt=api_settings.JWT_SECRET_KEY)
 
     def decode_reset_password_token(self, token):
         """
-        Decoded the token created at reset password flow and return what was encrypted.
+        Decoded the token created at reset password flow and
+        return what was encrypted.
         """
         decryptor = URLSafeTimedSerializer(api_settings.JWT_SECRET_KEY)
         email = decryptor.loads(
index ef19de2..84fbd18 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -44,13 +44,15 @@ class ChoiceEnum(Enum):
 
     @classmethod
     def choices(cls):
-        """Return this Enum's values in a format suitable for use as Django Field.choices param.
+        """Return this Enum's values in a format suitable for use as Django Field.
+        choices param.
 
         https://docs.python.org/3/library/enum.html
         https://docs.djangoproject.com/en/1.10/ref/models/fields/#choices
 
         """
-        # FIXME it might be more useful in some situations to return (x.value, x.name), but we do
-        # this way is for compatibility with older versions of this code. Changing would require a
-        # data migration.`
+        # FIXME it might be more useful in some situations to
+        # return (x.value, x.name), but we do
+        # this way is for compatibility with older versions of this code.
+        # Changing would require a data migration.`
         return [(x.name, x.name) for x in cls]
index 70fab7b..0e1c5b9 100644 (file)
@@ -54,27 +54,31 @@ class Constants(object):
     role_standard_user = None
     role_admin = None
     role_admin_ro = None
-    service_provider_company_name = "ServiceProvider"
-    service_provider_mail_domain = ["example-domain.com"]
-    service_provider_admin_mail = "admin@example-domain.com"
-    service_provider_admin_ro_mail = "admin_ro@example-domain.com"
-    ice_base_ctx = "/vvp/v1/engmgr/"
-    rgwa_base_url ='http://localhost:8123/admin'
+    service_provider_company_name = settings.SERVICE_PROVIDER
+    service_provider_mail_domain = [settings.SERVICE_PROVIDER_DOMAIN]
+    service_provider_admin_mail = "admin@" + settings.SERVICE_PROVIDER_DOMAIN
+    service_provider_admin_ro_mail = "admin_ro@" + \
+                                     settings.SERVICE_PROVIDER_DOMAIN
+    ice_base_ctx = "/{prefix}/v1/engmgr/"\
+        .format(prefix=settings.PROGRAM_NAME_URL_PREFIX)
+    rgwa_base_url = 'http://localhost:8123/admin'
     default_vfc_version = "1.0.0"
-    dbConnectionStr = "dbname='icedb' user='iceuser' host='localhost' password='Aa123456' port='5433'"
+    dbConnectionStr = "dbname='icedb' user='iceuser' host='localhost' " +\
+                      "password='Aa123456' port='5433'"
     dashboard_href = "<A href=" + \
         str(settings.DOMAIN) + "/#/dashboard/" + ">Dashboard</A>"
-    prodDomain = 'https://www.vvp.example-domain.com'
+    prodDomain = 'https://' + settings.SERVICE_PROVIDER_DOMAIN
     invite_template_dir = "emails/invite/"
     activate_template_dir = "emails/activate/"
     notification_template_dir = "emails/notification/"
     reset_pwd_template_dir = "emails/reset_pwd/"
     activation_prefix = "/#/activate/"
-    program_name = "VVP"
+    program_name = settings.PROGRAM_NAME
 
 
 class TemplatesConstants(object):
-    logo_url = "https://www.d2ice.att.io/styles/images/d2sandbox_logos-150x30.png"
+    logo_url = \
+        "https://www.d2ice.att.io/styles/images/d2sandbox_logos-150x30.png"
     contact_mail = "d2ice@att.com"
     context = {"service_provider": Constants.service_provider_company_name,
                "program_name": Constants.program_name,
@@ -86,6 +90,8 @@ class TemplatesConstants(object):
 '''
 In order to get Enum Value as String use: EngagementType.Validation.name
 '''
+
+
 class EngagementModelValidationDate:
     HEAT_VALIDATED = "heat_validated_time"
     IMAGE_SCAN = "image_scan_time"
@@ -99,10 +105,12 @@ class JenkinsBuildParametersNames:
 
 
 class MockJenkinsBuildLog:
-    TEXT = "from server: Started by user admin \n \
-            Building in workspace /var/jenkins_home/workspace/{vf_name}_{eng_man_id} \n \
-            [{vf_name}_{eng_man_id}] $ /bin/sh /tmp/jenkins{random_id}.sh \n \
-            Cloning into '/var/jenkins_home/workspace/{vf_name}_{eng_man_id}/VF'"
+    TEXT = \
+        "from server: Started by user admin \n \
+        Building in workspace \
+        /var/jenkins_home/workspace/{vf_name}_{eng_man_id} \n \
+        [{vf_name}_{eng_man_id}] $ /bin/sh /tmp/jenkins{random_id}.sh \n \
+        Cloning into '/var/jenkins_home/workspace/{vf_name}_{eng_man_id}/VF'"
 
 
 class ChecklistDefaultNames:
index 723efa0..b3ef5ca 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index db1d8fe..780482b 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index b1b46ee..732e2c4 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -39,7 +39,8 @@
 import traceback
 from rest_framework.response import Response
 from rest_framework.views import exception_handler
-from engagementmanager.utils.exception_message_factory import ExceptionMessageFactory
+from engagementmanager.utils.exception_message_factory import \
+    ExceptionMessageFactory
 from engagementmanager.service.logging_service import LoggingServiceFactory
 
 logger = LoggingServiceFactory.get_logger()
@@ -47,7 +48,8 @@ logger = LoggingServiceFactory.get_logger()
 
 def ice_exception_handler(exc, context):
     """
-    our own exception handler so we will catch every exception occurred in rest and print it's stack into log
+    our own exception handler so we will catch every exception \
+    occurred in rest and print it's stack into log
     :param exc: The exception
     :param context: The context which the exception occurred in.
     """
@@ -60,14 +62,17 @@ def ice_exception_handler(exc, context):
 
         if exception_msg_obj['include_exception']:
             data['detail'] += str(exc)
-        if 'include_additional_exc_str' in exception_msg_obj and exception_msg_obj['include_additional_exc_str']:
+        if 'include_additional_exc_str' in exception_msg_obj and \
+                exception_msg_obj['include_additional_exc_str']:
             data['exception_message'] = str(exc)
 
         response = Response(data, status=exception_msg_obj['status'])
 
         logger.error("General exception occurred in rest framework: %s", exc)
-        logger.debug("*******************************************************************************************")
+        logger.debug(
+            "***************************************************************")
         logger.debug(traceback.format_exc())
-        logger.debug("*******************************************************************************************")
+        logger.debug(
+            "***************************************************************")
 
     return response
index 6ea96f4..7904e02 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -49,36 +49,70 @@ from rest_framework.exceptions import MethodNotAllowed, NotAuthenticated, \
 
 class ExceptionMessageFactory:
     messages_dictionary = {
-        ObjectDoesNotExist.__name__: {'msg': 'User or Password does not match', 'include_exception': False,
-                                      'status': status.HTTP_404_NOT_FOUND},
-        MethodNotAllowed.__name__: {'msg': 'Method not allowed: ', 'include_exception': True,
-                                    'status': status.HTTP_405_METHOD_NOT_ALLOWED},
-        NotAuthenticated.__name__: {'msg': 'You must authenticate in order to perform this action: ',
-                                    'include_exception': True, 'status': status.HTTP_403_FORBIDDEN},
-        SignatureExpired.__name__: {'msg': 'Signature expired for this token: ', 'include_exception': True,
-                                    'status': status.HTTP_405_METHOD_NOT_ALLOWED},
-        KeyError.__name__: {'msg': 'KeyError occurred over the backend.', 'include_exception': True,
-                            'include_additional_exc_str': True, 'status': status.HTTP_400_BAD_REQUEST},
-        ValueError.__name__: {'msg': 'ValueError occurred over the backend: ', 'include_exception': True,
-                              'status': status.HTTP_500_INTERNAL_SERVER_ERROR},
-        ConnectionError.__name__: {'msg': 'ConnectionError occurred over the backend: ', 'include_exception': True,
-                                   'status': status.HTTP_500_INTERNAL_SERVER_ERROR},
-        ImportError.__name__: {'msg': 'ImportError occurred over the backend: ', 'include_exception': True,
-                               'status': status.HTTP_500_INTERNAL_SERVER_ERROR},
-        CommandError.__name__: {'msg': 'CommandError occurred over the backend: ', 'include_exception': True,
-                                'status': status.HTTP_500_INTERNAL_SERVER_ERROR},
-        PermissionDenied.__name__: {'msg': 'PermissionDenied occurred over the backend: ', 'include_exception': True,
-                                    'status': status.HTTP_401_UNAUTHORIZED},
-        VvpObjectNotAvailable.__name__: {'msg': '', 'include_exception': True, 'status': status.HTTP_410_GONE},
-        NotAcceptable.__name__: {'msg': '', 'include_exception': True, 'status': status.HTTP_403_FORBIDDEN},
-        VvpGeneralException.__name__: {'msg': '', 'include_exception': True,
-                                       'status': status.HTTP_500_INTERNAL_SERVER_ERROR},
-        FileExistsError.__name__: {'msg': 'Not modified due to: ', 'include_exception': True,
-                                   'status': status.HTTP_304_NOT_MODIFIED},
-        VvpBadRequest.__name__: {'msg': '', 'include_exception': True, 'status': status.HTTP_400_BAD_REQUEST},
-        VvpConflict.__name__: {'msg': '', 'include_exception': True, 'status': status.HTTP_409_CONFLICT},
-        Exception.__name__: {'msg': 'General error on backend: ', 'include_exception': True,
-                             'status': status.HTTP_500_INTERNAL_SERVER_ERROR},
+        ObjectDoesNotExist.__name__: {
+            'msg': 'User or Password does not match',
+            'include_exception': False,
+            'status': status.HTTP_404_NOT_FOUND},
+        MethodNotAllowed.__name__: {
+            'msg': 'Method not allowed: ',
+            'include_exception': True,
+            'status':
+            status.HTTP_405_METHOD_NOT_ALLOWED},
+        NotAuthenticated.__name__: {
+            'msg': 'You must authenticate in order to perform this action: ',
+            'include_exception': True, 'status': status.HTTP_403_FORBIDDEN},
+        SignatureExpired.__name__: {
+            'msg': 'Signature expired for this token: ',
+            'include_exception': True,
+            'status':
+            status.HTTP_405_METHOD_NOT_ALLOWED},
+        KeyError.__name__: {
+            'msg': 'KeyError occurred over the backend.',
+            'include_exception': True,
+            'include_additional_exc_str': True, 'status':
+            status.HTTP_400_BAD_REQUEST},
+        ValueError.__name__: {
+            'msg': 'ValueError occurred over the backend: ',
+            'include_exception': True,
+            'status': status.HTTP_500_INTERNAL_SERVER_ERROR},
+        ConnectionError.__name__: {
+            'msg': 'ConnectionError occurred over the backend: ',
+            'include_exception': True,
+            'status': status.HTTP_500_INTERNAL_SERVER_ERROR},
+        ImportError.__name__: {
+            'msg': 'ImportError occurred over the backend: ',
+            'include_exception': True,
+            'status': status.HTTP_500_INTERNAL_SERVER_ERROR},
+        CommandError.__name__: {
+            'msg': 'CommandError occurred over the backend: ',
+            'include_exception': True,
+            'status': status.HTTP_500_INTERNAL_SERVER_ERROR},
+        PermissionDenied.__name__: {
+            'msg': 'PermissionDenied occurred over the backend: ',
+            'include_exception': True,
+            'status': status.HTTP_401_UNAUTHORIZED},
+        VvpObjectNotAvailable.__name__: {
+            'msg': '', 'include_exception': True,
+            'status': status.HTTP_410_GONE},
+        NotAcceptable.__name__: {
+            'msg': '', 'include_exception': True,
+            'status': status.HTTP_403_FORBIDDEN},
+        VvpGeneralException.__name__: {
+            'msg': '', 'include_exception': True,
+            'status': status.HTTP_500_INTERNAL_SERVER_ERROR},
+        FileExistsError.__name__: {
+            'msg': 'Not modified due to: ', 'include_exception': True,
+            'status': status.HTTP_304_NOT_MODIFIED},
+        VvpBadRequest.__name__: {
+            'msg': '', 'include_exception': True,
+            'status': status.HTTP_400_BAD_REQUEST},
+        VvpConflict.__name__: {
+            'msg': '', 'include_exception': True,
+            'status': status.HTTP_409_CONFLICT},
+        Exception.__name__: {
+            'msg': 'General error on backend: ',
+            'include_exception': True,
+            'status': status.HTTP_500_INTERNAL_SERVER_ERROR},
     }
 
     def get_exception_message(self, exception):
index 46557b4..e0114cc 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -117,7 +117,8 @@ class RequsetDataMgr:
         }
 
     '''
-        Called from the verify_token decorator which is a central place that populates the user and all other attributes in RequestData object
+        Called from the verify_token decorator which is a central place \
+        that populates the user and all other attributes in RequestData object
     '''
 
     def clear_old_request_data(self):
index cef67f6..0fdfb4c 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -84,7 +84,7 @@ def logEncoding(data):
     try:
         clean_data = bleach.clean(str(data))
         clean_data += " (User Input)"
-    except Exception as e:
+    except Exception:
         clean_data = "couldnt bleach data"
         pass
     return clean_data
index 2cc9cee..1b47f90 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 418290b..fc0a721 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -92,7 +92,7 @@ def createEngagement(user, manual_el_id=False):
     if user.role != elRole:
         if not manual_el_id:
             # Fetch a random EL
-            qs = IceUserProfile.objects.all().filter(role=elRole)  # @UndefinedVariable
+            qs = IceUserProfile.objects.all().filter(role=elRole)
             if qs.count() > 0:
                 randUser = qs[random.randint(0, qs.count() - 1)]
                 elUser = IceUserProfile.objects.get(uuid=randUser.uuid)
@@ -110,7 +110,7 @@ def createEngagement(user, manual_el_id=False):
 
     # Fetch another random el to be a Peer Reviewer
     qs = IceUserProfile.objects.all().filter(
-        role=elRole, user__is_active=True).exclude(uuid=elUser.uuid)  # @UndefinedVariable
+        role=elRole, user__is_active=True).exclude(uuid=elUser.uuid)
     prUser = None
     if qs.count() > 0:
         randUser = qs[random.randint(0, qs.count() - 1)]
@@ -125,7 +125,8 @@ def createEngagement(user, manual_el_id=False):
 
 def is_str_supports_git_naming_convention(item):
     """
-    validates that string can contain only letters, digits hyphen and dot. Also, String cannot end with dot
+    validates that string can contain only letters, digits hyphen and dot.
+    Also, String cannot end with dot
     """
     return bool(re.compile("^[a-zA-Z0-9-]*$").match(item))
 
@@ -144,11 +145,12 @@ def createVF(user, request):
         logger.debug("Processing VF - " + str(data))
 
         if ('virtual_function' not in data or not data['virtual_function'] or
-           'version' not in data or not data['version'] or
-           'target_lab_entry_date' not in data or not data['target_lab_entry_date'] or
-           'target_aic_uuid' not in data or not data['target_aic_uuid'] or
-           'ecomp_release' not in data or not data['ecomp_release'] or
-           'is_service_provider_internal' not in data):
+            'version' not in data or not data['version'] or
+            'target_lab_entry_date' not in data or not
+            data['target_lab_entry_date'] or
+            'target_aic_uuid' not in data or not data['target_aic_uuid'] or
+            'ecomp_release' not in data or not data['ecomp_release'] or
+                'is_service_provider_internal' not in data):
             raise KeyError("One of the input parameters are missing")
 
         # Set el manually, for example when using import from xls el is
@@ -173,7 +175,8 @@ def createVF(user, request):
 
         i_vfName = data['virtual_function']
         if not is_str_supports_git_naming_convention(i_vfName):
-            msg = "VF Name can contain only letters, digits hyphen and dot. VF Name cannot end with dot"
+            msg = "VF Name can contain only letters, digits hyphen and dot.\
+            VF Name cannot end with dot"
             logger.error(msg)
             raise ValueError(msg)
         i_vfVersion = data['version']
@@ -193,7 +196,7 @@ def createVF(user, request):
         vfObj, was_created = addEntityIfNotExist(VF, vf)
 
         insert_to_recent_engagements(
-            user, RecentEngagementActionType.NEW_VF_CREATED.name, vfObj)  # @UndefinedVariable
+            user, RecentEngagementActionType.NEW_VF_CREATED.name, vfObj)
 
         addUsersToEngTeam(engObj.uuid, [user, elUser, prUser])
         sendSlackNotifications(engObj.uuid, [user, elUser, prUser])
@@ -208,7 +211,8 @@ def createVF(user, request):
 
 
 def updateValidationDetails(request):
-    #  if data['target_aic_uuid'] is not None and data['target_aic_uuid'] != "":
+    # if data['target_aic_uuid'] is not None and data['target_aic_uuid'] !=
+    # "":
     data = request.data
     logger.debug("Processing VF_Details - " + str(data))
     vf = VF.objects.get(uuid=data['vf_uuid'])
@@ -226,15 +230,16 @@ def updateValidationDetails(request):
 def checkAndModifyIfSSHNextStepExist(user):
     SSHStep = None
     qs = NextStep.objects.filter(
-        owner=user, next_step_type=NextStepType.set_ssh.name)  # @UndefinedVariable
+        owner=user, next_step_type=NextStepType.set_ssh.name)
     if qs is None or qs.count() == 0:
         return None
     else:
         SSHStep = NextStep.objects.get(
-            owner=user, next_step_type=NextStepType.set_ssh.name)  # @UndefinedVariable
+            owner=user, next_step_type=NextStepType.set_ssh.name)
 
     # @UndefinedVariable
-    if SSHStep.state in (NextStepState.Incomplete.name) and user.ssh_public_key:
+    if SSHStep.state in (
+            NextStepState.Incomplete.name) and user.ssh_public_key:
         SSHStep.state = 'Completed'
         SSHStep.last_update_time = timezone.now()
         SSHStep.last_update_type = 'Completed'
@@ -245,7 +250,8 @@ def checkAndModifyIfSSHNextStepExist(user):
 
 def addUsersToEngTeam(eng_uuid, newUserList):
     """
-    If the user isn't an EL and their doesn't have an SSH step then create personal SSH next step for him.
+    If the user isn't an EL and their doesn't have an SSH step then,
+    create personal SSH next step for him.
     """
     engObj = Engagement.objects.get(uuid=eng_uuid)
     vfObj = engObj.vf
@@ -255,7 +261,8 @@ def addUsersToEngTeam(eng_uuid, newUserList):
     for newUser in newUserList:
         engObj.engagement_team.add(newUser)
         update_or_insert_to_recent_engagements(
-            newUser.uuid, vfObj, RecentEngagementActionType.JOINED_TO_ENGAGEMENT.name)  # @UndefinedVariable
+            newUser.uuid, vfObj,
+            RecentEngagementActionType.JOINED_TO_ENGAGEMENT.name)
         SSHStep = checkAndModifyIfSSHNextStepExist(newUser)
         if not SSHStep and newUser != el_user:
             NextStepSvc().create_default_next_steps_for_user(newUser, el_user)
@@ -267,7 +274,8 @@ def addUsersToEngTeam(eng_uuid, newUserList):
 
 def sendSlackNotifications(eng_uuid, newUserList):
     """
-    Send Slack notifications to the reviewer, peer reviewer and also the engagements channel
+    Send Slack notifications to the reviewer,
+    peer reviewer and also the engagements channel
     """
     # get the engagement
     engagement = Engagement.objects.get(uuid=eng_uuid)
@@ -301,24 +309,27 @@ def sendSlackNotifications(eng_uuid, newUserList):
         engagement_manual_id, vf_name, reviewer, peer_reviewer, creator)
 
 
-def getVfByEngUuid(engUuid): 
+def getVfByEngUuid(engUuid):
     vfList = VF.objects.filter(engagement__uuid=engUuid)
     if vfList:
         logger.debug("Found VF name=" + vfList[0].name)
         if len(vfList) > 1:
             logger.warning(
-                "!! There seems to be more than one VF attached to the engagement with uuid=" + logEncoding(engUuid))
+                "!! There seems to be more than one VF attached to the\
+                engagement with uuid=" + logEncoding(engUuid))
         # Assumption: the list only has one item because the relation
         # Engagement-VF is 1:1 business wise
         return vfList[0]
     else:
         logger.error(
-            "There are no VFs in the engagement identified by eng_uuid=" + logEncoding(engUuid))
+            "There are no VFs in the engagement identified\
+            by eng_uuid=" + logEncoding(engUuid))
         return None
 
 
 def generateActivationLink(activationToken, user):
-    return str(settings.DOMAIN) + Constants.activation_prefix + str(user.uuid) + "/" + activationToken
+    return str(settings.DOMAIN) + Constants.activation_prefix + \
+        str(user.uuid) + "/" + activationToken
 
 
 def getFirstEngByUser(user):
@@ -331,7 +342,9 @@ def getFirstEngByUser(user):
         return None
 
 
-def createUserTemplate(company, full_name, role, phone, is_service_provider_contact, ssh_key=None, regular_email_updates=False, user=None):
+def createUserTemplate(company, full_name, role, phone,
+                       is_service_provider_contact,
+                       ssh_key=None, regular_email_updates=False, user=None):
     data = {
         'company': company,
         'phone_number': phone,
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index b41a3ff..2fe7d43 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -43,23 +43,29 @@ from engagementmanager.models import Checklist, VF
 from engagementmanager.service.checklist_service import CheckListSvc
 from engagementmanager.service.checklist_state_service import set_state
 from engagementmanager.utils import dict_path_get
-from engagementmanager.utils.constants import CheckListCategory, CheckListState, EngagementStage
+from engagementmanager.utils.constants import CheckListCategory, \
+    CheckListState
 from engagementmanager.utils.request_data_mgr import request_data_mgr
 from engagementmanager.service.logging_service import LoggingServiceFactory
 
 logger = LoggingServiceFactory.get_logger()
 
+file_name = "em_api.py"
+
 
 def test_finished_callback(checklist_test_results):
     logger.debug(
-        "test_finished_callback has signaled that a test has finished with test results %r", checklist_test_results)
+        "test_finished_callback has signaled that a test \
+        has finished with test results %r", checklist_test_results)
 
     if not checklist_test_results:
-        msg = "Couldn't find payload argument inside kwargs array, aborting signal"
+        msg = "Couldn't find payload argument inside kwargs array, aborting \
+        signal"
         logger.error(msg)
         raise KeyError(msg)
 
-    checklist_test_results['description'] = "Validation manager has indicated that checklist {} tests has been completed with results".format(
+    checklist_test_results['description'] = "Validation manager has indicated\
+     that checklist {} tests has been completed with results".format(
         checklist_test_results['checklist_uuid'])
 
     checklist = Checklist.objects.get(
@@ -76,17 +82,20 @@ def test_finished_callback(checklist_test_results):
 
 def git_push_callback(gitlab_data):
     """
-    When we are notified that a repo has received a push, we must reject any checklists not in the
+    When we are notified that a repo has received a push, we must reject any \
+    checklists not in the
     closed or archived state whose associated files have been modified.
     """
-    logger.debug("Validation manager has signaled that a git push has occurred")
+    logger.debug(
+        "Validation manager has signaled that a git push has occurred")
     msg = "OK"
     data = None
 
     # sanity check provided arguments
     for key in ['project', 'project/git_ssh_url', 'commits']:
         if not dict_path_get(gitlab_data, key):
-            msg = "{!r} in the git_push signal gitlab_data is missing or empty.".format(
+            msg = "{!r} in the git_push signal gitlab_data is missing or \
+            empty.".format(
                 key)
             logger.error(msg)
             raise KeyError(msg)
@@ -101,7 +110,9 @@ def git_push_callback(gitlab_data):
     if int(gitlab_data['total_commits_count']) == 0:
         logger.debug("total_commits_count = %s",
                      gitlab_data['total_commits_count'])
-        msg = "Something is wrong: Number of commits is 0 even after a push event has been invoked from validation manager to engagement manager"
+        msg = "Something is wrong: Number of commits is 0 even after a \
+        push event has been invoked from validation manager \
+        to engagement manager"
         logger.warn(msg)
         raise ValueError(msg)
 
@@ -123,7 +134,7 @@ def git_push_callback(gitlab_data):
                   .filter(engagement=vf.engagement)
                   # @UndefinedVariable
                   .exclude(state=CheckListState.archive.name)
-                  .exclude(state=CheckListState.closed.name))  # @UndefinedVariable
+                  .exclude(state=CheckListState.closed.name))
 
     committed_files = set(file
                           for commit in gitlab_data['commits']
@@ -139,7 +150,8 @@ def git_push_callback(gitlab_data):
     peer_reviewer = vf.engagement.peer_reviewer
     slack_client = SlackClient()
     slack_client.send_notifications_on_git_push(
-        engagement_manual_id, vf_name, reviewer, peer_reviewer, committed_files)
+        engagement_manual_id, vf_name, reviewer, peer_reviewer,
+        committed_files)
 
     # loop through the checklists and start automation if necessary
     for checklist in checklists:
@@ -156,32 +168,42 @@ def git_push_callback(gitlab_data):
                    for extension in ['.yaml', '.yml', '.env']
                    if file.lower().endswith(extension)):
             continue
-        if checklist.state == CheckListState.pending.name:  # @UndefinedVariable
-            description = "Checklist {checklist.name} (part of VF {vf.name}/{vf.uuid}) in Pending state will transition to Automation due to a push action on files [{mutual_files}]. chosen EL: {user.full_name}".format(
+        if checklist.state == CheckListState.pending.name:
+            description = "Checklist {checklist.name} (part of VF \
+            {vf.name}/{vf.uuid}) in Pending state will transition \
+            to Automation due to a push action on files \
+            [{mutual_files}]. chosen EL: \
+            {user.full_name}".format(
                 checklist=checklist,
                 vf=vf,
                 mutual_files=", ".join(mutual_files),
                 user=user,
             )
         else:
-            description = "Checklist {checklist.uuid} (part of VF {vf.name}/{vf.uuid}) has been rejected due to a push action made on files [{mutual_files}]. chosen EL is: {user.full_name}".format(
+            description = "Checklist {checklist.uuid} (part of VF \
+            {vf.name}/{vf.uuid}) has been rejected due to a push \
+            action made on files [{mutual_files}]. chosen EL is: \
+            {user.full_name}".format(
                 checklist=checklist,
                 vf=vf,
                 mutual_files=", ".join(mutual_files),
                 user=user,
             )
         logger.debug(description)
-        # FIXME Setting parameters into a global before calling a function that will break without
+        # FIXME Setting parameters into a global before
+        # calling a function that will break without
         # them is TERRIBLE. We must fix this before we open-source this code.
         request_data_mgr.set_cl_uuid(checklist.uuid)
         request_data_mgr.set_user(user)
-        data = set_state(  # means that the checklist will be declined and a cloned one is
+        data = set_state(  # means that the checklist will
+                           # be declined and a cloned one is
             # created in PENDING status
             decline=True,
             checklist_uuid=checklist.uuid,
             # means the checklist will be triggered into automation cycle
             isMoveToAutomation=True,
-            description="This change was triggered by an update to the engagement git repository.")
+            description="This change was triggered by an update \
+            to the engagement git repository.")
 
         logger.debug("set_state returned (%r)" % data)
 
index 04d77c5..0e42b8a 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -56,7 +56,8 @@ executor = concurrent.futures.ThreadPoolExecutor(max_workers=4)
 def send_jenkins_job_and_gitlab_repo_exists(vf):
     # A signal which check if jenkins job was created and also if gitlab repo
     logger.debug(
-        "Sending a call to validation manager. Call=jenkins_job_and_gitlab_repo_exists_callback. vf=%s", vf.uuid)
+        "Sending a call to validation manager." +
+        "Call=jenkins_job_and_gitlab_repo_exists_callback. vf=%s", vf.uuid)
     is_ready = vm_api.jenkins_job_and_gitlab_repo_exists_callback(vf=vf)
     return is_ready
 
@@ -67,28 +68,36 @@ def send_cl_from_pending_to_automation_event(checkListObj):
     # validation manager)
     vf = VF.objects.get(engagement=checkListObj.engagement)
     logger.debug(
-        "Sending a call to validation manager. Call=send_cl_from_pending_to_automation_event. checklistUuid=%s", checkListObj.uuid)
-    vm_api.cl_from_pending_to_automation_callback(vf=vf, checklist=checkListObj)
+        "Sending a call to validation manager." +
+        "Call=send_cl_from_pending_to_automation_event." +
+        "checklistUuid=%s", checkListObj.uuid)
+    vm_api.cl_from_pending_to_automation_callback(
+        vf=vf, checklist=checkListObj)
 
 
 def send_ssh_key_created_or_updated_event(user):
     # A signal which is sent from the EM to the VM when a user is adding or
     # updating their ssh key
     logger.debug(
-        "Sending a call to validation manager. Call=send_ssh_key_created_or_updated_event. user=%s", user.uuid)
+        "Sending a call to validation manager. " +
+        "Call=send_ssh_key_created_or_updated_event. user=%s", user.uuid)
     vm_api.ssh_key_created_or_updated_callback(user=user)
-    
+
+
 def send_create_user_in_rgwa_event(user):
     # A signal which is sent from the EM to the VM when a user is adding or
     # updating their ssh key
     logger.debug(
-        "Sending a call to validation manager. Call=send_create_user_in_rgwa_event. user=%s", user.full_name)
+        "Sending a call to validation manager. " +
+        "Call=send_create_user_in_rgwa_event. user=%s", user.full_name)
     vm_api.create_user_rgwa(user=user)
 
 
-def send_remove_all_standard_users_from_project_event(gitlab, project_id, formatted_vf):
+def send_remove_all_standard_users_from_project_event(
+        gitlab, project_id, formatted_vf):
     logger.debug(
-        "Sending a call to validation manager. Call=send_remove_all_standard_users_from_project_event.")
+        "Sending a call to validation manager." +
+        "Call=send_remove_all_standard_users_from_project_event.")
     vm_api.remove_all_standard_users_from_project(
         gitlab, project_id, formatted_vf)
 
@@ -97,21 +106,25 @@ def send_get_project_by_vf_event(vf, gitlab):
     if not settings.IS_SIGNAL_ENABLED:
         return None
     logger.debug(
-        "Sending a call to validation manager. Call=send_get_project_by_vf_event.")
+        "Sending a call to validation manager." +
+        "Call=send_get_project_by_vf_event.")
     vm_api.get_project_by_vf(vf, gitlab)
 
 
 def send_provision_new_vf_event(vf):
-    # A signal which is sent from the EM to the VM when a new VF is created. VM will than create a
+    # A signal which is sent from the EM to the
+    # VM when a new VF is created. VM will than create a
     # gitlab repo for that new VF.
     #
-    # Note: despite its name, this signal is not used only for new vfs, but to update existing gitlab
+    # Note: despite its name, this signal is not
+    # used only for new vfs, but to update existing gitlab
     # and jenkins provisioning when a vf changes e.g. when team members are
     # added or removed.
     try:
-        vm_api.provision_new_vf_callback(vf=vf) 
+        vm_api.provision_new_vf_callback(vf=vf)
         logger.debug(
-            "Sending a call to validation manager. Call=send_provision_new_vf_event. vf=%s", vf.uuid)
+            "Sending a call to validation manager. " +
+            "Call=send_provision_new_vf_event. vf=%s", vf.uuid)
     except Exception as e:
         el_role = Role.objects.get(name=Roles.el.name)  # @UndefinedVariable
         admin_role = Role.objects.get(
@@ -121,14 +134,15 @@ def send_provision_new_vf_event(vf):
         activity_data = VFProvisioningActivityData(
             vf, el_admin_list, vf.engagement, e)
         bus_service.send_message(ActivityEventMessage(activity_data))
-        
+
 
 def send_get_list_of_repo_files_event(vf):
     # A signal which is sent from the EM to the VM when a NextStep is created
     # and we need the VF associated files in the git repository
     files = vm_api.get_list_of_repo_files_callback(vf=vf)
     logger.debug(
-        "Sending a call to validation manager. Call=send_get_list_of_repo_files_event. vf=%s", vf.uuid)
+        "Sending a call to validation manager. " +
+        "Call=send_get_list_of_repo_files_event. vf=%s", vf.uuid)
 
     formatted_repo_files = []
 
@@ -142,11 +156,12 @@ def send_get_list_of_repo_files_event(vf):
 '''''''''''''''''''''''''''
  UTIL FUNCTIONS FOR SIGNALS
 '''''''''''''''''''''''''''
-    
+
 
 def fire_event_in_bg(function_name, obj):
     event_function = globals()[function_name]
     logger.debug(
-        " . . . . . . . . . . . . Fire event in background started: %s . . . . . . . . .  . . . ", function_name)
-    future = executor.submit(event_function, obj)
+        " . . . . . . . . . . . . Fire event in background started: %s " +
+        ". . . . . . . . .  . . . ", function_name)
+    executor.submit(event_function, obj)
     logger.debug("Main thread continue without blocking...")
index 43646a6..202801a 100644 (file)
@@ -1,5 +1,5 @@
 #!/usr/bin/env python
-# 
+#
 # ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index e7456f2..dbddff7 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
 # ============LICENSE_END============================================
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
-from mocks.gitlab_mock.services.gitlab_files_service import GitlabFilesResultsSvc
+from mocks.gitlab_mock.services.gitlab_files_service import \
+    GitlabFilesResultsSvc
 
 
 class GitlabFilesResultsREST():
 
     def get(self, vf):
         mock_gitlab_files_results_svc_obj = GitlabFilesResultsSvc()
-        response = mock_gitlab_files_results_svc_obj.retrieve_files_for_vf_repo()
+        response = mock_gitlab_files_results_svc_obj.\
+            retrieve_files_for_vf_repo()
         return response
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 3224f94..8970e13 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index df9d0dd..2e05c42 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -36,7 +36,8 @@
 # ============LICENSE_END============================================
 #
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
-from mocks.jenkins_mock.services.jenkins_tests_validation_service import JenkinsTestsResultsSvc
+from mocks.jenkins_mock.services.jenkins_tests_validation_service \
+    import JenkinsTestsResultsSvc
 from validationmanager.em_integration import em_client
 
 
@@ -45,8 +46,9 @@ class JenkinsTestsResultsREST():
     mock_tests_results_svc_obj = JenkinsTestsResultsSvc()
 
     def post(self, git_repo_url, checklist_uuid):
-        response = self.mock_tests_results_svc_obj.retrieve_tests_results_for_cl(
-            checklist_uuid)
+        response = self.mock_tests_results_svc_obj.\
+            retrieve_tests_results_for_cl(
+                checklist_uuid)
         em_client.test_finished(response)
 
     def get(self, eng_manual_id, vf_name):
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index beccb53..c9fa91c 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -51,15 +51,17 @@ class JenkinsTestsResultsSvc():
         response['checklist_uuid'] = checklist_uuid
         checklist = Checklist.objects.get(uuid=checklist_uuid)
         line_items = ChecklistLineItem.objects.filter(
-            template=checklist.template)[:JenkinsTestsResultsSvc().num_of_auto_tests]
+            template=checklist.template)[
+                :JenkinsTestsResultsSvc().num_of_auto_tests]
         optional_results = ['approved', 'denied']
         optional_text = ['Mock: All required tests passed',
                          'Mock: At least one of the required tests failed']
         response['decisions'] = list()
         for lineitem in line_items:
-            #random_result = random.choice(optional_results)
+            # random_result = random.choice(optional_results)
             random_result = optional_results[0]
-            #audit_log_text = optional_text[0] if random_result == optional_results[0] else optional_text[1]
+            # audit_log_text = optional_text[0] if random_result ==
+            # optional_results[0] else optional_text[1]
             audit_log_text = optional_text[0]
             response['decisions'].append(
                 {
index 643cb90..2205314 100644 (file)
@@ -40,6 +40,7 @@ Django==1.10.6
 apscheduler
 bleach
 boto
+celery[redis]
 configparser
 django-cors-headers
 django-storages
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 71b08be..b0cf8f7 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index dd99e5a..647ff38 100644 (file)
@@ -6,7 +6,7 @@ commands = django-admin.py test
 setenv = 
     DJANGO_SETTINGS_MODULE=vvp.settings.tox_settings
     PYTHONPATH={toxinidir}
-    SECRET_KEY=6mo22&_gtjf#wktqf1#ve^7=w6kx)uq0u*4ksk^aq8lte&)yul
+    SECRET_KEY=aaa049575840-SOME-FAKE-SECRET-KEY-aaa049575840
     ENVIRONMENT=development
     PROGRAM_NAME_URL_PREFIX=vvp
     EMAIL_HOST=localhost
@@ -18,16 +18,16 @@ setenv =
     PGPASSWORD=Aa123456
     PGHOST=localhost
     PGPORT=5433
-    SECRET_WEBHOOK_TOKEN=Aiwi8se4ien0foW6eimahch2zahshaGi
-    SECRET_GITLAB_AUTH_TOKEN=ieNgathapoo4zohvee9a
-    SECRET_JENKINS_PASSWORD=xaiyie0wuoqueuBu
-    SECRET_CMS_APP_CLIENT_ID=MHmJo0ccDheVVsIiQHZnY6LXPAC6H6HAMzhCCM16
-    SECRET_CMS_APP_CLIENT_SECRET=nI8QCFrKMpnw5nTs
+    SECRET_WEBHOOK_TOKEN=aaa049575840-FAKE-TOKEN-aaa049575840
+    SECRET_GITLAB_AUTH_TOKEN=aaa049-FAKE-SECRET-575840
+    SECRET_JENKINS_PASSWORD=aaa0495-FAKE-PASSWORD-75840
+    SECRET_CMS_APP_CLIENT_ID=aaa049575840-FAKE-CLIENT-ID-aaa049575840
+    SECRET_CMS_APP_CLIENT_SECRET=aaa049-FAKE-SECRET-575840
     SLACK_API_TOKEN=
     S3_HOST=dev-s3.d2ice.att.io
     S3_PORT=443
-    AWS_ACCESS_KEY_ID=FD21HBU2KRN3UVD1MWRN
-    AWS_SECRET_ACCESS_KEY=TKoiwxziUWG9cTYUknUkFGmmyuQ27nP2lCiutEsD
+    AWS_ACCESS_KEY_ID=aaa049-FAKE-ACCESS-KEY-575840
+    AWS_SECRET_ACCESS_KEY=aaa049575840-SOME-FAKE-SECRET-KEY-aaa049575840
     STATIC_ROOT=/app/htdocs
 [base]
 deps = -r{toxinidir}/requirements.txt
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index aa2eeab..a0b8a8b 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 8576af0..552f98c 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -39,6 +39,9 @@
 # To avoid the server reloading this class twice, run it with --noreload flag
 
 from django.apps import AppConfig
+from engagementmanager.service.logging_service import LoggingServiceFactory
+
+logger = LoggingServiceFactory.get_logger()
 
 
 class ValidationmanagerConfig(AppConfig):
@@ -48,4 +51,7 @@ class ValidationmanagerConfig(AppConfig):
     def ready(self):
         # This otherwise unused import causes the signal receivers
         # to register themselves at the appropriate time. Do not remove.
+        # We use logger.debug to ignore flake8's warning about unused import.
         import validationmanager.em_integration.vm_api
+        logger.debug(
+            validationmanager.em_integration.vm_api.config_xml_content)
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 5620c0c..5fff71a 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 1650fa1..6fb422b 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -44,14 +44,17 @@ from django.forms.models import model_to_dict
 from django.template.loader import render_to_string
 import requests
 from engagementmanager.decorator.retry import retry_connection
-from engagementmanager.models import Engagement, IceUserProfile, Role, Checklist, \
-    ChecklistDecision, ChecklistLineItem, CheckListState, ChecklistTemplate, VF
+from engagementmanager.models import Engagement, IceUserProfile, \
+    Role, Checklist,\
+    ChecklistDecision, ChecklistLineItem, CheckListState, \
+    ChecklistTemplate, VF
 from engagementmanager.serializers import VFModelSerializerForSignal
 from engagementmanager.utils.constants import Roles, EngagementStage, \
-    CheckListLineType, JenkinsBuildParametersNames, RGWApermission
+    CheckListLineType, JenkinsBuildParametersNames, RGWApermission, CheckListCategory
 from engagementmanager.utils.cryptography import CryptographyText
 from engagementmanager.utils.validator import logEncoding
-from mocks.gitlab_mock.rest.gitlab_files_respons_rest import GitlabFilesResultsREST
+from mocks.gitlab_mock.rest.gitlab_files_respons_rest import \
+    GitlabFilesResultsREST
 from mocks.jenkins_mock.rest.jenkins_tests_validation_rest import \
     JenkinsTestsResultsREST
 
@@ -59,6 +62,7 @@ from rgwa_mock.services.rgwa_keys_service import RGWAKeysService
 from validationmanager.rados.rgwa_client_factory import RGWAClientFactory
 from validationmanager.utils.clients import get_jenkins_client, \
     get_gitlab_client
+from validationmanager.tasks import request_scan
 from engagementmanager.service.logging_service import LoggingServiceFactory
 
 logger = LoggingServiceFactory.get_logger()
@@ -101,11 +105,16 @@ def cl_from_pending_to_automation_callback(vf, checklist):
         logger.debug(
             "Engagement Manager has signaled that a checklist state was " +
             "changed from pending to automation")
-        get_jenkins_client().build_job(
-            vf.jenkins_job_name(), {
-                'checklist_uuid': checklist.uuid,
-                'git_repo_url': vf.git_repo_url,
-            })
+        if checklist.template and checklist.template.category == CheckListCategory.glance.name:
+            logger.debug("Triggering image scan")
+            request_scan(vf, checklist)
+        elif checklist.template and checklist.template.category == CheckListCategory.heat.name:
+            logger.debug("Triggering heat template validation")
+            get_jenkins_client().build_job(
+                vf.jenkins_job_name(), {
+                    'checklist_uuid': checklist.uuid,
+                    'git_repo_url': vf.git_repo_url,
+                })
 
 
 def provision_new_vf_callback(vf):
@@ -134,10 +143,8 @@ def provision_new_vf_callback(vf):
 
 def get_list_of_repo_files_callback(vf):
     """Given a vf, return its file list.
-
     This function will either succeed (and return a list),
     or throw an exception.
-
     """
     logger.debug(
         "Engagement Manager has signaled that there is a need " +
@@ -159,10 +166,8 @@ def get_list_of_repo_files_callback(vf):
 def ssh_key_created_or_updated_callback(user):
     if not settings.IS_SIGNAL_ENABLED:
         return None
-
     logger.debug("Engagement Manager has signaled that a user has " +
                  "created or updated an ssh key")
-
     user_dict = model_to_dict(user)
     gitlab = get_gitlab_client()
     gitlab_user = gitlab.get_user_by_email(user.email)
@@ -173,9 +178,7 @@ def ssh_key_created_or_updated_callback(user):
     if 'id' not in gitlab_user:
         err_msg = "coudln't get gitlab user %s " % user.uuid
         raise ValueError(err_msg)
-
     update_user_ssh_keys(user_dict, gitlab, gitlab_user)
-
     logger.debug(
         "Successfuly created/updated user in the git in " +
         "key_created_or_updated signal")
@@ -228,7 +231,7 @@ def ensure_checklists(vf):
 
 @retry_connection
 def ensure_jenkins_job(vf):
-    """Given a vf, ensure that its jenkins/TestEngine job exists.
+    """Given a vf, ensure that its jenkins/TestEngine jobs exist.
 
     This function will either succeed (and return None), or throw an exception.
 
@@ -241,16 +244,19 @@ def ensure_jenkins_job(vf):
     jenkins = get_jenkins_client()
     job_name = vf.jenkins_job_name()
 
-    # FIXME test-then-set can cause a race condition, so maybe better
-    # to attempt to create and ignore "already exists" error.
-    if jenkins.job_exists(job_name):
-        logger.debug(
-            "TestEngine job %s for VF %s already provisioned, skipping.",
-            job_name, vf.name)
-        return None
+    for namesuffix, xml in config_xml_content.items():
+        name = job_name + namesuffix
 
-    logger.debug("creating TestEngine job %s for VF %s", job_name, vf.name)
-    jenkins.create_job(job_name, config_xml_content)
+        # FIXME test-then-set can cause a race condition, so maybe better
+        # to attempt to create and ignore "already exists" error.
+        if jenkins.job_exists(name):
+            logger.debug(
+                "TestEngine job %s for VF %s already provisioned, skipping.",
+                name, vf.name)
+            continue
+
+        logger.debug("creating TestEngine job %s for VF %s", name, vf.name)
+        jenkins.create_job(name, xml)
 
 
 @retry_connection
@@ -261,7 +267,8 @@ def get_jenkins_build_log(vf, checklistUuid):
 
     """
     if not settings.IS_SIGNAL_ENABLED:
-        return jenkins_mock_object.get(vf.engagement.engagement_manual_id, vf.name)
+        return jenkins_mock_object.get(
+            vf.engagement.engagement_manual_id, vf.name)
     logger.debug("Retrieving VF's(%s) last Jenkins build log " % (vf.name))
     jenkins = get_jenkins_client()
     job_name = vf.jenkins_job_name()
@@ -271,35 +278,43 @@ def get_jenkins_build_log(vf, checklistUuid):
     logs = ''
     for build in vf_builds['builds']:
         for parameter in build['actions'][0]['parameters']:
-            if parameter['name'] == JenkinsBuildParametersNames.CHECKLIST_UUID:
+            if parameter['name'] == \
+                    JenkinsBuildParametersNames.CHECKLIST_UUID:
                 if parameter['value'] == checklistUuid:
                     logger.debug(
-                        "I have succeeded to match the given checklist uuid to one of the VF's builds' checklist_uuid")
+                        "I have succeeded to match the given checklist uuid \
+                        to one of the VF's builds' checklist_uuid")
                     build_num = build['number']
     if build_num < 0:
         logger.error(
-            "Failed to match the given checklist uuid to one of the VF's builds' checklist_uuid")
+            "Failed to match the given checklist uuid to one of the VF's \
+            builds' checklist_uuid")
     else:
         logs = jenkins.server.get_build_console_output(job_name, build_num)
     return logs
 
 
 def get_jenkins_job_config():
-    """Return the XML configuration for a Jenkins/TestEngine build job.
+    """Return the XML configurations for the Jenkins/TestEngine build job and
+    the Jenkins/Imagescanner results processing job.
 
-    The configuration is templated, and the context provided will
-    include the appropriate webhook endpoint for its notification
-    callbacks. It is not cached; do that from a higher level caller.
+    The configurations are templated, and the context provided will include the
+    appropriate webhook endpoint for its notification callbacks. It is not
+    cached; do that from a higher level caller.
 
     """
     # replacing auth in the view name 'jenkins-notification-endpoint'
     # (url.py) and appending it to the url from settings
-    webhook_endpoint = "http://%s%s" % (
-        settings.API_DOMAIN,
-        reverse('jenkins-notification-endpoint',
-                kwargs={'auth_token': settings.WEBHOOK_TOKEN}))
-    return render_to_string('jenkins_job_config.xml',
-                            {'notification_endpoint': webhook_endpoint})
+    context = {
+        'notification_endpoint': "http://%s%s" % (
+            settings.API_DOMAIN,
+            reverse(
+                'jenkins-notification-endpoint',
+                kwargs={'auth_token': settings.WEBHOOK_TOKEN}))}
+    return {
+        '': render_to_string('jenkins_job_config.xml', context),
+        '_scanner': render_to_string('imagescanner_job_config.xml', context),
+    }
 
 
 @retry_connection
@@ -633,14 +648,14 @@ def ensure_rgwa_entities(vf):
     """
     formated_vf = VFModelSerializerForSignal(vf).data
     engagement_stage = formated_vf['engagement']['engagement_stage']
+    bucket_name = vf.engagement.engagement_manual_id + "_" + vf.name.lower()
     if engagement_stage == EngagementStage.Active.name:
-        bucket_name = vf.engagement.engagement_manual_id+"_"+vf.name.lower()
         bucket = get_or_create_bucket(bucket_name)
         add_bucket_users(bucket, vf)
     elif engagement_stage == EngagementStage.Validated.name or\
             engagement_stage == EngagementStage.Completed.name or\
             engagement_stage == EngagementStage.Archived.name:
-        bucket = get_or_create_bucket(vf.engagement.engagement_manual_id)
+        bucket = get_or_create_bucket(bucket_name)
         remove_bucket_users_grants(bucket, vf)
 
 
@@ -649,13 +664,18 @@ def create_user_rgwa(user):
         logger.debug("Engagement Manager has signaled that a user has " +
                      "created an rgwa")
         rgwa = RGWAClientFactory.admin()
-        rgwa_user = rgwa.get_user(user.full_name)
+        rgwa_user = rgwa.get_user(user.uuid)
         if rgwa_user is None:
             logger.debug(
                 user.full_name + "User does not exist, a new one is created!")
             try:
                 rgwa_user = rgwa.create_user(
-                    uid=user.full_name, display_name='User "%s"' % user.full_name)
+                    uid=user.uuid,
+                    display_name=user.full_name,
+                    # admin will create and own the buckets users use. note:
+                    # radosgw treats 0 as "unlimited", -1 as "none"
+                    max_buckets=-1,
+                )
                 user = IceUserProfile.objects.get(uuid=user.uuid)
                 access_key = rgwa_user['keys'][0]['access_key']
                 secret_key = CryptographyText.encrypt(
@@ -669,20 +689,21 @@ def create_user_rgwa(user):
                     str(rgwa_user))
             except Exception as e:
                 logger.error(str(e))
-                err_msg = "coudln't get rgwa user %s " % user.full_name
+                err_msg = "coudln't get rgwa user %s " % user.uuid
                 raise ValueError(err_msg)
     else:
         rgwa_user = RGWAKeysService().mock_create_user(
-            uid=user.full_name, display_name='User "%s"' % user.full_name)
+            uid=user.uuid, display_name=user.full_name)
         user = IceUserProfile.objects.get(uuid=user.uuid)
         user.rgwa_access_key = rgwa_user['access_key']
-        user.rgwa_secret_key = CryptographyText.encrypt(rgwa_user['secret_key'])
+        user.rgwa_secret_key = CryptographyText.encrypt(
+            rgwa_user['secret_key'])
         user.save()
 
 
-def validate_rgwa_user(full_name, uuid):
+def validate_rgwa_user(uuid):
     rgwa = RGWAClientFactory.admin()
-    rgwa_user = rgwa.get_user(full_name)
+    rgwa_user = rgwa.get_user(uuid)
     if rgwa_user is None:
         create_user_rgwa(IceUserProfile.objects.get(uuid=uuid))
 
@@ -695,14 +716,14 @@ def add_bucket_users(bucket, vf):
 
 def add_bucket_user(user, bucket):
     try:
-        validate_rgwa_user(user.full_name, user.uuid)
+        validate_rgwa_user(user.uuid)
         bucket_acl = bucket.get_acl()
         grants = set((grant.id, grant.permission)
                      for grant in bucket_acl.acl.grants)
         for permission in [RGWApermission.READ, RGWApermission.WRITE]:
-            if (user.full_name, permission) in grants:
+            if (user.uuid, permission) in grants:
                 continue
-            bucket_acl.acl.add_user_grant(permission, user.full_name)
+            bucket_acl.acl.add_user_grant(permission, user.uuid)
         bucket.set_acl(bucket_acl)
     except Exception as e:
         err_msg = "Failed: Engagement team user with uuid " + \
@@ -735,5 +756,6 @@ def remove_bucket_users_grants(bucket, vf):
 def remove_bucket_user_grants(bucket, user):
     bucket_acl = bucket.get_acl()
     bucket_acl.acl.grants = [
-        grant for grant in bucket_acl.acl.grants if not grant.id == user.full_name]
+        grant for grant in bucket_acl.acl.grants if not grant.id ==
+        user.uuid]
     bucket.set_acl(bucket_acl)
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 66d4177..4cce73a 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -104,12 +104,14 @@ class GitlabClient(object):
 
     def create_project(self, name, **kwargs):
         """
-        Function creates a new project with specified parameters. The following parameters are
-        understood:
+        Function creates a new project with specified parameters.
+        The following parameters are understood:
 
         name:           The name of the new project
-        path:           Custom repository name for new project. default: based on name
-        namespace_id:   Namespace for the new project. default: current user's namespace
+        path:           Custom repository name for new project.
+                        default: based on name
+        namespace_id:   Namespace for the new project.
+                        default: current user's namespace
         description
         issues_enabled
         merge_requests_enabled
@@ -132,9 +134,12 @@ class GitlabClient(object):
 
         # filter kwargs to known parameters and non-optional args
         parameters = dict({k: kwargs[k] for k in kwargs if k in [
-            'path', 'namespace_id', 'description', 'issues_enabled', 'merge_requests_enabled',
-            'builds_enabled', 'wiki_enabled', 'snippets_enabled', 'container_registry_enabled',
-            'shared_runners_enabled', 'public', 'visibility_level', 'import_url',
+            'path', 'namespace_id', 'description',
+            'issues_enabled', 'merge_requests_enabled',
+            'builds_enabled', 'wiki_enabled',
+            'snippets_enabled', 'container_registry_enabled',
+            'shared_runners_enabled', 'public',
+            'visibility_level', 'import_url',
             'public_builds', 'only_allow_merge_if_build_succeeds',
             'only_allow_merge_if_all_discussions_are_resolved', 'lfs_enabled',
             'request_access_enabled',
@@ -206,7 +211,8 @@ class GitlabClient(object):
             logger.info("didnt find project: %s", logEncoding(resp.content))
         else:
             for project in resp.json():
-                if (project_name == project['name'] and group_id == project['namespace']['id']):
+                if (project_name == project['name'] and
+                        group_id == project['namespace']['id']):
                     project_found = project
                     break
 
@@ -219,7 +225,8 @@ class GitlabClient(object):
         email = email.lower()
         url = "%s?username=%s" % (self.users_url, str(username))
         resp = requests.get(url, headers=self.headers)
-        # logger.debug("get_user_by_email response: %s" % resp.content+". Response code: %s" % resp.status_code)
+        # logger.debug("get_user_by_email response: %s" % resp.content+".
+        # Response code: %s" % resp.status_code)
         if not resp.json():
             logger.info("didnt find user: %s", logEncoding(resp.content))
         else:
@@ -300,7 +307,8 @@ class GitlabClient(object):
         else:
             user_created = resp.json()
 
-#         logger.debug("create_user response: %s" % resp.content + ", Response code: %s" % resp.status_code)
+#         logger.debug("create_user response: %s" % resp.content + ",
+#         Response code: %s" % resp.status_code)
 
         return user_created
 
@@ -322,7 +330,8 @@ class GitlabClient(object):
         """
         Function removes a user from a gitlab project, using a given user id
         """
-        url = self.projects_url + '/' + str(project_id) + '/members/' + str(int(uid))
+        url = self.projects_url + '/' + \
+            str(project_id) + '/members/' + str(int(uid))
         return requests.delete(url, headers=self.headers)
 
     def list_users(self):
@@ -469,22 +478,28 @@ class GitlabClient(object):
 
     def get_repository_files(self, project_id):
         """
-        Function retrieves all files for a given repository by project id (In ICE projectId is 1:1 with repo_id)
+        Function retrieves all files for a given repository by project id
+        (In VVP projectId is 1:1 with repo_id)
         GET /projects/:id/repository/tree
         Doc: https://docs.gitlab.com/ce/api/repositories.html
         """
-#         endpoint = self.url+self.BASE_CTX+"projects/"+str(project_id)+"/repository/tree"
+#         endpoint = self.url+self.BASE_CTX+"projects/"+str(project_id)+
+#         "/repository/tree"
         endpoint = "%s%sprojects/%s/repository/tree" % (
             self.url, self.BASE_CTX, str(project_id))
         logger.debug("get_repository_files endpoint=" + endpoint)
         resp = requests.get(endpoint, headers=self.headers)
 
-        if resp.status_code == 404 and resp.json()['message'] == '404 Tree Not Found':
-            # When no initial commit has been created and there are no files in the repo, the
-            # response is not an empty list but "404 Tree Not Found." Intercept this and return
+        if resp.status_code == 404 and resp.json()['message'] == \
+                '404 Tree Not Found':
+            # When no initial commit has been created and there are
+            # no files in the repo, the response is not an empty list
+            # but "404 Tree Not Found." Intercept this and return
             # empty list instead.
-            logger.info("get_repository_files: Looks like there are no associated file to project %s. Response : %s, status = %s", logEncoding(
-                project_id), logEncoding(resp.content), 404)
+            logger.info("get_repository_files: Looks like there are" +
+                        "no associated file to project %s." +
+                        "Response : %s, status = %s", logEncoding(
+                            project_id), logEncoding(resp.content), 404)
             return []
 
         return resp.json()
@@ -534,8 +549,9 @@ class GitlabClient(object):
         https://docs.gitlab.com/ce/api/projects.html
         """
         parameters = dict({k: kwargs[k] for k in kwargs if k in [
-            'push_events', 'issues_events', 'merge_requests_events', 'tag_push_events',
-            'note_events', 'build_events', 'pipeline_events', 'wiki_events',
+            'push_events', 'issues_events', 'merge_requests_events',
+            'tag_push_events', 'note_events', 'build_events',
+            'pipeline_events', 'wiki_events',
             'enable_ssl_verification', 'token']},
             id=project_id,
             url=url,
@@ -544,13 +560,15 @@ class GitlabClient(object):
         if hook_id is None:
             # New hook
             endpoint = "%s/api/v3/projects/%s/hooks" % (self.url, project_id)
-            return requests.post(endpoint, json=parameters, headers=self.headers)
+            return requests.post(endpoint, json=parameters,
+                                 headers=self.headers)
         else:
             # Update existing hook
             parameters['hook_id'] = hook_id
             endpoint = "%s/api/v3/projects/%s/hooks/%s" % (
                 self.url, project_id, hook_id)
-            return requests.put(endpoint, json=parameters, headers=self.headers)
+            return requests.put(endpoint, json=parameters,
+                                headers=self.headers)
 
     def delete_project_hook(self, project_id, hook_id):
         endpoint = "%s/api/v3/projects/%s/hooks/%s" % (
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index d8d383e..9ee929b 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 4cb1430..15de079 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -58,11 +58,18 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='ActiveJob',
             fields=[
-                ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
+                ('uuid', models.UUIDField(
+                    default=uuid.uuid4, editable=False,
+                    primary_key=True, serialize=False)),
                 ('url', models.URLField(
-                    help_text=b'            The jenkins job URL, which should uniquely identify one\n            execution of the TestEngine.')),
-                ('checklist', models.ForeignKey(help_text=b'            The checklist associated with this job.',
-                                                on_delete=django.db.models.deletion.CASCADE, to='engagementmanager.Checklist')),
+                    help_text=b'            The jenkins job URL, which should \
+                    uniquely identify one\n \
+                                execution of the TestEngine.')),
+                ('checklist', models.ForeignKey(
+                    help_text=b'            \
+                The checklist associated with this job.',
+                    on_delete=django.db.models.deletion.CASCADE,
+                    to='engagementmanager.Checklist')),
             ],
             options={
                 'db_table': 'ice_vm_active_job',
@@ -71,10 +78,13 @@ class Migration(migrations.Migration):
         migrations.CreateModel(
             name='ValidationTest',
             fields=[
-                ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
+                ('uuid', models.UUIDField(default=uuid.uuid4,
+                                          editable=False,
+                                          primary_key=True, serialize=False)),
                 ('name', models.CharField(max_length=128)),
                 ('line_items', models.ManyToManyField(
-                    to='engagementmanager.ChecklistLineItem', verbose_name=b'Satisfies Line Items')),
+                    to='engagementmanager.ChecklistLineItem',
+                    verbose_name=b'Satisfies Line Items')),
             ],
             options={
                 'db_table': 'ice_vm_validation_test',
index 653f5f4..d2213c7 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index bcc716a..6707a10 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -53,6 +53,8 @@ class Migration(migrations.Migration):
         migrations.AlterField(
             model_name='validationtest',
             name='line_items',
-            field=models.ManyToManyField(to='engagementmanager.ChecklistLineItem', verbose_name='Satisfies Line Items'),
+            field=models.ManyToManyField(
+                to='engagementmanager.ChecklistLineItem',
+                verbose_name='Satisfies Line Items'),
         ),
     ]
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index dab60ce..03ef18f 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -52,7 +52,8 @@ class ValidationTest(models.Model):
     as the first word in the TAP description.
 
     """
-    uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
+    uuid = models.UUIDField(primary_key=True, default=uuid.uuid4,
+                            editable=False)
     name = models.CharField(max_length=128)
     line_items = models.ManyToManyField(ChecklistLineItem,
                                         verbose_name="Satisfies Line Items")
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 232b900..9b72290 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -94,11 +94,12 @@ class RGWAClient(object):
 
     """
     valid_args = {
-                     'quota_type': ['user', 'bucket'],
-                     'key_type': ['s3', 'swift'],
-                 },
+        'quota_type': ['user', 'bucket'],
+        'key_type': ['s3', 'swift'],
+    },
 
-    def __init__(self, base_url, access_key=None, secret_key=None, verify='/etc/ssl/certs/ca-certificates.crt',
+    def __init__(self, base_url, access_key=None, secret_key=None,
+                 verify='/etc/ssl/certs/ca-certificates.crt',
                  return_raw_response=False):
         """
 
@@ -259,7 +260,8 @@ class RGWAClient(object):
     # http://docs.ceph.com/docs/master/radosgw/adminops/
     #
 
-    def get_usage(self, uid=None, start=None, end=None, show_entries=False, show_summary=False):
+    def get_usage(self, uid=None, start=None, end=None, show_entries=False,
+                  show_summary=False):
         """Request bandwidth usage information.
 
         Note: this feature is disabled by default, can be enabled by setting
@@ -353,7 +355,8 @@ class RGWAClient(object):
             purge_data=purge_data,
         )
 
-    def create_subuser(self, uid, subuser=None, secret_key=None, access_key=None,
+    def create_subuser(self, uid, subuser=None,
+                       secret_key=None, access_key=None,
                        key_type=None, access=None, generate_secret=False):
         """Create a new subuser.
 
@@ -374,8 +377,8 @@ class RGWAClient(object):
             generate_secret=generate_secret,
         )
 
-    def modify_subuser(self, uid, subuser, secret=None, key_type='swift', access=None,
-                       generate_secret=False):
+    def modify_subuser(self, uid, subuser, secret=None,
+                       key_type='swift', access=None, generate_secret=False):
         """Modify an existing subuser."""
         return self._request(
             'post', 'user', 'subuser',
@@ -569,7 +572,8 @@ class RGWAClient(object):
     def get_user_quota(self, uid):
         return self.get_quota(uid=uid, quota_type='user')
 
-    def set_user_quota(self, uid, max_size_kb=None, max_objects=None, enabled=None):
+    def set_user_quota(self, uid, max_size_kb=None,
+                       max_objects=None, enabled=None):
         return self.set_quota(
             uid=uid,
             quota_type='user',
@@ -581,7 +585,8 @@ class RGWAClient(object):
     def get_user_bucket_quota(self, uid):
         return self.get_quota(uid=uid, quota_type='bucket')
 
-    def set_user_bucket_quota(self, uid, bucket, max_size_kb=None, max_objects=None,
+    def set_user_bucket_quota(self, uid, bucket,
+                              max_size_kb=None, max_objects=None,
                               enabled=None):
         return self.set_quota(
             uid=uid,
index ff29897..ba29b32 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 4aeb5d4..1931e7d 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 0a22551..d6f69b5 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -52,7 +52,8 @@ class InvalidGitlabEventException(APIException):
 
 class InvalidJenkinsPhaseException(APIException):
     status_code = HTTP_400_BAD_REQUEST
-    default_detail = 'Jenkins job build notification phase was missing or invalid.'
+    default_detail = 'Jenkins job build notification phase \
+    was missing or invalid.'
 
 
 class InvalidPayloadException(APIException):
index 21b3760..6b0f312 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -272,18 +272,23 @@ class JenkinsWebhookEndpoint(APIView):
             }}
         logger.debug('sending test_finished with payload %s', payload)
 
-        # The Validation Engine suite will always include a successful result with the description
-        # "test_this_sentinel_always_succeeds'. If it is not present, we assume something has gone
+        # The Validation Engine suite will always include a successful
+        # result with the description.
+        # "test_this_sentinel_always_succeeds'. If it is not present,
+        # we assume something has gone
         # wrong with the Validation Engine itself.
         # if 'test_this_sentinel_always_succeeds' not in test_results:
-        #    logger.error('Validation Engine failed to include sentinel. Assuming it failed. Full log: %s',
+        #    logger.error('Validation Engine failed to include sentinel.
+        # Assuming it failed. Full log: %s',
         #                 logEncoding(request.data['build']['log']))
-        #    payload['checklist']['error'] = 'The Validation Engine encountered an error.'
-        #    # If possible, identify what specifically went wrong and provide a message to return to
-        #    # the user.
-        #    if 'fatal: Could not read from remote repository' in request.data['build']['log']:
-        #        payload['checklist']['error'] += " There was a problem cloning a git repository."
-
+        #    payload['checklist']['error'] = 'The Validation Engine \
+        # encountered an error.'
+        #     If possible, identify what specifically went wrong and
+        # provide a message to return to the user.
+        #    if 'fatal: Could not read from remote repository'
+        #     in request.data['build']['log']:
+        #         payload['checklist']['error'] += " There was a problem \
+        # cloning a git repository."
         # Send Signal
         em_client.test_finished(checklist_test_results=payload['checklist'])
 
diff --git a/django/validationmanager/tasks.py b/django/validationmanager/tasks.py
new file mode 100644 (file)
index 0000000..5d7b0d2
--- /dev/null
@@ -0,0 +1,49 @@
+from celery import Celery
+from django.conf import settings
+from engagementmanager.models import CheckListState
+
+celery_app = Celery(
+    broker='redis://redis',
+    backend='redis://redis',
+    )
+
+# Celery signatures allow us to invoke the imagescanner celery task without
+# importing or depending upon imagescanner's code here. (Because doing so would
+# make all of imagescanner's dependencies get added to this Django project.)
+#
+# FIXME for some reason, requests submitted in this way do not show their
+# arguments in the simple frontend's "Executing" and "Pending" lists. It
+# appears only as "()"
+_request_scan = celery_app.signature(
+    'imagescanner.tasks.request_scan',
+    queue='scans',
+    ignore_result=True)
+
+
+def request_scan(vf, checklist):
+    """Issue a request (using Celery and Redis) for the imagescanner to run.
+
+    This function issues the request asynchronously and returns quickly.
+
+    vf:
+        the VF corresponding to the image to be scanned. we use this to
+        determine the radosgw bucket name to search for images and the jenkins
+        job name to trigger with the image scan results.
+
+    checklist:
+        the checklist to be updated with the results of the scan.
+    """
+    # we can't necessarily look this up from the vf because there might be two
+    # available at the time this method runs (the new one, and the old one
+    # which will get changed to archive state)
+
+    return _request_scan.delay(
+        source="https://%s/%s_%s/" % (
+            settings.AWS_S3_HOST, vf.engagement.engagement_manual_id, vf.name),
+        path='',
+        recipients=[],
+        # this suffix should match the one in
+        # validationmanager.em_integration.vm_api.get_jenkins_job_config
+        jenkins_job_name=vf.jenkins_job_name() + '_scanner',
+        checklist_uuid=checklist.uuid,
+        )
diff --git a/django/validationmanager/templates/imagescanner_job_config.xml b/django/validationmanager/templates/imagescanner_job_config.xml
new file mode 100644 (file)
index 0000000..19d5eb5
--- /dev/null
@@ -0,0 +1,54 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<project>
+  <actions/>
+  <description>Handler for ImageScanner results</description>
+  <keepDependencies>false</keepDependencies>
+  <properties>
+    <com.tikal.hudson.plugins.notification.HudsonNotificationProperty plugin="notification@1.11">
+      <endpoints>
+        <com.tikal.hudson.plugins.notification.Endpoint>
+          <protocol>HTTP</protocol>
+          <format>JSON</format>
+          <url>{{ notification_endpoint }}</url>
+          <event>finalized</event>
+          <timeout>30000</timeout>
+          <loglines>-1</loglines>
+        </com.tikal.hudson.plugins.notification.Endpoint>
+      </endpoints>
+    </com.tikal.hudson.plugins.notification.HudsonNotificationProperty>
+    <hudson.model.ParametersDefinitionProperty>
+      <parameterDefinitions>
+        <hudson.model.StringParameterDefinition>
+          <name>checklist_uuid</name>
+          <description>The UUID of the checklist to be validated.</description>
+          <defaultValue></defaultValue>
+        </hudson.model.StringParameterDefinition>
+        <hudson.model.StringParameterDefinition>
+          <name>status</name>
+          <description>The UNIX exit status of the scanner (0=success)</description>
+          <defaultValue></defaultValue>
+        </hudson.model.StringParameterDefinition>
+        <hudson.model.StringParameterDefinition>
+          <name>logurl</name>
+          <description>A URL to the imagescanner log file, which will be retrieved and parsed</description>
+          <defaultValue></defaultValue>
+        </hudson.model.StringParameterDefinition>
+      </parameterDefinitions>
+    </hudson.model.ParametersDefinitionProperty>
+  </properties>
+  <scm class="hudson.scm.NullSCM"/>
+  <canRoam>true</canRoam>
+  <disabled>false</disabled>
+  <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
+  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
+  <triggers/>
+  <concurrentBuild>false</concurrentBuild>
+  <builders>
+    <hudson.tasks.Shell>
+        <command><![CDATA[#!/bin/sh
+exec imagescanner-results-processor]]></command>
+    </hudson.tasks.Shell>
+  </builders>
+  <publishers/>
+  <buildWrappers/>
+</project>
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index bca44c1..5c1bd48 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -42,7 +42,8 @@ from uuid import uuid4
 from django.conf import settings
 from rest_framework.status import HTTP_200_OK
 
-from engagementmanager.models import Vendor, ChecklistSection, ChecklistDecision, ChecklistLineItem
+from engagementmanager.models import Vendor, ChecklistSection, \
+    ChecklistDecision, ChecklistLineItem
 from engagementmanager.tests.test_base_entity import TestBaseEntity
 from engagementmanager.utils.constants import CheckListLineType,\
     CheckListDecisionValue, Constants
@@ -51,46 +52,67 @@ from engagementmanager.utils.constants import CheckListLineType,\
 class TestTestFinishedSignalCase(TestBaseEntity):
 
     def childSetup(self):
-        self.createVendors([Constants.service_provider_company_name, 'Amdocs'])
+        self.createVendors([Constants.service_provider_company_name,
+                            'Amdocs'])
         self.createDefaultRoles()
 
         self.el_user = self.creator.createUser(Vendor.objects.get(
             name=Constants.service_provider_company_name),
-            self.randomGenerator("main-vendor-email"), '55501000199', 'el user', self.el, True)
+            self.randomGenerator("main-vendor-email"), '55501000199',
+            'el user', self.el, True)
         self.user = self.creator.createUser(Vendor.objects.get(
             name=Constants.service_provider_company_name),
-            self.randomGenerator("main-vendor-email"), '55501000199', 'user', self.standard_user, True)
+            self.randomGenerator("main-vendor-email"), '55501000199', 'user',
+            self.standard_user, True)
         self.peer_reviewer = self.creator.createUser(Vendor.objects.get(
             name=Constants.service_provider_company_name),
-            self.randomGenerator("main-vendor-email"), '55501000199', 'peer-reviewer user', self.el, True)
+            self.randomGenerator("main-vendor-email"), '55501000199',
+            'peer-reviewer user', self.el, True)
         token = settings.WEBHOOK_TOKEN
         self.urlStr = "/v/hook/test-complete/" + token
 
         self.req = dict()
         self.token = self.loginAndCreateSessionToken(self.el_user)
         self.template = self.creator.createDefaultCheckListTemplate()
-        self.engagement = self.creator.createEngagement('just-a-fake-uuid', 'Validation', None)
+        self.engagement = self.creator.createEngagement(
+            'just-a-fake-uuid', 'Validation', None)
         self.engagement.engagement_team.add(self.el_user, self.user)
         self.checklist = self.creator.createCheckList(
-            'some-checklist', 'Automation', 1, '{}', self.engagement, self.template, self.el_user, self.peer_reviewer)
-        self.section = ChecklistSection.objects.create(uuid=uuid4(), name=self.randomGenerator("randomString"), weight=1.0, description=self.randomGenerator(
-            "randomString"), validation_instructions=self.randomGenerator("randomString"), template=self.template)
-        self.line_item = ChecklistLineItem.objects.create(uuid=uuid4(), name=self.randomGenerator("randomString"), weight=1.0, description=self.randomGenerator(
-            "randomString"), line_type=CheckListLineType.auto.name, validation_instructions=self.randomGenerator("randomString"), template=self.template, section=self.section)  # @UndefinedVariable
+            'some-checklist', 'Automation', 1, '{}', self.engagement,
+            self.template, self.el_user, self.peer_reviewer)
+        self.section = ChecklistSection.objects.create(
+            uuid=uuid4(), name=self.randomGenerator("randomString"),
+            weight=1.0, description=self.randomGenerator(
+                "randomString"),
+            validation_instructions=self.randomGenerator("randomString"),
+            template=self.template)
+        self.line_item = ChecklistLineItem.objects.create(
+            uuid=uuid4(), name=self.randomGenerator("randomString"),
+            weight=1.0, description=self.randomGenerator(
+                "randomString"), line_type=CheckListLineType.auto.name,
+            validation_instructions=self.randomGenerator("randomString"),
+            template=self.template, section=self.section)
         self.decision = ChecklistDecision.objects.create(
-            uuid=uuid4(), checklist=self.checklist, template=self.template, lineitem=self.line_item)
-        self.vendor = Vendor.objects.get(name=Constants.service_provider_company_name)
+            uuid=uuid4(), checklist=self.checklist, template=self.template,
+            lineitem=self.line_item)
+        self.vendor = Vendor.objects.get(
+            name=Constants.service_provider_company_name)
         self.deploymentTarget = self.creator.createDeploymentTarget(
-            self.randomGenerator("randomString"), self.randomGenerator("randomString"))
-        self.vf = self.creator.createVF(self.randomGenerator("randomString"),
-                                        self.engagement, self.deploymentTarget, False, self.vendor)
+            self.randomGenerator("randomString"),
+            self.randomGenerator("randomString"))
+        self.vf = self.creator.createVF(
+            self.randomGenerator("randomString"),
+            self.engagement,
+            self.deploymentTarget,
+            False, self.vendor)
 
     def initBody(self):
         self.req['checklist'] = dict()
         self.req['checklist']['checklist_uuid'] = str(self.checklist.uuid)
         decisionData = dict()
         decisionData['line_item_id'] = str(self.line_item.uuid)
-        decisionData['value'] = CheckListDecisionValue.approved.name  # @UndefinedVariable
+        # @UndefinedVariable
+        decisionData['value'] = CheckListDecisionValue.approved.name
         decisionData['audit_log_text'] = "audiot text blah blaj"
         self.req['checklist']['decisions'] = [decisionData]
         self.req['build'] = dict()
@@ -98,14 +120,14 @@ class TestTestFinishedSignalCase(TestBaseEntity):
         self.req['build']['url'] = "http://samplejob"
         self.req['build']['log'] = "Jenkins Log Example"
 
-    ### TESTS ###
     def testFinishedSignalPositive(self):
         if not settings.IS_SIGNAL_ENABLED:
             return
 
         self.initBody()
         datajson = json.dumps(self.req, ensure_ascii=False)
-        response = self.c.post(self.urlStr, datajson, content_type='application/json',
+        response = self.c.post(self.urlStr, datajson,
+                               content_type='application/json',
                                **{'HTTP_AUTHORIZATION': "token " + self.token})
 
         print('Got response : ' + str(response.status_code) +
index e3798f3..acbb8f3 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -44,7 +44,8 @@ from rest_framework.status import HTTP_200_OK
 
 from engagementmanager.models import Vendor, ChecklistSection, Checklist
 from engagementmanager.tests.test_base_entity import TestBaseEntity
-from engagementmanager.utils.constants import CheckListState, EngagementType, Constants
+from engagementmanager.utils.constants import CheckListState, \
+    EngagementType, Constants
 
 
 class TestGitPushSignalCase(TestBaseEntity):
@@ -57,33 +58,48 @@ class TestGitPushSignalCase(TestBaseEntity):
         self.fileAdded = "CHANGELOG"
         self.fileModified = "app/controller/application.rb"
 #         self.associatedFiles = [self.fileAdded, self.fileModified]
-        self.associatedFiles = "[\"" + self.fileAdded + "\",\"" + self.fileModified + "\"]"
+        self.associatedFiles = "[\"" + self.fileAdded + \
+            "\",\"" + self.fileModified + "\"]"
 
         # Create full engagement:
-        self.createVendors([Constants.service_provider_company_name, 'Amdocs'])
+        self.createVendors([Constants.service_provider_company_name,
+                            'Amdocs'])
         self.createDefaultRoles()
         self.el_user = self.creator.createUser(Vendor.objects.get(
             name=Constants.service_provider_company_name),
-            self.randomGenerator("main-vendor-email"), '55501000199', 'el user', self.el, True)
+            self.randomGenerator("main-vendor-email"), '55501000199',
+            'el user', self.el, True)
         self.user = self.creator.createUser(Vendor.objects.get(
             name=Constants.service_provider_company_name),
-            self.randomGenerator("main-vendor-email"), '55501000199', 'user', self.standard_user, True)
+            self.randomGenerator("main-vendor-email"), '55501000199',
+            'user', self.standard_user, True)
         self.peer_reviewer = self.creator.createUser(Vendor.objects.get(
             name=Constants.service_provider_company_name),
-            self.randomGenerator("main-vendor-email"), '55501000199', 'peer-reviewer user', self.el, True)
+            self.randomGenerator("main-vendor-email"), '55501000199',
+            'peer-reviewer user', self.el, True)
         self.template = self.creator.createDefaultCheckListTemplate()
         self.engagement = self.creator.createEngagement(
-            'just-a-fake-uuid', EngagementType.Validation.name, None)  # @UndefinedVariable
+            'just-a-fake-uuid', EngagementType.Validation.name, None)
         self.engagement.engagement_team.add(self.el_user, self.user)
-        self.checklist = self.creator.createCheckList('some-checklist', CheckListState.review.name, 1,
-                                                      self.associatedFiles, self.engagement, self.template, self.el_user, self.el_user)  # @UndefinedVariable
-        self.section = ChecklistSection.objects.create(uuid=uuid4(), name=self.randomGenerator("randomString"), weight=1.0, description=self.randomGenerator(
-            "randomString"), validation_instructions=self.randomGenerator("randomString"), template=self.template)
-        self.vendor = Vendor.objects.get(name=Constants.service_provider_company_name)
+        self.checklist = self.creator.createCheckList(
+            'some-checklist', CheckListState.review.name, 1,
+            self.associatedFiles, self.engagement, self.template,
+            self.el_user, self.el_user)
+        self.section = ChecklistSection.objects.create(
+            uuid=uuid4(), name=self.randomGenerator("randomString"),
+            weight=1.0,
+            description=self.randomGenerator(
+                "randomString"), validation_instructions=self.randomGenerator(
+                    "randomString"), template=self.template)
+        self.vendor = Vendor.objects.get(
+            name=Constants.service_provider_company_name)
         self.deploymentTarget = self.creator.createDeploymentTarget(
-            self.randomGenerator("randomString"), self.randomGenerator("randomString"))
+            self.randomGenerator("randomString"), self.randomGenerator(
+                "randomString"))
         self.vf = self.creator.createVF("TestVF-GitPush", self.engagement,
-                                        self.deploymentTarget, False, self.vendor, git_repo_url=self.gitRepoURL)
+                                        self.deploymentTarget, False,
+                                        self.vendor,
+                                        git_repo_url=self.gitRepoURL)
 
     def initBody(self):  # Create JSON for body REST request.
         self.data['object_kind'] = "push"
@@ -101,13 +117,13 @@ class TestGitPushSignalCase(TestBaseEntity):
             commitsData['modified'] = [self.fileModified]
             commitsData['removed'] = []
             commitsList.append(commitsData)
-            for a in commitsData.values():  # Count number of commits in commitsData.
+            # Count number of commits in commitsData.
+            for a in commitsData.values():
                 if a != []:
                     totalCommits += 1
         self.data['commits'] = commitsList
         self.data['total_commits_count'] = totalCommits
 
-    ### TESTS ###
     def test_git_push_event_positive(self):
         if not settings.IS_SIGNAL_ENABLED:
             return
@@ -119,11 +135,14 @@ class TestGitPushSignalCase(TestBaseEntity):
         print(datajson)
         headers = {'HTTP_X_GITLAB_EVENT': "Push Hook"}
 
-        response = self.c.post(self.urlStr, datajson, content_type='application/json', **headers)
+        response = self.c.post(self.urlStr, datajson,
+                               content_type='application/json', **headers)
         print("Got response: " + str(response.status_code) +
               ", Expecting 200. Response body: " + response.reason_phrase)
         self.assertEqual(response.status_code, HTTP_200_OK)
 
         checklistState = Checklist.objects.get(uuid=self.checklist.uuid)
-        print("Checklist state (final, should be 'archive'): " + checklistState.state)
-        self.assertEqual(checklistState.state, CheckListState.archive.name)  # @UndefinedVariable
+        print("Checklist state (final, should be 'archive'): "
+              + checklistState.state)
+        # @UndefinedVariable
+        self.assertEqual(checklistState.state, CheckListState.archive.name)
index 0280fd0..dc38aa5 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -40,7 +40,9 @@ from boto.s3.connection import S3Connection
 
 from engagementmanager.tests.test_base_entity import TestBaseEntity
 from validationmanager.rados.rgwa_client import RGWAClient
-from validationmanager.rados.rgwa_client_factory import RGWAClientFactory as RGWAClientFactorySing
+from validationmanager.rados.rgwa_client_factory import \
+    RGWAClientFactory as RGWAClientFactorySing
+
 
 class TestRGWAClientFactory(TestBaseEntity):
     def childSetup(self):
@@ -52,4 +54,5 @@ class TestRGWAClientFactory(TestBaseEntity):
 
     def testStandardClientCreation(self):
         client = RGWAClientFactorySing.standard()
-        self.assertTrue(client is not None and isinstance(client, S3Connection))
+        self.assertTrue(
+            client is not None and isinstance(client, S3Connection))
index 5c6edb8..50ec791 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
 from django.conf.urls import url
 
-from validationmanager.rest import git_webhook_endpoint, jenkins_webhook_endpoint
+from validationmanager.rest import git_webhook_endpoint,\
+    jenkins_webhook_endpoint
 
 
 urlpatterns = [
     url(r'^hook/test-complete(?:/(?P<auth_token>[^/]+)/?)?$',
-        jenkins_webhook_endpoint.JenkinsWebhookEndpoint.as_view(), name='jenkins-notification-endpoint'),
+        jenkins_webhook_endpoint.JenkinsWebhookEndpoint.as_view(),
+        name='jenkins-notification-endpoint'),
     url(r'^hook/git-push(?:/(?P<auth_token>[^/]+)/?)?$',
-        git_webhook_endpoint.GitWebhookEndpoint.as_view(), name='git-push-endpoint'),
+        git_webhook_endpoint.GitWebhookEndpoint.as_view(),
+        name='git-push-endpoint'),
 ]
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 0a6a34d..766f1b7 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index b110f23..32bf95d 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index b9a8254..2d0e6a2 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -40,14 +40,16 @@ from collections import defaultdict
 
 
 class KeyAwareDefaultDict(defaultdict):
-    """A defaultdict whose missing-key factory is passed the missing key as its only argument.
+    """A defaultdict whose missing-key factory
+    is passed the missing key as its only argument.
 
     See https://docs.python.org/3/library/collections.html#defaultdict-objects
 
     """
 
     def __missing__(self, key):
-        # This code is modified copypasta from help(collections.defaultdict.__missing__).
+        # This code is modified copypasta from help
+        # (collections.defaultdict.__missing__).
         # Unfortunately there is no simpler way to override its behavior.
         if self.default_factory is None:
             raise KeyError((key,))
index 1726c13..16f81cb 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
index 530bd7a..7e9f950 100644 (file)
@@ -57,7 +57,8 @@ EMAIL_USE_SSL = True
 REST_FRAMEWORK = {
     # Use Django's standard `django.contrib.auth` permissions,
     # or allow read-only access for unauthenticated users.
-    'EXCEPTION_HANDLER': 'engagementmanager.utils.exception_handler.ice_exception_handler',
+    'EXCEPTION_HANDLER': \
+    'engagementmanager.utils.exception_handler.ice_exception_handler',
     'PAGE_SIZE': 10,
     'DEFAULT_PERMISSION_CLASSES': (
         'rest_framework.permissions.IsAuthenticated',
@@ -78,7 +79,8 @@ JWT_AUTH = {
     'JWT_AUTH_HEADER_PREFIX': 'token',
     'JWT_ALGORITHM': 'HS256',
     'JWT_EXPIRATION_DELTA': datetime.timedelta(days=1),
-    'JWT_DECODE_HANDLER': 'engagementmanager.utils.authentication.ice_jwt_decode_handler',
+    'JWT_DECODE_HANDLER':
+    'engagementmanager.utils.authentication.ice_jwt_decode_handler',
 }
 
 APPEND_SLASH = False
@@ -101,7 +103,8 @@ MIDDLEWARE_CLASSES = [
     'django.middleware.security.SecurityMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.middleware.common.CommonMiddleware',
-    'django.contrib.auth.middleware.AuthenticationMiddleware',          # required by d.c.admin
+    # required by d.c.admin
+    'django.contrib.auth.middleware.AuthenticationMiddleware',
     'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
     'django.contrib.messages.middleware.MessageMiddleware',
     'django.middleware.clickjacking.XFrameOptionsMiddleware',
@@ -119,8 +122,10 @@ TEMPLATES = [
             'context_processors': [
                 'django.template.context_processors.debug',
                 'django.template.context_processors.request',
-                'django.contrib.auth.context_processors.auth',          # required by d.c.admin
-                'django.contrib.messages.context_processors.messages',  # required by d.c.admin
+                # required by d.c.admin
+                'django.contrib.auth.context_processors.auth',
+                # required by d.c.admin
+                'django.contrib.messages.context_processors.messages',
             ],
         },
     },
@@ -155,7 +160,7 @@ AUTH_PASSWORD_VALIDATORS = [
         'MinimumLengthValidator',
         'CommonPasswordValidator',
         'NumericPasswordValidator',
-        ]]
+    ]]
 
 
 # Internationalization
@@ -176,9 +181,12 @@ STATIC_ROOT = os.environ['STATIC_ROOT']
 LOGGING = {
     'version': 1,
     'disable_existing_loggers': False,
-    'formatters': {  # All possible attributes are: https://docs.python.org/3/library/logging.html#logrecord-attributes
+    # All possible attributes are:
+    # https://docs.python.org/3/library/logging.html#logrecord-attributes
+    'formatters': {
         'verbose': {
-            'format': '%(asctime)s %(levelname)s %(name)s %(module)s %(lineno)d %(process)d %(thread)d %(message)s'
+            'format': '%(asctime)s %(levelname)s %(name)s %(module)s \
+            %(lineno)d %(process)d %(thread)d %(message)s'
         },
         'simple': {
             'format': '%(asctime)s %(levelname)s %(name)s %(message)s'
@@ -190,7 +198,9 @@ LOGGING = {
             'formatter': 'simple'
         },
         'vvp-info.log': {
-            'level': 'INFO',  # handler will ignore DEBUG (only process INFO, WARN, ERROR, CRITICAL, FATAL)
+            # handler will ignore DEBUG (only process INFO, WARN, ERROR,
+            # CRITICAL, FATAL)
+            'level': 'INFO',
             'class': 'logging.FileHandler',
             'filename': os.path.join(LOGS_PATH, 'vvp-info.log'),
             'formatter': 'verbose'
@@ -216,7 +226,8 @@ LOGGING = {
     },
     'loggers': {
         'vvp.logger': {
-            'handlers': ['vvp-info.log', 'vvp-debug.log', 'vvp-requests.log', 'vvp-db.log', 'console'],
+            'handlers': ['vvp-info.log', 'vvp-debug.log', 'vvp-requests.log',
+                         'vvp-db.log', 'console'],
             'level': 'DEBUG' if DEBUG else 'INFO',
         },
         'django': {
@@ -247,7 +258,8 @@ LOGGING = {
 # VVP Related Configuration
 #############################
 CONTACT_FROM_ADDRESS = os.getenv('CONTACT_FROM_ADDRESS', 'dummy@example.com')
-CONTACT_EMAILS = [s.strip() for s in os.getenv('CONTACT_EMAILS', 'dummy@example.com').split(',') if s]
+CONTACT_EMAILS = [s.strip() for s in os.getenv(
+    'CONTACT_EMAILS', 'dummy@example.com').split(',') if s]
 DOMAIN = os.getenv('EM_DOMAIN_NAME', 'http://localhost:8080')
 TOKEN_EXPIRATION_IN_HOURS = 48
 DAILY_SCHEDULED_JOB_HOUR = 20
@@ -266,7 +278,8 @@ API_DOMAIN = 'em'
 # threat model
 WEBHOOK_TOKEN = os.environ['SECRET_WEBHOOK_TOKEN']
 
-# The authentication token and URL needed for us to issue requests to the GitLab API.
+# The authentication token and URL needed for us to issue requests to the
+# GitLab API.
 GITLAB_TOKEN = os.environ['SECRET_GITLAB_AUTH_TOKEN']
 GITLAB_URL = "http://gitlab/"
 
@@ -284,7 +297,8 @@ CMS_APP_CLIENT_SECRET = os.environ['SECRET_CMS_APP_CLIENT_SECRET']
 # slack integration
 SLACK_API_TOKEN = os.environ['SLACK_API_TOKEN']
 ENGAGEMENTS_CHANNEL = os.getenv('ENGAGEMENTS_CHANNEL', '')
-ENGAGEMENTS_NOTIFICATIONS_CHANNEL = os.getenv('ENGAGEMENTS_NOTIFICATIONS_CHANNEL:', '')
+ENGAGEMENTS_NOTIFICATIONS_CHANNEL = os.getenv(
+    'ENGAGEMENTS_NOTIFICATIONS_CHANNEL:', '')
 DEVOPS_CHANNEL = os.getenv('DEVOPS_CHANNEL', '')
 DEVOPS_NOTIFICATIONS_CHANNEL = os.getenv('DEVOPS_NOTIFICATIONS_CHANNEL', '')
 
index c9fd8f8..a24f9aa 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -48,7 +48,8 @@ Class-based views
     1. Add an import:  from other_app.views import Home
     2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
 Including another URLconf
-    1. Import the include() function: from django.conf.urls import url, include
+    1. Import the include() function:
+    from django.conf.urls import url, include
     2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
 """
 from django.conf.urls import include, url
@@ -58,7 +59,9 @@ from django.conf import settings
 
 urlpatterns = [
     url(r'^admin/', include(admin.site.urls)),
-    url(r'^%s/v1/engmgr/' % settings.PROGRAM_NAME_URL_PREFIX, include('engagementmanager.urls')),
+    url(r'^%s/v1/engmgr/' % settings.PROGRAM_NAME_URL_PREFIX,
+        include('engagementmanager.urls')),
     url(r'^v/', include('validationmanager.urls')),
-    url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
+    url(r'^api-auth/', include('rest_framework.urls',
+                               namespace='rest_framework')),
 ]
index e584b2d..bea050e 100644 (file)
@@ -1,5 +1,5 @@
-#  
-# ============LICENSE_START========================================== 
+#
+# ============LICENSE_START==========================================
 # org.onap.vvp/engagementmgr
 # ===================================================================
 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
diff --git a/tox.ini b/tox.ini
index b3fb5aa..60c12e3 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -1,15 +1,14 @@
 [tox]
-envlist = py36
-; py36-django1-10-6 ,style
+envlist = py36-django1-10-6, style
 skipsdist = True
 
 [testenv]
 changedir = {toxinidir}/django
 envlogdir = {toxinidir}/django/logs
-setenv =
+setenv = 
     DJANGO_SETTINGS_MODULE=vvp.settings.tox_settings
     PYTHONPATH={toxinidir}/django
-    SECRET_KEY=6mo22&_gtjf#wktqf1#ve^7=w6kx)uq0u*4ksk^aq8lte&)yul
+    SECRET_KEY=aaa049575840-SOME-FAKE-SECRET-KEY-aaa049575840
     ENVIRONMENT=development
     PROGRAM_NAME_URL_PREFIX=vvp
     EMAIL_HOST=localhost
@@ -21,16 +20,16 @@ setenv =
     PGPASSWORD=Aa123456
     PGHOST=localhost
     PGPORT=5433
-    SECRET_WEBHOOK_TOKEN=Aiwi8se4ien0foW6eimahch2zahshaGi
-    SECRET_GITLAB_AUTH_TOKEN=ieNgathapoo4zohvee9a
-    SECRET_JENKINS_PASSWORD=xaiyie0wuoqueuBu
-    SECRET_CMS_APP_CLIENT_ID=MHmJo0ccDheVVsIiQHZnY6LXPAC6H6HAMzhCCM16
-    SECRET_CMS_APP_CLIENT_SECRET=nI8QCFrKMpnw5nTs
+    SECRET_WEBHOOK_TOKEN=aaa049575840-FAKE-TOKEN-aaa049575840
+    SECRET_GITLAB_AUTH_TOKEN=aaa049-FAKE-SECRET-575840
+    SECRET_JENKINS_PASSWORD=aaa0495-FAKE-PASSWORD-75840
+    SECRET_CMS_APP_CLIENT_ID=aaa049575840-FAKE-CLIENT-ID-aaa049575840
+    SECRET_CMS_APP_CLIENT_SECRET=aaa049-FAKE-SECRET-575840
     SLACK_API_TOKEN=
-    S3_HOST=dev-s3.d2ice.att.io
+    S3_HOST=dev-s3.vvp
     S3_PORT=443
-    AWS_ACCESS_KEY_ID=FD21HBU2KRN3UVD1MWRN
-    AWS_SECRET_ACCESS_KEY=TKoiwxziUWG9cTYUknUkFGmmyuQ27nP2lCiutEsD
+    AWS_ACCESS_KEY_ID=aaa049-FAKE-ACCESS-KEY-575840
+    AWS_SECRET_ACCESS_KEY=aaa049575840-SOME-FAKE-SECRET-KEY-aaa049575840
     STATIC_ROOT=/app/htdocs
 
 [testenv:py36-django1-10-6]
@@ -47,6 +46,3 @@ commands = flake8
 [flake8]
 show-source = True
 exclude=venv-tox,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build
-
-[testenv:py36]
-commands = python --version