Пример #1
0
def test_gen_content_key():
    content = "one two three"
    expected_md5 = hashlib.md5(content).hexdigest()

    assert AuroraConfigLoader.gen_content_key(1) is None, (
        "Non filetype results in None")

    with temporary_dir() as d:
        filename = os.path.join(d, 'file')
        assert AuroraConfigLoader.gen_content_key(filename) is None, (
            "non existant file results in key=None")

        with open(filename, 'w+') as fp:
            fp.write(content)
            fp.flush()
            fp.seek(0)
            for config in (fp.name, fp):
                assert expected_md5 == AuroraConfigLoader.gen_content_key(
                    config), ("check hexdigest for %s" % config)
Пример #2
0
def test_gen_content_key():
  content = "one two three"
  expected_md5 = hashlib.md5(content).hexdigest()

  assert AuroraConfigLoader.gen_content_key(1) is None, (
    "Non filetype results in None")

  with temporary_dir() as d:
    filename = os.path.join(d, 'file')
    assert AuroraConfigLoader.gen_content_key(filename) is None, (
      "non existant file results in key=None")

    with open(filename, 'w+') as fp:
      fp.write(content)
      fp.flush()
      fp.seek(0)
      for config in (fp.name, fp):
        assert expected_md5 == AuroraConfigLoader.gen_content_key(config), (
          "check hexdigest for %s" % config)