couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebastianrothbucher <...@git.apache.org>
Subject [GitHub] couchdb-fauxton pull request: Cluster configuration fixes for 2.0
Date Fri, 01 May 2015 13:51:05 GMT
Github user sebastianrothbucher commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/360#discussion_r29502164
  
    --- Diff: app/addons/auth/test/baseSpec.js ---
    @@ -35,20 +48,45 @@ define([
       describe('auth session change', function () {
     
         afterEach(function () {
    -      FauxtonAPI.updateHeaderLink.restore && FauxtonAPI.updateHeaderLink.restore();
    -      FauxtonAPI.session.isAdminParty.restore && FauxtonAPI.session.isAdminParty.restore();
    +      testUtils.restore(FauxtonAPI.updateHeaderLink);
    +      testUtils.restore(FauxtonAPI.session.isAdminParty);
    +      testUtils.restore(FauxtonAPI.isRunningOnBackdoorPort);
    +      testUtils.restore(FauxtonAPI.session.isLoggedIn);
    +      testUtils.restore(FauxtonAPI.session.user);
    +      testUtils.restore(FauxtonAPI.removeHeaderLink);
    +      FauxtonAPI.session.off('change');
         });
     
         it('for admin party changes title to admin party', function () {
           var spy = sinon.spy(FauxtonAPI, 'updateHeaderLink');
           var stub = sinon.stub(FauxtonAPI.session, 'isAdminParty').returns(true);
    +      var deferred = FauxtonAPI.Deferred();
    +      sinon.stub(FauxtonAPI, 'isRunningOnBackdoorPort').returns(deferred);
    +      Base.initialize();
    +      deferred.resolve({runsOnBackportPort: true});
    +
           FauxtonAPI.session.trigger('change');
     
           assert.ok(spy.calledOnce);
           var args = spy.getCall(0).args[0];
     
           assert.ok(args.title.match(/Admin Party/));
    -      FauxtonAPI.session.isAdminParty.restore();
    +    });
    +
    +    it('for admin party on cluster do not show admin-party-fix-link', function () {
    +      var spy = sinon.spy(FauxtonAPI, 'removeHeaderLink');
    +      var stub = sinon.stub(FauxtonAPI.session, 'isAdminParty').returns(true);
    +      var deferred = FauxtonAPI.Deferred();
    +      sinon.stub(FauxtonAPI, 'isRunningOnBackdoorPort').returns(deferred);
    +      Base.initialize();
    +      deferred.resolve({runsOnBackportPort: false});
    +
    +      FauxtonAPI.session.trigger('change');
    +
    +      assert.ok(spy.calledOnce);
    +      var args = spy.getCall(0).args[0];
    --- End diff --
    
    add-then-remove is hard 2 test, quite possibly this is the best way. The only alternative
I can think of is overwriting add and remove, keeping track of the "list" and checking auth
is not in it


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message