Example #1
0
def fake_authz_key_file():
  """Create temporary file for fake authorisation hmac signing key.

  :returns: Instance of :class:`~.NamedTemporaryFile`, whose *data*
    attribute contains the HMAC signing binary key."""
  t = NamedTemporaryFile()
  t.data = open("/dev/urandom").read(20)
  t.write(t.data)
  t.seek(0)
  return t
Example #2
0
def fake_authz_key_file(delete=True):
    """Create temporary file for fake authorisation hmac signing key.

    :returns: Instance of :class:`~.NamedTemporaryFile`, whose *data*
      attribute contains the HMAC signing binary key."""
    t = NamedTemporaryFile(delete=delete)
    t.data = open("/dev/urandom").read(20)
    t.write(t.data)
    t.seek(0)
    return t