Commit 9c0480d0 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Add unit tests for behave_utils.secret

parent 69de58ca
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
#  Copyright 2022  Dominik Sekotill <dom.sekotill@kodo.org.uk>
#
#  This Source Code Form is subject to the terms of the Mozilla Public
#  License, v. 2.0. If a copy of the MPL was not distributed with this
#  file, You can obtain one at http://mozilla.org/MPL/2.0/.

"""
Unit tests for behave_utils.secret
"""

from behave_utils import secret

from . import TestCase


class MakeSecretTests(TestCase):
	"""
	Tests for behave_utils.secret.make_secret
	"""

	def test(self) -> None:
		"""
		Check that calling make_secret returns a correctly sized string
		"""
		for num in (20, 40):
			with self.subTest(f"{num} chars"):
				output = secret.make_secret(num)

				self.assertIsInstance(output, str)
				assert len(output) == num