Exemple #1
0
static PyObject *py_check_password_quality(PyObject *self, PyObject *args)
{
	char *pass;

	if (!PyArg_ParseTuple(args, "s", &pass)) {
		return NULL;
	}

	return PyBool_FromLong(check_password_quality(pass));
}
Exemple #2
0
static bool test_check_password_quality(struct torture_context *tctx)
{
	torture_assert(tctx, !check_password_quality(""), "empty password");
	torture_assert(tctx, !check_password_quality("a"), "one char password");
	torture_assert(tctx, !check_password_quality("aaaaaaaaaaaa"), "same char password");
	torture_assert(tctx, !check_password_quality("BLA"), "multiple upcases password");
	torture_assert(tctx, !check_password_quality("123"), "digits only");
	torture_assert(tctx, check_password_quality("A2e"), "valid");
	torture_assert(tctx, check_password_quality("BA2eLi443"), "valid");
	return true;
}
Exemple #3
0
static bool test_check_password_quality(struct torture_context *tctx)
{
	torture_assert(tctx, !check_password_quality(""), "empty password");
	torture_assert(tctx, !check_password_quality("a"), "one char password");
	torture_assert(tctx, !check_password_quality("aaaaaaaaaaaa"), "same char password");
	torture_assert(tctx, !check_password_quality("BLA"), "multiple upcases password");
	torture_assert(tctx, !check_password_quality("123"), "digits only");
	torture_assert(tctx, !check_password_quality("matthiéu"), "not enough high symbols");
	torture_assert(tctx, !check_password_quality("abcdééàçè"), "only lower case");
	torture_assert(tctx, !check_password_quality("abcdééàçè+"), "only lower and symbols");
	torture_assert(tctx, check_password_quality("abcdééàçè+ढ"), "valid");
	torture_assert(tctx, check_password_quality("ç+ढ"), "valid");
	torture_assert(tctx, check_password_quality("A2e"), "valid");
	torture_assert(tctx, check_password_quality("BA2eLi443"), "valid");
	return true;
}