当前位置: 首页>>代码示例>>Python>>正文


Python StaticGenerator.delete方法代码示例

本文整理汇总了Python中staticgenerator.StaticGenerator.delete方法的典型用法代码示例。如果您正苦于以下问题:Python StaticGenerator.delete方法的具体用法?Python StaticGenerator.delete怎么用?Python StaticGenerator.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在staticgenerator.StaticGenerator的用法示例。


在下文中一共展示了StaticGenerator.delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_delete_loops_through_all_resources

# 需要导入模块: from staticgenerator import StaticGenerator [as 别名]
# 或者: from staticgenerator.StaticGenerator import delete [as 别名]
def test_delete_loops_through_all_resources():
    mox = Mox()
    http_request, model_base, manager, model, queryset = get_mocks(mox)

    fs_mock = mox.CreateMockAnything()
    fs_mock.join('test_web_root', 'some_path/index.html').AndReturn("test_web_root/some_path")
    fs_mock.dirname("test_web_root/some_path").AndReturn("test_web_root")
    fs_mock.exists("test_web_root/some_path").AndReturn(True)
    fs_mock.remove("test_web_root/some_path")
    fs_mock.rmdir("test_web_root")

    fs_mock.join('test_web_root', 'some_path_2/index.html').AndReturn("test_web_root/some_path_2")
    fs_mock.dirname('test_web_root/some_path_2').AndReturn("test_web_root")
    fs_mock.exists("test_web_root/some_path_2").AndReturn(True)
    fs_mock.remove("test_web_root/some_path_2")
    fs_mock.rmdir("test_web_root")

    settings = CustomSettings(WEB_ROOT="test_web_root")

    mox.ReplayAll()

    instance = StaticGenerator("some_path", "some_path_2", 
                               http_request=http_request,
                               model_base=model_base,
                               manager=manager,
                               model=model,
                               queryset=queryset,
                               settings=settings,
                               fs=fs_mock)

    instance.delete()

    mox.VerifyAll()
开发者ID:mredar,项目名称:django-staticgenerator,代码行数:35,代码来源:test_staticgenerator.py

示例2: test_delete_loops_through_all_resources

# 需要导入模块: from staticgenerator import StaticGenerator [as 别名]
# 或者: from staticgenerator.StaticGenerator import delete [as 别名]
    def test_delete_loops_through_all_resources(self):
        instance = StaticGenerator('/some_path', '/some_path_2')
        remove = Mock()
        with nested(patch('os.path.exists', Mock(return_value=True)),
                    patch('os.remove', remove)):

            instance.delete()

        remove.assert_has_calls([call('test_web_root/fresh/some_path'),
                                 call('test_web_root/fresh/some_path_2')])
开发者ID:2general,项目名称:staticgenerator,代码行数:12,代码来源:test_staticgenerator.py

示例3: test_delete_loops_through_all_resources

# 需要导入模块: from staticgenerator import StaticGenerator [as 别名]
# 或者: from staticgenerator.StaticGenerator import delete [as 别名]
 def test_delete_loops_through_all_resources(self):
     instance = StaticGenerator('/path_one', '/path/two')
     remove = Mock()
     with nested(patch('os.path.exists', Mock(return_value=True)),
                 patch('os.remove', remove)):
         instance.delete()
     # default language cache path contains no language code
     remove.assert_has_calls([call('test_web_root/fresh/path_one'),
                              call('test_web_root/fresh/path_one.gz'),
                              call('test_web_root/fresh/fr.path_one'),
                              call('test_web_root/fresh/fr.path_one.gz'),
                              call('test_web_root/fresh/path/two'),
                              call('test_web_root/fresh/path/two.gz'),
                              call('test_web_root/fresh/path/fr.two'),
                              call('test_web_root/fresh/path/fr.two.gz')])
开发者ID:mikek,项目名称:staticgenerator,代码行数:17,代码来源:test_staticgenerator.py


注:本文中的staticgenerator.StaticGenerator.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。