From 71891b3040605103397ffa7fb349215eced3a2c3 Mon Sep 17 00:00:00 2001 From: Edan Binshtok Date: Sun, 19 Nov 2017 11:50:50 +0200 Subject: Pep8 another fixes Add more fixes to pep8 Issue-ID: VVP-25 Change-Id: Icc3bd3977ced2b537c858a9801e04a6bf6d1db05 Signed-off-by: Edan Binshtok --- tests/apiTests/test_negative_requests.py | 151 ++++++++++++++++++++----------- 1 file changed, 100 insertions(+), 51 deletions(-) (limited to 'tests/apiTests/test_negative_requests.py') diff --git a/tests/apiTests/test_negative_requests.py b/tests/apiTests/test_negative_requests.py index d6f16cd..9efb69e 100644 --- a/tests/apiTests/test_negative_requests.py +++ b/tests/apiTests/test_negative_requests.py @@ -1,5 +1,5 @@ - -# ============LICENSE_START========================================== + +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -54,41 +54,49 @@ class TestNegativeRequests(TestApiBase, Helper): @exception() def test_negative_invite_member(self): logger.debug( - "This negative test will try to invite team member to an engagement using other auth token.") + "This negative test will try to invite team " + + "member to an engagement using other auth token.") user_a = API.VirtualFunction.create_engagement() user_b = API.VirtualFunction.create_engagement() user_a['session_token'] = user_b['session_token'] try: logger.debug( - "About to invite team member to the engagement of user " + user_a['full_name']) + "About to invite team member to the engagement of user " + + user_a['full_name']) API.VirtualFunction.invite_team_member(user_a) raise Exception( - user_a['full_name'] + " has invited user using other auth token.") - except: + user_a['full_name'] + + " has invited user using other auth token.") + except BaseException: logger.debug( "Success! Test failed to invite user using other auth token.") @exception() def test_negative_add_contact(self): logger.debug( - "This negative test will try to add contact to an engagement using other auth token.") + "This negative test will try to add contact to " + + "an engagement using other auth token.") user_a = API.VirtualFunction.create_engagement() user_b = API.VirtualFunction.create_engagement() user_a['session_token'] = user_b['session_token'] try: logger.debug( - "About to invite contact to the engagement of user " + user_a['full_name']) + "About to invite contact to the engagement of user " + + user_a['full_name']) API.VirtualFunction.add_contact(user_a) raise Exception( - user_a['full_name'] + " has invited contact user using other auth token.") - except: + user_a['full_name'] + + " has invited contact user using other auth token.") + except BaseException: logger.debug( - "Success! Test failed to invite contact user using other auth token.") + "Success! Test failed to invite contact " + + "user using other auth token.") @exception() def test_negative_add_next_step(self): logger.debug( - "This negative test will try to add a next step to engagement using PR / standard user / admin_ro auth token.") + "This negative test will try to add a next step to engagement " + + "using PR / standard user / admin_ro auth token.") user_content = API.VirtualFunction.create_engagement() users = [user_content['email'], user_content[ 'pr_email'], Constants.Users.AdminRO.EMAIL] @@ -96,19 +104,29 @@ class TestNegativeRequests(TestApiBase, Helper): token = "token " + API.User.login_user(user) user_content['session_token'] = token try: - logger.debug("About to add a next step to VF " + - user_content['vfName'] + " using " + user + " token.") + logger.debug( + "About to add a next step to VF " + + user_content['vfName'] + + " using " + + user + + " token.") API.VirtualFunction.add_next_step(user_content) raise Exception( - "Next step was added to VF " + user_content['vfName'] + " using " + user + " token.") - except: + "Next step was added to VF " + + user_content['vfName'] + + " using " + + user + + " token.") + except BaseException: logger.debug( - "Success! Test failed to add a new next step to the engagement using other auth token.") + "Success! Test failed to add a new next step to the " + + "engagement using other auth token.") @exception() def test_negative_edit_next_step(self): logger.debug( - "This negative test will try to edit a next step using PR / standard user / admin_ro auth token.") + "This negative test will try to edit a next step using PR / " + + "standard user / admin_ro auth token.") user_content = API.VirtualFunction.create_engagement() token = "token " + API.User.login_user(user_content['el_email']) user_content['session_token'] = token @@ -120,19 +138,25 @@ class TestNegativeRequests(TestApiBase, Helper): user_content['session_token'] = token try: logger.debug( - "About to edit a next step (ns uuid: " + ns_uuid + ") using " + user + " token.") + "About to edit a next step (ns uuid: " + + ns_uuid + + ") using " + + user + + " token.") API.VirtualFunction.edit_next_step(user_content, ns_uuid) raise Exception( "Next step was edited using " + user + " token.") - except: + except BaseException: logger.debug( - "Success! Test failed to edit a next step using other auth token.") + "Success! Test failed to edit a next step using " + + "other auth token.") @exception() def test_negative_create_checklist(self): user_content = API.VirtualFunction.create_engagement() logger.debug( - "This negative test will try to create a checklist using PR / standard user / admin_ro auth token.") + "This negative test will try to create a checklist " + + "using PR / standard user / admin_ro auth token.") users = [user_content['email'], user_content[ 'pr_email'], Constants.Users.AdminRO.EMAIL] for user in users: @@ -140,25 +164,29 @@ class TestNegativeRequests(TestApiBase, Helper): user_content['session_token'] = token try: logger.debug( - "About to create checklist for VF " + user_content['vfName']) + "About to create checklist for VF " + + user_content['vfName']) API.Checklist.create_checklist(user_content) raise Exception( "Checklist was created using " + user + " token.") - except: + except BaseException: logger.debug( - "Success! Test failed to create checklist using other auth token.") + "Success! Test failed to create checklist using other " + + "auth token.") @exception() def test_negative_update_checklist(self): user_content = API.VirtualFunction.create_engagement() API.GitLab.git_clone_push(user_content) logger.debug( - "Create checklist with engagement lead (next: try to edit checklist with PR and standard user)") + "Create checklist with engagement lead (next: try to edit " + + "checklist with PR and standard user)") token = "token " + API.User.login_user(user_content['el_email']) user_content['session_token'] = token cl_content = API.Checklist.create_checklist(user_content) logger.debug( - "This negative test will try to create a checklist using PR / standard user / admin_ro auth token.") + "This negative test will try to create a checklist using PR / " + + "standard user / admin_ro auth token.") users = [user_content['email'], user_content[ 'pr_email'], Constants.Users.AdminRO.EMAIL] for user in users: @@ -166,75 +194,89 @@ class TestNegativeRequests(TestApiBase, Helper): user_content['session_token'] = token try: logger.debug( - "About to update checklist for VF " + user_content['vfName']) + "About to update checklist for VF " + + user_content['vfName']) API.Checklist.update_checklist( user_content, cl_content['uuid']) raise Exception( "Checklist was created using " + user + " token.") - except: + except BaseException: logger.debug( - "Success! Test failed to create checklist using other auth token.") + "Success! Test failed to create checklist using other " + + "auth token.") @exception() def test_negative_set_checklist_state(self): user_content = API.VirtualFunction.create_engagement() API.GitLab.git_clone_push(user_content) logger.debug( - "Create checklist with engagement lead (next: try to change checklist state with PR, standard user and admin_ro)") + "Create checklist with engagement lead (next: try to change " + + "checklist state with PR, standard user and admin_ro)") token = "token " + API.User.login_user(user_content['el_email']) user_content['session_token'] = token cl_content = API.Checklist.create_checklist(user_content) logger.debug( - "This negative test will try to change checklist state using PR / standard user / admin_ro auth token.") + "This negative test will try to change checklist state using " + + "PR / standard user / admin_ro auth token.") users = [user_content['email'], user_content[ 'pr_email'], Constants.Users.AdminRO.EMAIL] for user in users: try: logger.debug( - "About to change checklist state for VF " + user_content['vfName']) + "About to change checklist state for VF " + + user_content['vfName']) API.Checklist.jump_state(cl_content['uuid'], user) raise Exception( "Checklist state was changed using " + user + " token.") - except: + except BaseException: logger.debug( - "Success! Test failed to change checklist state using other auth token.") + "Success! Test failed to change checklist state using " + + "other auth token.") @exception() def test_add_checklist_audit_log(self): user_content = API.VirtualFunction.create_engagement() logger.debug( - "Create checklist with engagement lead (next: try to add audit log to checklist with standard user and admin_ro)") + "Create checklist with engagement lead (next: try to add audit " + + "log to checklist with standard user and admin_ro)") token = "token " + API.User.login_user(user_content['el_email']) user_content['session_token'] = token cl_content = API.Checklist.create_checklist(user_content, files=[]) logger.debug( - "This negative test will try to add audit log to checklist using standard user / admin_ro auth token.") + "This negative test will try to add audit log to checklist " + + "using standard user / admin_ro auth token.") users = [user_content['email'], Constants.Users.AdminRO.EMAIL] for user in users: token = "token " + API.User.login_user(user) user_content['session_token'] = token try: logger.debug( - "About to add audit log to checklist uuid " + cl_content['uuid']) + "About to add audit log to checklist uuid " + + cl_content['uuid']) API.Checklist.add_checklist_audit_log( user_content, cl_content['uuid']) raise Exception( - "Audit log was added to checklist using " + user + " token.") - except: + "Audit log was added to checklist using " + + user + + " token.") + except BaseException: logger.debug( - "Success! Test failed to add audit log to checklist using other auth token.") + "Success! Test failed to add audit log to checklist " + + "using other auth token.") @exception() def test_add_checklist_next_step(self): user_content = API.VirtualFunction.create_engagement() API.GitLab.git_clone_push(user_content) logger.debug( - "Create checklist with engagement lead (next: try to add checklist next step with PR, standard user and admin_ro)") + "Create checklist with engagement lead (next: try to add " + + "checklist next step with PR, standard user and admin_ro)") token = "token " + API.User.login_user(user_content['el_email']) user_content['session_token'] = token cl_content = API.Checklist.create_checklist(user_content) logger.debug( - "This negative test will try to add checklist next step using PR / standard user / admin_ro auth token.") + "This negative test will try to add checklist next step using " + + "PR / standard user / admin_ro auth token.") users = [user_content['email'], user_content[ 'pr_email'], Constants.Users.AdminRO.EMAIL] for user in users: @@ -242,14 +284,18 @@ class TestNegativeRequests(TestApiBase, Helper): user_content['session_token'] = token try: logger.debug( - "About to add next step to checklist uuid " + cl_content['uuid']) + "About to add next step to checklist uuid " + + cl_content['uuid']) API.Checklist.add_checklist_next_step( user_content, cl_content['uuid']) raise Exception( - "Next step was added to checklist using " + user + " token.") - except: + "Next step was added to checklist using " + + user + + " token.") + except BaseException: logger.debug( - "Success! Test failed to add next steps to checklist using other auth token.") + "Success! Test failed to add next steps to checklist " + + "using other auth token.") @exception() def test_negative_checklist_files(self): @@ -259,13 +305,16 @@ class TestNegativeRequests(TestApiBase, Helper): else: # Test starts here # user_content = API.VirtualFunction.create_engagement() logger.debug( - "Trying to create checklist with associated files when git repo is empty") + "Trying to create checklist with associated files when " + + "git repo is empty") token = "token " + API.User.login_user(user_content['el_email']) user_content['session_token'] = token try: API.Checklist.create_checklist(user_content) raise Exception( - "Checklist was created with associated files while git repo is empty.") - except: + "Checklist was created with associated files while " + + "git repo is empty.") + except BaseException: logger.debug( - "Success! Test failed to create checklist with associated files while git repo is empty.") + "Success! Test failed to create checklist with " + + "associated files while git repo is empty.") -- cgit 1.2.3-korg