Ejemplo n.º 1
0
    def test_generated_7th_file_is_aggregate(self):
        Generate.dirpath = self.test_dir
        Generate.filename_prefix = "file"
        Generate.generate(7, "Hello")
        file_7_size = path.getsize(Generate.filename(7))
        expected_size = 0
        for i in range(6):
            filename = Generate.filename(i + 1)
            expected_size += path.getsize(filename)

        self.assertEquals(expected_size, file_7_size)
Ejemplo n.º 2
0
    def test_generated_only_5th_file_contains_String(self):
        Generate.dirpath = self.test_dir
        Generate.filename_prefix = "file"
        file_5_addition = "Test String!"
        #test to check if 5th file contains the Test String!
        filename = Generate.filename(5)
        Generate.generate(5, file_5_addition)
        with open(filename) as fh:
            content = fh.read()
        self.assertTrue(file_5_addition in content)

        #test to check if non 5th file contains the Test String!
        filename = Generate.filename(3)
        with open(filename) as fh:
            content = fh.read()
        self.assertTrue(file_5_addition not in content)