diff --git a/tests/test_sonarcloud.py b/tests/test_sonarcloud.py index f3a49ba..e0c8d95 100644 --- a/tests/test_sonarcloud.py +++ b/tests/test_sonarcloud.py @@ -71,7 +71,12 @@ class SonarCloudTests(unittest.TestCase): self.assertEqual(self.validation['if'], "steps.token.outputs.available == 'true'") self.assertEqual(self.scan['if'], self.validation['if']) self.assertEqual(self.scan['env']['SONAR_HOST_URL'], 'https://sonarcloud.io') - self.assertEqual(self.scan['env']['SONAR_TOKEN'], '${{ secrets.SONAR_TOKEN }}') + # The scan consumes whatever the validation step accepted: the SonarCloud PAT when the + # repo has one, otherwise the plain project token. + self.assertEqual( + self.scan['env']['SONAR_TOKEN'], + '${{ secrets.SONAR_CLOUD_PAT || secrets.SONAR_TOKEN }}', + ) self.assertEqual( self.scan['with']['args'].splitlines()[0], '"-Dsonar.projectKey=${{ steps.project.outputs.key }}" -Dsonar.organization=storytold '