Skip to content

Commit 5d900d6

Browse files
ref: Update tempest access logic to also look for 'playstation' in enabledConsolePlatforms (#96504)
closes https://linear.app/getsentry/issue/TET-957/update-tempest-logic-to-check-for-playstation-in
1 parent 3e79f77 commit 5d900d6

File tree

2 files changed

+105
-1
lines changed

2 files changed

+105
-1
lines changed
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import type {Organization} from 'sentry/types/organization';
22

33
export function hasTempestAccess(organization: Organization) {
4-
return organization.features.includes('tempest-access');
4+
return (
5+
organization.features.includes('tempest-access') ||
6+
organization.enabledConsolePlatforms?.includes('playstation')
7+
);
58
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
import {OrganizationFixture} from 'sentry-fixture/organization';
2+
3+
import {initializeOrg} from 'sentry-test/initializeOrg';
4+
import {render, screen} from 'sentry-test/reactTestingLibrary';
5+
6+
import TempestSettings from 'sentry/views/settings/project/tempest';
7+
8+
describe('TempestSettings', function () {
9+
const {organization, project} = initializeOrg();
10+
11+
beforeEach(() => {
12+
MockApiClient.addMockResponse({
13+
url: `/projects/${organization.slug}/${project.slug}/tempest-credentials/`,
14+
body: [],
15+
});
16+
});
17+
18+
describe('Access Control', () => {
19+
it('renders warning alert when user does not have tempest access', function () {
20+
const organizationWithoutAccess = OrganizationFixture({
21+
features: [],
22+
enabledConsolePlatforms: [],
23+
});
24+
25+
render(
26+
<TempestSettings organization={organizationWithoutAccess} project={project} />
27+
);
28+
29+
expect(
30+
screen.getByText("You don't have access to this feature")
31+
).toBeInTheDocument();
32+
expect(
33+
screen.queryByRole('heading', {name: 'PlayStation'})
34+
).not.toBeInTheDocument();
35+
});
36+
37+
it('renders settings when user has tempest-access feature', function () {
38+
const organizationWithFeature = OrganizationFixture({
39+
features: ['tempest-access'],
40+
enabledConsolePlatforms: [],
41+
});
42+
43+
render(
44+
<TempestSettings organization={organizationWithFeature} project={project} />
45+
);
46+
47+
expect(
48+
screen.queryByText("You don't have access to this feature")
49+
).not.toBeInTheDocument();
50+
expect(screen.getByRole('heading', {name: 'PlayStation'})).toBeInTheDocument();
51+
});
52+
53+
it('renders settings when user has playstation console platform enabled', function () {
54+
const organizationWithPlatform = OrganizationFixture({
55+
features: [],
56+
enabledConsolePlatforms: ['playstation'],
57+
});
58+
59+
render(
60+
<TempestSettings organization={organizationWithPlatform} project={project} />
61+
);
62+
63+
expect(
64+
screen.queryByText("You don't have access to this feature")
65+
).not.toBeInTheDocument();
66+
expect(screen.getByRole('heading', {name: 'PlayStation'})).toBeInTheDocument();
67+
});
68+
69+
it('renders settings when user has both tempest-access feature and playstation platform', function () {
70+
const organizationWithBoth = OrganizationFixture({
71+
features: ['tempest-access'],
72+
enabledConsolePlatforms: ['playstation'],
73+
});
74+
75+
render(<TempestSettings organization={organizationWithBoth} project={project} />);
76+
77+
expect(
78+
screen.queryByText("You don't have access to this feature")
79+
).not.toBeInTheDocument();
80+
expect(screen.getByRole('heading', {name: 'PlayStation'})).toBeInTheDocument();
81+
});
82+
83+
it('does not grant access with other console platforms', function () {
84+
const organizationWithOtherPlatform = OrganizationFixture({
85+
features: [],
86+
enabledConsolePlatforms: ['xbox', 'nintendo'],
87+
});
88+
89+
render(
90+
<TempestSettings organization={organizationWithOtherPlatform} project={project} />
91+
);
92+
93+
expect(
94+
screen.getByText("You don't have access to this feature")
95+
).toBeInTheDocument();
96+
expect(
97+
screen.queryByRole('heading', {name: 'PlayStation'})
98+
).not.toBeInTheDocument();
99+
});
100+
});
101+
});

0 commit comments

Comments
 (0)