示例#1
0
    def test_raw_hostname_output_length(self):
        from model_mommy.utils import raw_hostname

        length = 11
        value = raw_hostname(length)
        self.assertLessEqual(len(value), length)

        length = 22
        value = raw_hostname(length)
        self.assertLessEqual(len(value), length)

        length = 33
        value = raw_hostname(length)
        self.assertLessEqual(len(value), length)
示例#2
0
    def test_raw_hostname_with_ext_list(self):
        from model_mommy.utils import raw_hostname

        ext_list = ['.com', '.com.br', '.org', '.org.br']
        value = raw_hostname(12, ext_list)
        self.assertTrue(any(map(lambda ext: value.endswith(ext), ext_list)))

        ext_list = ['.com.br']
        value = raw_hostname(12, ext_list)
        self.assertTrue(value.endswith('.com.br'))

        ext_list = ['com.br']
        value = raw_hostname(12, ext_list)
        self.assertTrue(value.endswith('.com.br'))
示例#3
0
    def test_raw_hostname_output_type(self):
        from model_mommy.utils import raw_hostname

        value = raw_hostname(12)
        self.assertTrue(isinstance(value, basestring))