示例#1
0
def test_can_run(c, monkeypatch):
    def fake_run(self, **config):
        assert config["use_debugger"]
        assert not config["use_reloader"]

    monkeypatch.setattr(Flask, "run", fake_run)
    sys.argv = [sys.argv[0], "run"]
    manager.run()
示例#2
0
def test_can_run(c, monkeypatch):
    def fake_run(self, **config):
        assert config['use_debugger']
        assert not config['use_reloader']

    monkeypatch.setattr(Flask, 'run', fake_run)
    sys.argv = [sys.argv[0], 'run']
    manager.run()
示例#3
0
def test_run_with_custom_host_and_port(c, monkeypatch):
    host = 'localhost'
    port = 9000
    def fake_run(self, **config):
        assert host == config['host']
        assert port == config['port']

    monkeypatch.setattr(Flask, 'run', fake_run)
    sys.argv = [sys.argv[0], 'run', dirname(__file__), str(host), str(port)]
    manager.run()
示例#4
0
def test_can_build(c):
    test_dir = mkdtemp()
    make_dirs(test_dir, "source")
    sp = join(test_dir, "source", "foo.txt")
    bp = join(test_dir, "build", "foo.txt")
    create_file(sp, u"bar")

    sys.argv = [sys.argv[0], "build", "--path", test_dir]
    manager.run()
    assert os.path.exists(bp)
    remove_dir(test_dir)
示例#5
0
def test_run_with_custom_host_and_port(c, monkeypatch):
    host = "localhost"
    port = 9000

    def fake_run(self, **config):
        assert host == config["host"]
        assert port == config["port"]

    monkeypatch.setattr(Flask, "run", fake_run)
    sys.argv = [sys.argv[0], "run", mkdtemp(), str(host), str(port)]
    manager.run()
示例#6
0
def test_can_build(c):
    test_dir = mkdtemp()
    make_dirs(test_dir, 'source')
    sp = os.path.join(test_dir, 'source', 'foo.txt')
    bp = os.path.join(test_dir, 'build', 'foo.txt')
    create_file(sp, u'bar')

    sys.argv = [sys.argv[0], 'build', '--path', test_dir]
    manager.run()
    assert os.path.exists(bp)
    remove_dir(test_dir)
示例#7
0
def test_run_with_custom_host_and_port(c, monkeypatch):
    host = 'localhost'
    port = 9000

    def fake_run(self, **config):
        assert host == config['host']
        assert port == config['port']

    monkeypatch.setattr(Flask, 'run', fake_run)
    sys.argv = [sys.argv[0], 'run', mkdtemp(), str(host), str(port)]
    manager.run()
示例#8
0
def test_can_build(c):
    test_dir = mkdtemp()
    make_dirs(test_dir, 'source')
    sp = join(test_dir, 'source', 'foo.txt')
    bp = join(test_dir, 'build', 'foo.txt')
    create_file(sp, u'bar')

    sys.argv = [sys.argv[0], 'build', '--path', test_dir]
    manager.run()
    assert os.path.exists(bp)
    remove_dir(test_dir)
示例#9
0
def test_can_build(c):
    make_dirs(TEST_DIR)
    make_dirs(TEST_DIR, 'source')
    sp = join(TEST_DIR, 'source', 'foo.txt')
    bp = join(TEST_DIR, 'build', 'foo.txt')
    create_file(sp, u'bar')

    sys.argv = [sys.argv[0], 'build', TEST_DIR]
    manager.run()
    assert os.path.exists(bp)

    remove_dir(TEST_DIR)
示例#10
0
def test_can_build_pattern(c):
    test_dir = mkdtemp()
    make_dirs(test_dir, "source")
    sp1 = join(test_dir, "source", "foo.txt")
    bp1 = join(test_dir, "build", "foo.txt")
    create_file(sp1, u"bar")

    sp2 = join(test_dir, "source", "bar.txt")
    bp2 = join(test_dir, "build", "bar.txt")
    create_file(sp2, u"bar")

    sys.argv = [sys.argv[0], "build", "bar.txt", "--path", test_dir]
    manager.run()
    assert not os.path.exists(bp1)
    assert os.path.exists(bp2)
    assert read_content(bp2) == u"bar"
    remove_dir(test_dir)
示例#11
0
def test_can_build_pattern(c):
    test_dir = mkdtemp()
    make_dirs(test_dir, 'source')
    sp1 = os.path.join(test_dir, 'source', 'foo.txt')
    bp1 = os.path.join(test_dir, 'build', 'foo.txt')
    create_file(sp1, u'bar')

    sp2 = os.path.join(test_dir, 'source', 'bar.txt')
    bp2 = os.path.join(test_dir, 'build', 'bar.txt')
    create_file(sp2, u'bar')

    sys.argv = [sys.argv[0], 'build', 'bar.txt', '--path', test_dir]
    manager.run()
    assert not os.path.exists(bp1)
    assert os.path.exists(bp2)
    assert read_content(bp2) == u'bar'
    remove_dir(test_dir)
示例#12
0
def test_can_build_pattern(c):
    test_dir = mkdtemp()
    make_dirs(test_dir, 'source')
    sp1 = join(test_dir, 'source', 'foo.txt')
    bp1 = join(test_dir, 'build', 'foo.txt')
    create_file(sp1, u'bar')

    sp2 = join(test_dir, 'source', 'bar.txt')
    bp2 = join(test_dir, 'build', 'bar.txt')
    create_file(sp2, u'bar')

    sys.argv = [sys.argv[0], 'build', 'bar.txt', '--path', test_dir]
    manager.run()
    assert not os.path.exists(bp1)
    assert os.path.exists(bp2)
    assert read_content(bp2) == u'bar'
    remove_dir(test_dir)
示例#13
0
def test_create_skeleton():
    test_dir = mkdtemp()
    sys.argv = [sys.argv[0], "new", test_dir]
    manager.run()
    assert os.path.isdir(join(test_dir, "source"))
    remove_dir(test_dir)
示例#14
0
def test_create_skeleton():
    make_dirs(TEST_DIR)
    sys.argv = [sys.argv[0], 'new', TEST_DIR]
    manager.run()
    assert os.path.isdir(join(TEST_DIR, 'source'))
    remove_dir(TEST_DIR)
示例#15
0
def test_create_skeleton():
    test_dir = mkdtemp()
    sys.argv = [sys.argv[0], 'new', test_dir]
    manager.run()
    assert os.path.isdir(os.path.join(test_dir, 'source'))
    remove_dir(test_dir)