# Path: record/hashing.py
# def hash_sha512s(passwd, salt=None):
# def gen_salt(length=16):
# def gen_randhex_sha256():


import sys
import unittest
from record import hashing
#! /usr/bin/env python2
# coding: utf8
sys.path.append("..")


def verify_format(testcase, hashed_passwd):
    testcase.assertEqual(len(hashed_passwd.split('$')), 3)
    for part in hashed_passwd.split('$'):
        testcase.assertIsInstance(part, str)
        testcase.assertTrue(len(part) > 0)
    method = hashed_passwd.split('$')[0]

# Path: record/hashing.py
# def hash_sha512s(passwd, salt=None):
# def gen_salt(length=16):
# def gen_randhex_sha256():


# Path: test/test_hashing.py
import sys
import unittest
from record import hashing

#! /usr/bin/env python2
# coding: utf8
sys.path.append("..")


def verify_format(testcase, hashed_passwd):
    testcase.assertEqual(len(hashed_passwd.split('$')), 3)
    for part in hashed_passwd.split('$'):
        testcase.assertIsInstance(part, str)
        testcase.assertTrue(len(part) > 0)
    method = hashed_passwd.split('$')[0]

    _ = getattr(hashing, 'hash_'+method) # See if this raises AttributeError