Exemplo n.º 1
0
test('view inactive repo when admin connected to Github Apps and activate it', function (assert) {
  server.create('repository', {
    slug: 'musterfrau/a-repo',
    active: false,
    permissions: {
      admin: true
    },
    githubId: 12345,
    owner: {
      github_id: 321,
      installation: {
        id: 5678
      }
    }
  });

  const user = server.create('user', {
    name: 'Erika Musterfrau',
    login: '******'
  });

  signInUser(user);

  page.visit({ organization: 'musterfrau', repo: 'a-repo' });

  andThen(() => {
    assert.ok(page.notActiveHeadline, 'Displays not active headline');
    assert.ok(page.githubAppsActivateButton, 'Show Github Apps activation button');
    assert.notOk(page.activateButton, 'Does not show legacy activation button');
  });
});
Exemplo n.º 2
0
test('view inactive repo when admin and activate it', function (assert) {
  server.create('repository', {
    slug: 'musterfrau/a-repo',
    active: false,
    permissions: {
      admin: true
    }
  });

  const user = server.create('user', {
    name: 'Erika Musterfrau',
    login: '******'
  });

  signInUser(user);

  page.visit({ organization: 'musterfrau', repo: 'a-repo' });

  andThen(() => {
    assert.ok(page.notActiveHeadline, 'Displays not active headline');
    assert.equal(page.notActiveNotice, 'You can activate the repository on your profile, or by clicking the button below', 'Displays admin notice');
    assert.ok(page.activateButton, 'Show activation button');
    assert.notOk(page.githubAppsActivateButton, 'Does not show Github Apps activation button');
  });
});
Exemplo n.º 3
0
test('viewing public repo results in a repo pusher channel', function (assert) {
  const repo = server.create('repository', {
    slug: 'musterfrau/a-repo',
    private: false
  });

  page.visit({ organization: 'musterfrau', repo: 'a-repo' });

  andThen(() => {
    let subscribed = this.application.resolveRegistration('pusher:main').active_channels.includes(`repo-${repo.id}`);
    assert.ok(subscribed, 'user is subscribed to a repo channel');
  });
});
Exemplo n.º 4
0
test('view inactive repo when not an admin or signed out', function (assert) {
  server.create('repository', {
    slug: 'musterfrau/a-repo',
    active: false,
    permissions: {
      admin: false
    }
  });

  page.visit({ organization: 'musterfrau', repo: 'a-repo' });

  andThen(() => {
    assert.ok(page.notActiveHeadline, 'Displays not active headline');
    assert.equal(page.notActiveNotice, 'You don\'t have sufficient rights to enable this repo on Travis. Please contact the admin to enable it or to receive admin rights yourself.', 'Displays non-admin notice');
    assert.notOk(page.activateButton, 'Does not show activation button');
  });
});
Exemplo n.º 5
0
test('viewing public repo as a signed in user triggers subscription', function (assert) {
  const user = server.create('user', {
    name: 'Travis CI',
    login: '******',
  });
  const repository = server.create('repository', {
    slug: 'musterfrau/a-repo',
    private: false
  });
  server.schema.permissions.all().destroy();

  signInUser(user);

  page.visit({ organization: 'musterfrau', repo: 'a-repo' });

  andThen(() => {
    let subscribed = this.application.resolveRegistration('pusher:main').active_channels.includes(`repo-${repository.id}`);
    assert.ok(subscribed, 'user is subscribed to a repo channel');
  });
});