diff options
author | Edan Binshtok <eb578m@intl.att.com> | 2017-11-19 11:50:50 +0200 |
---|---|---|
committer | Edan Binshtok <eb578m@intl.att.com> | 2017-11-19 11:51:04 +0200 |
commit | 71891b3040605103397ffa7fb349215eced3a2c3 (patch) | |
tree | 22dda04edd1b8ee0d0de2a6a260d6d60e42cba25 /tests/apiTests | |
parent | 433a8256e31f755f5e236491bbe39d3db24d6d6d (diff) |
Pep8 another fixes
Add more fixes to pep8
Issue-ID: VVP-25
Change-Id: Icc3bd3977ced2b537c858a9801e04a6bf6d1db05
Signed-off-by: Edan Binshtok <eb578m@intl.att.com>
Diffstat (limited to 'tests/apiTests')
-rw-r--r-- | tests/apiTests/__init__.py | 4 | ||||
-rw-r--r-- | tests/apiTests/test_api_base.py | 29 | ||||
-rw-r--r-- | tests/apiTests/test_negative_requests.py | 151 |
3 files changed, 123 insertions, 61 deletions
diff --git a/tests/apiTests/__init__.py b/tests/apiTests/__init__.py index 30d7152..32b601a 100644 --- a/tests/apiTests/__init__.py +++ b/tests/apiTests/__init__.py @@ -1,5 +1,5 @@ - -# ============LICENSE_START========================================== + +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. diff --git a/tests/apiTests/test_api_base.py b/tests/apiTests/test_api_base.py index 55269e3..5fad138 100644 --- a/tests/apiTests/test_api_base.py +++ b/tests/apiTests/test_api_base.py @@ -1,5 +1,5 @@ - -# ============LICENSE_START========================================== + +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -88,14 +88,27 @@ class TestApiBase(TestCase, Helper): @logFuncEntry def results(self): - params = {"testType": "E2E Test", "testFeature": self.className, - "testResult": "PASS", "testName": self.funcName, "duration": self.testDuration} + params = { + "testType": "E2E Test", + "testFeature": self.className, + "testResult": "PASS", + "testName": self.funcName, + "duration": self.testDuration} if (session.errorCounter == 0): - DBGeneral.insert_results(params["testType"], params["testFeature"], params[ - "testResult"], params["testName"], params['duration']) + DBGeneral.insert_results( + params["testType"], + params["testFeature"], + params["testResult"], + params["testName"], + params['duration']) else: params["testResult"] = "FAIL" # Mark test as fail. # Add the errors to notes column in table. params["notes"] = session.errorList - DBGeneral.insert_results(params["testType"], params["testFeature"], params[ - "testResult"], params["testName"], params['duration'], params["notes"]) + DBGeneral.insert_results( + params["testType"], + params["testFeature"], + params["testResult"], + params["testName"], + params['duration'], + params["notes"]) 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.") |