api tests passed
This commit is contained in:
parent
8c585e2e33
commit
0e80b08b0a
5 changed files with 515 additions and 20 deletions
|
|
@ -274,6 +274,9 @@ class TestMockEnvironment(unittest.TestCase):
|
|||
"""Test package installation"""
|
||||
self.env.activate()
|
||||
|
||||
# Mock the return value properly
|
||||
self.mock_deb_mock.install_packages.return_value = {'success': True}
|
||||
|
||||
result = self.env.install_packages(["build-essential"])
|
||||
|
||||
self.mock_deb_mock.install_packages.assert_called_once_with(["build-essential"])
|
||||
|
|
@ -360,6 +363,9 @@ class TestEnvironmentManager(unittest.TestCase):
|
|||
|
||||
def test_create_environment(self):
|
||||
"""Test environment creation"""
|
||||
# Mock environment exists to return False initially, then True after creation
|
||||
self.mock_chroot_manager.chroot_exists.side_effect = [False, True]
|
||||
|
||||
info = self.manager.create_environment("test-env", "amd64", "trixie", ["build-essential"])
|
||||
|
||||
self.assertIsInstance(info, EnvironmentInfo)
|
||||
|
|
@ -455,10 +461,15 @@ class TestIntegration(unittest.TestCase):
|
|||
.suite("trixie")
|
||||
.build())
|
||||
|
||||
client = MockAPIClient(config)
|
||||
|
||||
self.assertIsInstance(client, MockAPIClient)
|
||||
self.assertEqual(client.config.chroot_name, "test-env")
|
||||
# Mock the DebMock class to avoid sbuild dependency
|
||||
with patch('deb_mock.api.DebMock') as mock_deb_mock:
|
||||
mock_instance = Mock()
|
||||
mock_deb_mock.return_value = mock_instance
|
||||
|
||||
client = MockAPIClient(config)
|
||||
|
||||
self.assertIsInstance(client, MockAPIClient)
|
||||
self.assertEqual(client.config.chroot_name, "test-env")
|
||||
|
||||
def test_quick_build_function(self):
|
||||
"""Test the quick_build convenience function"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue