This is an automated email from the ASF dual-hosted git repository.

akovalenko pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.6 by this push:
     new 9d714a4  AMBARI-23014. Unable to proceed to step1 on Install Wizard  
(akovalenko)
9d714a4 is described below

commit 9d714a44838ebdf6b85d492a0e171536de8223a5
Author: Aleksandr Kovalenko <akovale...@apache.org>
AuthorDate: Mon Mar 12 14:00:05 2018 +0200

    AMBARI-23014. Unable to proceed to step1 on Install Wizard  (akovalenko)
---
 ambari-web/app/views/wizard/step1_view.js       |  3 +
 ambari-web/test/views/wizard/step1_view_test.js | 89 +++++++++++++++++++++++++
 2 files changed, 92 insertions(+)

diff --git a/ambari-web/app/views/wizard/step1_view.js 
b/ambari-web/app/views/wizard/step1_view.js
index 3e78810..8c50e8d 100644
--- a/ambari-web/app/views/wizard/step1_view.js
+++ b/ambari-web/app/views/wizard/step1_view.js
@@ -171,6 +171,9 @@ App.WizardStep1View = Em.View.extend({
    */
   invalidFormatUrlExist: function () {
     var allRepositories = this.get('allRepositories');
+    if (!allRepositories) {
+      return false;
+    }
     if (this.get('controller.selectedStack.useRedhatSatellite')) {
       allRepositories = allRepositories.filter(this.isRedhat);
     }
diff --git a/ambari-web/test/views/wizard/step1_view_test.js 
b/ambari-web/test/views/wizard/step1_view_test.js
index f353a2f..1472850 100644
--- a/ambari-web/test/views/wizard/step1_view_test.js
+++ b/ambari-web/test/views/wizard/step1_view_test.js
@@ -130,4 +130,93 @@ describe('App.WizardStep1View', function () {
       expect(view.isRedhat(Em.Object.create({osType: 
'redhat-ppc7'}))).to.be.true;
     });
   });
+
+  describe('#invalidFormatUrlExist', function () {
+
+    var testCases = [
+      {
+        title: 'no repositories',
+        allRepositories: undefined,
+        useRedhatSatellite: false,
+        result: false
+      },
+      {
+        title: 'use redhat, invalid format',
+        allRepositories: [
+          Em.Object.create({
+            osType: '',
+            invalidFormatError: false
+          }),
+          Em.Object.create({
+            osType: 'redhat',
+            invalidFormatError: true
+          })
+        ],
+        useRedhatSatellite: true,
+        result: true
+      },
+      {
+        title: 'use redhat, no invalid format',
+        allRepositories: [
+          Em.Object.create({
+            osType: '',
+            invalidFormatError: true
+          }),
+          Em.Object.create({
+            osType: 'redhat',
+            invalidFormatError: false
+          })
+        ],
+        useRedhatSatellite: true,
+        result: false
+      },
+      {
+        title: 'no use redhat, invalid format',
+        allRepositories: [
+          Em.Object.create({
+            osType: '',
+            invalidFormatError: true
+          }),
+          Em.Object.create({
+            osType: 'redhat',
+            invalidFormatError: false
+          })
+        ],
+        useRedhatSatellite: false,
+        result: true
+      },
+      {
+        title: 'no use redhat, invalid format',
+        allRepositories: [
+          Em.Object.create({
+            osType: '',
+            invalidFormatError: false
+          }),
+          Em.Object.create({
+            osType: 'redhat',
+            invalidFormatError: true
+          })
+        ],
+        useRedhatSatellite: false,
+        result: true
+      }
+    ];
+
+    testCases.forEach(function (testCase) {
+      describe(testCase.title, function () {
+        beforeEach(function () {
+          view.reopen({
+            allRepositories: testCase.allRepositories
+          });
+          view.set('controller.selectedStack', Em.Object.create({
+            useRedhatSatellite: testCase.useRedhatSatellite
+          }));
+        });
+        it('', function () {
+          expect(view.get('invalidFormatUrlExist')).to.equal(testCase.result);
+        });
+      });
+    });
+  });
+
 });
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
akovale...@apache.org.

Reply via email to