|
14 | 14 | from sentry.constants import ObjectStatus |
15 | 15 | from sentry.integrations.models.integration import Integration |
16 | 16 | from sentry.integrations.models.repository_project_path_config import RepositoryProjectPathConfig |
| 17 | +from sentry.models.project import Project |
17 | 18 | from sentry.models.repository import Repository |
18 | 19 | from sentry.seer.endpoints.seer_rpc import ( |
19 | 20 | bulk_get_project_preferences, |
@@ -1509,12 +1510,21 @@ def test_get_project_preferences_returns_none_when_no_preference(self, mock_read |
1509 | 1510 | ) |
1510 | 1511 | assert result is None |
1511 | 1512 |
|
1512 | | - def test_get_project_preferences_returns_none_for_nonexistent_project(self) -> None: |
1513 | | - result = get_project_preferences( |
1514 | | - organization_id=self.organization.id, |
1515 | | - project_id=999999, |
1516 | | - ) |
1517 | | - assert result is None |
| 1513 | + def test_get_project_preferences_raises_for_nonexistent_project(self) -> None: |
| 1514 | + with pytest.raises(Project.DoesNotExist): |
| 1515 | + get_project_preferences( |
| 1516 | + organization_id=self.organization.id, |
| 1517 | + project_id=999999, |
| 1518 | + ) |
| 1519 | + |
| 1520 | + def test_get_project_preferences_raises_for_wrong_org(self) -> None: |
| 1521 | + project = self.create_project(organization=self.organization) |
| 1522 | + other_org = self.create_organization(owner=self.user) |
| 1523 | + with pytest.raises(Project.DoesNotExist): |
| 1524 | + get_project_preferences( |
| 1525 | + organization_id=other_org.id, |
| 1526 | + project_id=project.id, |
| 1527 | + ) |
1518 | 1528 |
|
1519 | 1529 | @patch("sentry.seer.endpoints.seer_rpc.bulk_read_preferences_from_sentry_db") |
1520 | 1530 | def test_bulk_get_project_preferences_returns_preferences(self, mock_bulk_read: Any) -> None: |
|
0 commit comments