-
-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow overriding IssueTrackerType.rpc_credentials
via settings.EXTERNAL_ISSUE_RPC_CREDENTIALS
- Loading branch information
Showing
4 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# pylint: disable=attribute-defined-outside-init | ||
|
||
import os | ||
import unittest | ||
|
||
from django.test import override_settings | ||
|
||
from tcms.issuetracker.types import Redmine | ||
from tcms.rpc.tests.utils import APITestCase | ||
from tcms.testcases.models import BugSystem | ||
|
||
|
||
@unittest.skipUnless( | ||
os.getenv("TEST_BUGTRACKER_INTEGRATION"), | ||
"Bug tracker integration testing not enabled", | ||
) | ||
class TestBaseIntegration(APITestCase): | ||
def _fixture_setup(self): | ||
super()._fixture_setup() | ||
|
||
bug_system = BugSystem.objects.create( # nosec:B106:hardcoded_password_funcarg | ||
name="Redmine at kiwitcms.atlassian.net", | ||
tracker_type="tcms.issuetracker.types.Redmine", | ||
base_url="http://bugtracker.kiwitcms.org:3000", | ||
api_username="admin", | ||
api_password="admin", | ||
) | ||
self.integration = Redmine(bug_system, None) | ||
|
||
def test_non_overriden_credentials_are_returned(self): | ||
(rpc_username, rpc_password) = self.integration.rpc_credentials | ||
|
||
# not admin:admin as defined above | ||
self.assertEqual(rpc_username, "admin") | ||
self.assertEqual(rpc_password, "admin") | ||
|
||
@override_settings( | ||
EXTERNAL_ISSUE_RPC_CREDENTIALS="tcms.issuetracker.tests.redmine_post_processing.rpc_credentials" | ||
) | ||
def test_overriden_credentials_are_returned(self): | ||
(rpc_username, rpc_password) = self.integration.rpc_credentials | ||
|
||
# not admin:admin as defined above | ||
self.assertEqual(rpc_username, "tester") | ||
self.assertEqual(rpc_password, "test-me") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters