Testing¶
Stor provides a test case to use when testing against Swift storage. It also provides a mixin class that can be used when creating other base test classes
-
class
stor.test.
SwiftTestMixin
[source]¶ A mixin with helpers for mocking out swift.
SwiftTestMixin should be used to create base test classes for anything that accesses swift.
-
assertSwiftListResultsEqual
(r1, r2)[source]¶ Swift list resolves duplicates, so the ordering of the results are not always the same as what the swift client returns. Compare results as sorted lists
-
setup_swift_mocks
()[source]¶ Sets all of the relevant mocks for Swift communication.
If you are testing outside of this library, you should either mock swift object methods or you should focus on manipulating return value of mock_swift.
The following variables are set up when calling this:
mock_swift_service: A mock of the SwiftService class defined in swiftclient.service.
mock_swift_get_conn: A mock of the get_conn function in the swiftclient.service module
mock_swift_conn: A mock of the SwiftConnection returned by get_conn
mock_swift_get_auth_keystone: mock of the get_keystone_auth function that caches identity credentials
mock_get_swift_service: A mock of the _get_swift_service method of SwiftPath
mock_swift: A mock of the SwiftService instance returned by _get_swift_service in SwiftPath
-