from django.test import SimpleTestCase

from . import views


class IDCleanTest(SimpleTestCase):

    def test_clean_nothing(self):
        self.assertEqual(None, views.clean_id(None))

    def test_clean_digit(self):
        self.assertEqual('1', views.clean_id('1'))

    def test_clean_character(self):
        self.assertEqual(None, views.clean_id('a'))

    def test_clean_digits(self):
        self.assertEqual('123456', views.clean_id('123456'))

    def test_clean_digits_space(self):
        self.assertEqual('123456', views.clean_id("\t   123456 \t "))

    def test_clean_multiple(self):
        self.assertEqual('123456', views.clean_id('123456 2'))
        self.assertEqual('123456', views.clean_id('123456,2'))
        self.assertEqual('123456', views.clean_id('123456b2x'))
