Пример #1
0
def test_get_nonexisting_storage_module():
    """
    get_storage_class raises an error if the requested module don't exist.
    """
    # Error message may or may not be the fully qualified path.
    with pytest.raises(ImportError):
        get_storage_class("storages.non_existing.NonExistingStoage")
Пример #2
0
def test_get_invalid_storage_module():
    """
    get_storage_class raises an error if the requested import don't exist.
    """
    with pytest.raises(ValueError):
        get_storage_class("NonExistingStorage")
Пример #3
0
def test_get_nonexisting_storage_class():
    """
    get_storage_class raises an error if the requested class don't exist.
    """
    with pytest.raises(AttributeError):
        get_storage_class("storages.NonExistingStorage")
Пример #4
0
def test_get_filesystem_storage():
    """
    get_storage_class returns the class for a storage backend name/path.
    """
    assert get_storage_class("storages.FileSystemStorage") is FileSystemStorage