diff options
-rw-r--r-- | reporting/js/gauge.js | 4 | ||||
-rw-r--r-- | reporting/reporting/functest/testCase.py | 5 | ||||
-rw-r--r-- | testapi/opnfv_testapi/common/check.py | 12 | ||||
-rw-r--r-- | testapi/opnfv_testapi/tests/UI/e2e/authenticateFalseSpec.js | 76 | ||||
-rw-r--r-- | testapi/opnfv_testapi/tests/UI/e2e/deployResultsControllerSpec.js | 2 | ||||
-rw-r--r-- | testapi/opnfv_testapi/tests/UI/e2e/resultsControllerSpec.js | 4 | ||||
-rw-r--r-- | testapi/testapi-client/etc/client.creds | 3 | ||||
-rw-r--r-- | testapi/testapi-client/setup.cfg | 4 | ||||
-rw-r--r-- | testapi/testapi-client/testapiclient/cli/results.py | 100 | ||||
-rw-r--r-- | testapi/testapi-client/testapiclient/tests/unit/test_results.py | 98 | ||||
-rw-r--r-- | testapi/testapi-client/testapiclient/utils/clientmanager.py | 6 |
11 files changed, 264 insertions, 50 deletions
diff --git a/reporting/js/gauge.js b/reporting/js/gauge.js index 4cad16c..a9842e5 100644 --- a/reporting/js/gauge.js +++ b/reporting/js/gauge.js @@ -28,7 +28,9 @@ var gauge = function(container) { labelFormat : d3.format(',g'), labelInset : 10, - arcColorFn : d3.interpolateHsl(d3.rgb('#ff0000'), d3.rgb('#00ff00')) + arcColorFn : d3.scale.quantile() + .domain([0, , 0.6, 0.8, 1]) + .range([d3.rgb('#ff0000'),d3.rgb('#ffcc00'),d3.rgb('#00ff00')]) }; diff --git a/reporting/reporting/functest/testCase.py b/reporting/reporting/functest/testCase.py index a182dd4..d114f8a 100644 --- a/reporting/reporting/functest/testCase.py +++ b/reporting/reporting/functest/testCase.py @@ -56,7 +56,10 @@ class TestCase(object): 'vyos_vrouter': 'vyos (Cloudify)', 'barometercollectd': 'Barometer', 'odl_netvirt': 'Netvirt', - 'security_scan': 'Security'} + 'security_scan': 'Security', + 'patrole': 'Patrole', + 'juju_epc': 'vEPC (Juju)', + 'neutron_trunk': 'Neutron trunk'} try: self.displayName = display_name_matrix[self.name] except: diff --git a/testapi/opnfv_testapi/common/check.py b/testapi/opnfv_testapi/common/check.py index 09a9270..fdc527f 100644 --- a/testapi/opnfv_testapi/common/check.py +++ b/testapi/opnfv_testapi/common/check.py @@ -65,12 +65,14 @@ def is_reource_tied(method): } if self.table in tied_maps: if method.__name__ == '_update': - if 'name' not in self.json_args: - ret = yield gen.coroutine(method)(self, *args, **kwargs) - raise gen.Return(ret) + if 'name' in self.json_args: + if self.json_args['name'] == kwargs.get('query')['name']: + ret = yield gen.coroutine(method)( + self, *args, **kwargs) + raise gen.Return(ret) query_data[tied_maps[self.table][1]] = kwargs.get('query')['name'] - data = yield dbapi.db_find_one(tied_maps[self.table][0], - query_data) + data = yield dbapi.db_find_one( + tied_maps[self.table][0], query_data) if data: raises.Unauthorized(message.tied_with_resource()) ret = yield gen.coroutine(method)(self, *args, **kwargs) diff --git a/testapi/opnfv_testapi/tests/UI/e2e/authenticateFalseSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/authenticateFalseSpec.js index e287f29..6b9a2bf 100644 --- a/testapi/opnfv_testapi/tests/UI/e2e/authenticateFalseSpec.js +++ b/testapi/opnfv_testapi/tests/UI/e2e/authenticateFalseSpec.js @@ -250,7 +250,7 @@ describe('testing the scenarios page for anonymous user', function () { browser.get(baseURL+"#/scenarios/test-scenario"); var EC = browser.ExpectedConditions; browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000); - var buttonAdd = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[2]/button')) + var buttonAdd = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[2]/button')) expect(buttonAdd.isDisplayed()).toBe(true); }); @@ -258,9 +258,9 @@ describe('testing the scenarios page for anonymous user', function () { browser.get(baseURL+"#/scenarios/test-scenario"); var EC = browser.ExpectedConditions; browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000); - var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[1]/a/p')) + var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[1]/a/p')) installersShow.click(); - var installerDelete = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[3]/button')) + var installerDelete = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[1]/td[3]/button')) expect(installerDelete.isDisplayed()).toBe(true); }); @@ -268,11 +268,11 @@ describe('testing the scenarios page for anonymous user', function () { browser.get(baseURL+"#/scenarios/test-scenario"); var EC = browser.ExpectedConditions; browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000); - var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[1]/a/p')) + var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[1]/a/p')) installersShow.click(); - var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) installerShow.click(); - var versionAdd = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[2]/button')) + var versionAdd = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[2]/button')) versionAdd.click() expect(versionAdd.isDisplayed()).toBe(true); }); @@ -281,15 +281,15 @@ describe('testing the scenarios page for anonymous user', function () { browser.get(baseURL+"#/scenarios/test-scenario"); var EC = browser.ExpectedConditions; browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000); - var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[1]/a/p')) + var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[1]/a/p')) installersShow.click(); - var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) installerShow.click(); - var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) + var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) versionsShow.click(); - var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) versionShow.click() - var versionDelete = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody[1]/tr[1]/td[3]/button')) + var versionDelete = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody[1]/tr[1]/td[3]/button')) expect(versionDelete.isDisplayed()).toBe(true); }); @@ -297,15 +297,15 @@ describe('testing the scenarios page for anonymous user', function () { browser.get(baseURL+"#/scenarios/test-scenario"); var EC = browser.ExpectedConditions; browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000); - var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[1]/a/p')) + var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[1]/a/p')) installersShow.click(); - var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) installerShow.click(); - var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) + var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) versionsShow.click(); - var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) versionShow.click() - var projectAdd = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[2]/button')) + var projectAdd = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[2]/button')) projectAdd.click() expect(projectAdd.isDisplayed()).toBe(true); }); @@ -314,17 +314,17 @@ describe('testing the scenarios page for anonymous user', function () { browser.get(baseURL+"#/scenarios/test-scenario"); var EC = browser.ExpectedConditions; browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000); - var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[1]/a/p')) + var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[1]/a/p')) installersShow.click(); - var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) installerShow.click(); - var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) + var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) versionsShow.click(); - var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) versionShow.click() - var projectsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a')) + var projectsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a')) projectsShow.click(); - var projectDelete = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[1]/td[3]/button')) + var projectDelete = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[1]/td[3]/button')) projectDelete.click() expect(projectDelete.isDisplayed()).toBe(true); }); @@ -333,24 +333,24 @@ describe('testing the scenarios page for anonymous user', function () { browser.get(baseURL+"#/scenarios/test-scenario"); var EC = browser.ExpectedConditions; browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000); - var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[1]/a/p')) + var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[1]/a/p')) installersShow.click(); - var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) installerShow.click(); - var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) + var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) versionsShow.click(); - var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) versionShow.click() - var projectsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a')) + var projectsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a')) projectsShow.click(); - var projectShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + var projectShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) projectShow.click(); - var customsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[4]/td[2]/a/p')) + var customsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[4]/td[2]/a/p')) customsShow.click(); var row = element.all(by.repeater('(indexCU, custom) in project.customs')).first(); var cells = row.all(by.tagName('td')); expect(cells.get(0).getText()).toContain("dvs"); - var buttonAdd = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[4]/td[2]/button')) + var buttonAdd = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[4]/td[2]/button')) buttonAdd.click() expect(buttonAdd.isDisplayed()).toBe(true); }); @@ -359,24 +359,24 @@ describe('testing the scenarios page for anonymous user', function () { browser.get(baseURL+"#/scenarios/test-scenario"); var EC = browser.ExpectedConditions; browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000); - var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[1]/a/p')) + var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[1]/a/p')) installersShow.click(); - var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) installerShow.click(); - var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) + var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) versionsShow.click(); - var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) versionShow.click() - var projectsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a')) + var projectsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a')) projectsShow.click(); - var projectShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + var projectShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) projectShow.click(); - var customsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[4]/td[2]/a/p')) + var customsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[4]/td[2]/a/p')) customsShow.click(); var row = element.all(by.repeater('(indexCU, custom) in project.customs')).first(); var cells = row.all(by.tagName('td')); expect(cells.get(0).getText()).toContain("dvs"); - var buttonDelete = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[4]/td[2]/table/tbody/tr[1]/td[2]/button')) + var buttonDelete = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[4]/td[2]/table/tbody/tr[1]/td[2]/button')) buttonDelete.click() expect(buttonDelete.isDisplayed()).toBe(true); }); diff --git a/testapi/opnfv_testapi/tests/UI/e2e/deployResultsControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/deployResultsControllerSpec.js index e00243b..40f60e4 100644 --- a/testapi/opnfv_testapi/tests/UI/e2e/deployResultsControllerSpec.js +++ b/testapi/opnfv_testapi/tests/UI/e2e/deployResultsControllerSpec.js @@ -383,7 +383,7 @@ describe('testing the result page for user', function () { buttonClear.click(); var row = element.all(by.repeater('(index, result) in ctrl.data.deployresults')).first(); var cells = row.all(by.tagName('td')); - expect(cells.get(0).getText()).toContain("3c9f8d62"); + expect(cells.get(0).getText()).toContain("3c9f8d63"); }); it('view the deploy results ', function () { diff --git a/testapi/opnfv_testapi/tests/UI/e2e/resultsControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/resultsControllerSpec.js index 925e82c..48690a1 100644 --- a/testapi/opnfv_testapi/tests/UI/e2e/resultsControllerSpec.js +++ b/testapi/opnfv_testapi/tests/UI/e2e/resultsControllerSpec.js @@ -198,8 +198,8 @@ describe('testing the result page for anonymous user', function () { browser.wait(EC.urlContains(baseURL+ '#/results'), 10000); var resultLink = element(by.linkText('0e2643f4')).click(); browser.wait(EC.urlContains(baseURL+ '#/result/5a45170bbb2092000e2643f4'), 10000); - expect(element(by.cssContainingText(".key.col-md-1","failures")).isDisplayed()).toBe(true); - expect(element(by.cssContainingText(".leaf-value.col-md-11","0")).isDisplayed()).toBe(true); + expect(element(by.cssContainingText(".key.col-md-2","failures")).isDisplayed()).toBe(true); + expect(element(by.cssContainingText(".leaf-value.col-md-10","0")).isDisplayed()).toBe(true); }); it('Should show the results in results page related to the filters', function () { diff --git a/testapi/testapi-client/etc/client.creds b/testapi/testapi-client/etc/client.creds index a082047..ee2a0ab 100644 --- a/testapi/testapi-client/etc/client.creds +++ b/testapi/testapi-client/etc/client.creds @@ -1,3 +1,4 @@ export testapi_url=http://localhost:8000/api/v1 export testapi_cas_signin_return=/auth/signin_return -export testapi_cas_auth_url=https://identity.linuxfoundation.org/user/login?destination=cas/login%3Fservice%3D
\ No newline at end of file +export testapi_cas_auth_url=https://identity.linuxfoundation.org/user/login?destination=cas/login%3Fservice%3D +export testapi_token=changeme
\ No newline at end of file diff --git a/testapi/testapi-client/setup.cfg b/testapi/testapi-client/setup.cfg index b89fba4..ee1ba54 100644 --- a/testapi/testapi-client/setup.cfg +++ b/testapi/testapi-client/setup.cfg @@ -64,6 +64,10 @@ testapi = deployresult get = testapiclient.cli.deployresults:DeployresultGet deployresult getone = testapiclient.cli.deployresults:DeployresultGetOne + result create = testapiclient.cli.results:ResultCreate + result get = testapiclient.cli.results:ResultGet + result getone = testapiclient.cli.results:ResultGetOne + [egg_info] tag_build = tag_date = 0 diff --git a/testapi/testapi-client/testapiclient/cli/results.py b/testapi/testapi-client/testapiclient/cli/results.py new file mode 100644 index 0000000..56ea71f --- /dev/null +++ b/testapi/testapi-client/testapiclient/cli/results.py @@ -0,0 +1,100 @@ +import json + +from testapiclient.utils import command +from testapiclient.utils import urlparse + + +def results_url(): + return urlparse.resource_join('results') + + +def result_url(parsed_args): + return urlparse.path_join(results_url(), parsed_args.result_id) + + +class ResultGet(command.Lister): + + def get_parser(self, prog_name): + parser = super(ResultGet, self).get_parser(prog_name) + parser.add_argument('-case', + help='Search results using tesetcase') + parser.add_argument('-build-tag', + help='Search results using build tag') + parser.add_argument('-from', + help='Search results using from date') + parser.add_argument('-last', + help='Search results using last date') + parser.add_argument('-scenario', + help='Search results using scenario') + parser.add_argument('-period', + help='Search results using period') + parser.add_argument('-project', + help='Search results using project') + parser.add_argument('-to', + help='Search results using to') + parser.add_argument('---version', + help='Search results using version') + parser.add_argument('-criteria', + help='Search results using version') + parser.add_argument('-installer', + help='Search results using installer') + parser.add_argument('-pod', + help='Search results using pod') + parser.add_argument('-page', + help='Search results using page') + return parser + + def take_action(self, parsed_args): + columns = ( + '_id', + 'pod_name', + 'project_name', + 'case_name', + 'installer', + 'version', + 'scenario', + 'criteria', + 'start_date' + ) + data = self.app.client_manager.get( + urlparse.query_by(results_url(), + ['case', 'build_tag', 'from', 'last', + 'scenario', 'period', 'project', + 'to', 'version', + 'criteria', 'installer', 'pod', 'page'], + parsed_args)) + return self.format_output(columns, data.get('results', [])) + + +class ResultGetOne(command.ShowOne): + + def get_parser(self, prog_name): + parser = super(ResultGetOne, self).get_parser(prog_name) + parser.add_argument('result_id', + help='Search result by result id') + return parser + + def take_action(self, parsed_args): + return self.format_output( + self.app.client_manager.get(result_url(parsed_args))) + + +class ResultCreate(command.ShowOne): + + def get_parser(self, prog_name): + parser = super(ResultCreate, self).get_parser(prog_name) + parser.add_argument('result', + type=json.loads, + help='Result create request format:\n' + '\'{"project_name" : "","scenario" : "",' + '"stop_date" : "", "case_name" : "",' + '"build_tag" : "", "version" : "",' + '"pod_name" : "" , "criteria" : "",' + '"installer" : "", "start_date" : "",' + '"details" : ""}\'') + return parser + + def take_action(self, parsed_args): + return self.format_output( + self.app.client_manager.post( + results_url(), parsed_args.result)) diff --git a/testapi/testapi-client/testapiclient/tests/unit/test_results.py b/testapi/testapi-client/testapiclient/tests/unit/test_results.py new file mode 100644 index 0000000..83bcc9f --- /dev/null +++ b/testapi/testapi-client/testapiclient/tests/unit/test_results.py @@ -0,0 +1,98 @@ +import json + +from mock import mock +from six.moves.urllib import parse +import testtools + +from testapiclient.cli import results +from testapiclient.tests.unit import fakes +from testapiclient.tests.unit import utils +from testapiclient.utils import clientmanager + + +class ResultTest(utils.TestCommand): + def setUp(self): + super(ResultTest, self).setUp() + self.base_url = parse.urljoin(self.api_url, 'results') + self.result_json = { + 'project_name': 'functest', + 'scenario': 'test-scenario', + 'stop_date': '2018-04-09 13:44:53', + 'case_name': 'test-case', + 'build_tag': 'test-build', + 'version': 'test-version', + 'pod_name': 'test-pod', + 'criteria': 'test-criteria', + 'installer': 'test-installer', + 'start_date': '2018-04-09 13:44:53', + 'details': 'test-details' + } + self.result_string = json.dumps(self.result_json) + + +class ResultGetTest(ResultTest): + + def setUp(self): + super(ResultGetTest, self).setUp() + self.results_rsp = {'results': [self.result_json]} + + def test_get(self): + self.get_mock.return_value = fakes.FakeResponse(data=self.results_rsp) + result_get = results.ResultGet(self.app, mock.Mock()) + args = ['-case', 'dfs'] + verifies = [('case', 'dfs')] + parsed_args = self.check_parser(result_get, args, verifies) + result_get.take_action(parsed_args) + self.get_mock.assert_called_once_with( + self.base_url + '?case=dfs', + headers=clientmanager.ClientManager.headers) + + def test_get_all(self): + self.get_mock.return_value = fakes.FakeResponse(data=self.results_rsp) + result_get = results.ResultGet(self.app, mock.Mock()) + args = [] + verifies = [] + parsed_args = self.check_parser(result_get, args, verifies) + result_get.take_action(parsed_args) + self.get_mock.assert_called_once_with( + self.base_url, + headers=clientmanager.ClientManager.headers) + + def test_get_one(self): + self.get_mock.return_value = fakes.FakeResponse(data=self.result_json) + result_get_one = results.ResultGetOne(self.app, mock.Mock()) + args = ['def'] + verifies = [('result_id', 'def')] + parsed_args = self.check_parser(result_get_one, args, verifies) + result_get_one.take_action(parsed_args) + self.get_mock.assert_called_once_with( + self.base_url + '/def', + headers=clientmanager.ClientManager.headers) + + +class ResultCreateTest(ResultTest): + + def setUp(self): + super(ResultCreateTest, self).setUp() + + def test_create_success(self): + succ_rsp = { + 'href': '{}/{}'.format(self.base_url, + self.result_json.get('project_name')) + } + self.post_mock.return_value = fakes.FakeResponse(data=succ_rsp) + result_create = results.ResultCreate(self.app, mock.Mock()) + args = [self.result_string] + verifies = [('result', self.result_json)] + parsed_args = self.check_parser(result_create, args, verifies) + result_create.take_action(parsed_args) + self.post_mock.assert_called_once() + + def test_create_failure(self): + with testtools.ExpectedException(Exception, 'Create failed: Error'): + self.post_mock.return_value = utils.FAKE_FAILURE + result_create = results.ResultCreate(self.app, mock.Mock()) + args = [self.result_string] + verifies = [('result', self.result_json)] + parsed_args = self.check_parser(result_create, args, verifies) + result_create.take_action(parsed_args) diff --git a/testapi/testapi-client/testapiclient/utils/clientmanager.py b/testapi/testapi-client/testapiclient/utils/clientmanager.py index 8858819..cbfd723 100644 --- a/testapi/testapi-client/testapiclient/utils/clientmanager.py +++ b/testapi/testapi-client/testapiclient/utils/clientmanager.py @@ -10,7 +10,9 @@ LOG = logging.getLogger(__name__) class ClientManager(object): - headers = {'Content-type': 'application/json', 'Accept': 'text/plain'} + headers = { + 'Content-type': 'application/json', + 'Accept': 'text/plain'} def __init__(self, cli_options=None): self.cli_options = cli_options @@ -49,6 +51,8 @@ class ClientManager(object): headers=self.headers)) def post(self, url, data): + if 'results' in url or 'deployresults' in url: + self.headers['X-Auth-Token'] = os.environ.get('testapi_token') return self._parse_response('Create', self._request('post', url, data=json.dumps(data), |