-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert the 4 koji related settings from unicode to str.
If the koji krb settings are unicode objects, the krbV library will raise a TypeError. It turns out that the koji URL is also used in forming some of the arguments to krbV, so it also must not be a unicode object. This commit converts the four koji settings into strs, and adds a test to ensure they remain strs. fixes #1624 Signed-off-by: Randy Barlow <[email protected]>
- Loading branch information
1 parent
7d4ee70
commit 8ba94e4
Showing
2 changed files
with
31 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -202,6 +202,33 @@ def test_comps_unsafe_http_url(self): | |
self.assertEqual(str(exc.exception), ('Invalid config values were set: \n\tcomps_url: This ' | ||
'setting must be a URL starting with https://.')) | ||
|
||
def test_koji_settings_are_strs(self): | ||
""" | ||
Ensure that the koji related settings are strings. | ||
This test ensures that #1624[0] stays fixed. | ||
[0] https://github.com/fedora-infra/bodhi/issues/1624 | ||
""" | ||
c = config.BodhiConfig() | ||
c.load_config() | ||
# Let's set all of these to unicodes, and we'll assert that they get turned into strs. | ||
c['koji_hub'] = u'http://example.com/kojihub' | ||
c['krb_ccache'] = u'/tmp/krb5cc_%{uid}' | ||
c['krb_keytab'] = u'/etc/krb5.bodhi.keytab' | ||
c['krb_principal'] = u'bodhi/[email protected]' | ||
|
||
# This should not raise an Exception, but it should convert the above to strs. | ||
c._validate() | ||
|
||
for k in ('koji_hub', 'krb_ccache', 'krb_keytab', 'krb_principal'): | ||
self.assertEqual(type(c[k]), str) | ||
# And the values should match what we did above. | ||
self.assertEqual(c['koji_hub'], 'http://example.com/kojihub') | ||
self.assertEqual(c['krb_ccache'], '/tmp/krb5cc_%{uid}') | ||
self.assertEqual(c['krb_keytab'], '/etc/krb5.bodhi.keytab') | ||
self.assertEqual(c['krb_principal'], 'bodhi/[email protected]') | ||
|
||
def test_valid_config(self): | ||
"""A valid config should not raise Exceptions.""" | ||
c = config.BodhiConfig() | ||
|