Ejemplo n.º 1
0
def test_readme_partials():
    cwd = os.getcwd()
    os.chdir(FIXTURES)

    common_templates = common.CommonTemplates()
    metadata = {}
    common_templates._load_partials(metadata)
    # should have populated introduction from partial.
    assert ("objects to users via direct download"
            in metadata["partials"]["introduction"])

    os.chdir(cwd)
Ejemplo n.º 2
0
def test_load_samples():
    cwd = os.getcwd()
    os.chdir(FIXTURES)

    common_templates = common.CommonTemplates()
    metadata = {}
    common_templates._load_samples(metadata)
    # should have loaded samples.
    assert metadata["samples"][1]["name"] == "Requester Pays"
    assert metadata["samples"][1]["file"] == "requesterPays.js"
    assert len(metadata["samples"]) == 2
    # should have loaded the special quickstart sample (ignoring header).
    assert "ID of the Cloud Bigtable instance" in metadata["quickstart"]
    assert "limitations under the License" not in metadata["quickstart"]

    os.chdir(cwd)
Ejemplo n.º 3
0
def test_load_samples():
    cwd = os.getcwd()
    os.chdir(FIXTURES)

    common_templates = common.CommonTemplates()
    metadata = {}
    common_templates._load_samples(metadata)
    # should have loaded samples.
    assert metadata["samples"][3]["title"] == "Requester Pays"
    assert metadata["samples"][3]["file"] == "requesterPays.js"
    assert len(metadata["samples"]) == 4
    # should have loaded the special quickstart sample (ignoring header).
    assert "ID of the Cloud Bigtable instance" in metadata["quickstart"]
    assert "limitations under the License" not in metadata["quickstart"]
    # should have included additional meta-information provided.
    assert metadata["samples"][0]["title"] == "Metadata Example 1"
    assert metadata["samples"][0]["usage"] == "node hello-world.js"
    assert metadata["samples"][1]["title"] == "Metadata Example 2"
    assert metadata["samples"][1]["usage"] == "node goodnight-moon.js"

    os.chdir(cwd)