Exemple #1
0
    def test_create_subdir(self):
        p = os.path.join(
            self.BASEDIRNAME,
            base.random_num_string(15),
            base.random_num_string(15)
        )

        base.create_dir(p)

        self.assertTrue(os.path.exists(p))
        self.assertTrue(os.path.isdir(p))
Exemple #2
0
    def setUp(self):
        base.create_dir(self.BASEDIRNAME)

        self.p1 = os.path.join(self.BASEDIRNAME, base.random_num_string())
        self.p2 = os.path.join(self.BASEDIRNAME, base.random_num_string())
        self.p3 = os.path.join(self.BASEDIRNAME, base.random_num_string())

        self.p11 = os.path.join(self.p1, base.random_num_string())
        self.p21 = os.path.join(self.p2, base.random_num_string())
        self.p22 = os.path.join(self.p2, base.random_num_string())

        base.create_dir(self.p1)
        base.create_dir(self.p2)
        base.create_dir(self.p3)

        with open(self.p11, 'wb') as _:
            pass

        with open(self.p21, 'wb') as _:
            pass

        with open(self.p22, 'wb') as _:
            pass
Exemple #3
0
    def test_random_num_string_unspec_length(self):

        s = base.random_num_string()

        self.assertEqual(type(s), str)
        self.assertTrue(len(s) > 0)
Exemple #4
0
    def test_random_num_string(self):
        l = random.randint(0, 9999)
        s = base.random_num_string(l)

        self.assertEqual(type(s), str)
        self.assertEqual(len(s), l)