def test_create_alis_coverage__created(self): with self.assertRaises(ValidationError): enquiry = Alias(alias='3', target='3', start=datetime.datetime(2021, 1, 3, 0, 0, 0, 0), end=datetime.datetime(2021, 1, 4, 0, 0, 0, 0)) enquiry.clean()
def test_end_None(self): with self.assertRaises(IntegrityError): enquiry = Alias(alias=None, target=1, start=None, end=datetime.datetime(2021, 1, 4, 0, 0, 0, 0)) enquiry.save()
def test_create_alis_covering_the_existing(self): with self.assertRaises(ValidationError): enquiry = Alias(alias='3', target='3', start=datetime.datetime(2020, 1, 2, 0, 0, 0, 0), end=datetime.datetime(2022, 1, 1, 0, 0, 0, 1)) enquiry.clean()
def test_create_alis_start_is_greater_than_end(self): with self.assertRaises(ValidationError): enquiry = Alias(start=datetime.datetime(2020, 12, 31, 18, 0, 0, 999999), end=datetime.datetime(2020, 12, 31, 17, 0, 0, 999999)) enquiry.clean()
def test_create_alis_end_is_included(self): with self.assertRaises(ValidationError): enquiry1 = Alias(alias='3', target='3', start=datetime.datetime(2021, 1, 2, 0, 0, 0, 0), end=datetime.datetime(2021, 1, 1, 0, 0, 0, 1)) enquiry2 = Alias(alias='3', target='3', start=datetime.datetime(2021, 1, 5, 0, 0, 0, 0), end=datetime.datetime(2021, 1, 1, 0, 0, 0, 0)) enquiry1.clean() enquiry2.clean()
def test_input_date_time(self): with self.assertRaises(ValidationError): enquiry1 = Alias(alias=None, target=1, start='02-20-2043 01:59:00', end=datetime.datetime(2021, 1, 4, 0, 0, 0, 0)) enquiry2 = Alias(alias=None, target=1, start='', end=datetime.datetime(2021, 1, 4, 0, 0, 0, 0)) enquiry1.save() enquiry2.save()
def setUp(self): Alias(alias='3', target='3', start=datetime.datetime(2021, 1, 1, 0, 0, 0, 0), end=datetime.datetime(2021, 1, 5, 0, 0, 0, 0)).save() Alias(alias='4', target='3', start=datetime.datetime(2021, 1, 1, 0, 0, 0, 0), end=datetime.datetime(2021, 1, 5, 0, 0, 0, 0)).save() Alias(alias='10', target='3', start=datetime.datetime(2021, 1, 1, 0, 0, 0, 0), end=datetime.datetime(2021, 1, 5, 0, 0, 0, 0)).save() Alias(alias='10', target='3', start=datetime.datetime(2021, 1, 1, 0, 0, 0, 0), end=None).save() Alias(alias='10', target='3', start=datetime.datetime(2030, 1, 1, 0, 0, 0, 0), end=datetime.datetime(2034, 1, 1, 0, 0, 0, 0)).save()