Skip to content

Commit

Permalink
fix python reposync unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mcalmer committed Aug 18, 2023
1 parent b909752 commit 6c7169e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions python/test/unit/spacewalk/satellite_tools/test_reposync.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ def test_set_repo_credentials_number_credentials(self):
"http://example.com/?credentials=testcreds_42"
]
}
_mock_rhnsql(self.reposync, [{ 'username' : 'foo', 'password': 'c2VjcmV0' , 'extra_auth': memoryview(b'{\"my_header\": \"my_value\"}')}])
_mock_rhnsql(self.reposync, [{ 'username' : 'foo', 'password': 'c2VjcmV0', 'type': 'cloudrmt', 'extra_auth': memoryview(b'{\"my_header\": \"my_value\"}')}])
self.assertEqual(
rs.set_repo_credentials(url), [{"url":"http://foo:secret@example.com/", "http_headers": {"my_header": "my_value"}}])

Expand Down Expand Up @@ -776,7 +776,8 @@ def test__url_with_repo_credentials(self):
config = {
'return_value.fetchone_dict.return_value': {
"username": "user#1",
"password": base64.encodestring(password.encode()).decode()
"password": base64.encodestring(password.encode()).decode(),
"type": "SCC"
}
}
patcher = patch(
Expand All @@ -788,7 +789,7 @@ def test__url_with_repo_credentials(self):
{"url": 'http://{0}:{1}@some.url'.format(username, password), "http_headers": {}}
)
mock_prepare.assert_called_once_with(
'SELECT username, password, extra_auth FROM suseCredentials WHERE id = :id'
'\n SELECT c.username, c.password, c.extra_auth, ct.label type\n FROM suseCredentials c\n JOIN suseCredentialsType ct on c.type_id = ct.id\n WHERE c.id = :id\n '
)
mock_prepare().execute.assert_called_once_with(id=credentials_id)

Expand Down

0 comments on commit 6c7169e

Please sign in to comment.