Пример #1
0
class TestMain(unittest.TestCase):
    def setUp(self):
        self.my_master_config = MasterConfig(master_configfile_path)
        self.my_worker_config = WorkerConfig(worker_configfile_path)
        help_set_up()

    def test__on_worker(self):
        self.assertFalse(_on_worker(test_folder_path))
        self.my_master_config.write_configfile()
        self.assertFalse(_on_worker(test_folder_path))
        self.my_worker_config.write_configfile()
        self.assertTrue(_on_worker(test_folder_path))

    def test_makeBucket_on_master(self):
        self.my_master_config.write_configfile()
        my_bucket = Bucket('raz', test_folder_path)
        self.assertIsInstance(my_bucket, mb.MasterBucket)

    def test_makeBucket_on_master_local_test(self):
        self.my_master_config.write_configfile()
        my_bucket = Bucket('raz', test_folder_path, True)
        self.assertIsInstance(my_bucket, wb.Bucket)

    def test_makeBucket_on_worker(self):
        self.my_worker_config.write_configfile()
        my_bucket = Bucket('raz', test_folder_path)
        self.assertIsInstance(my_bucket, wb.Bucket)

    def tearDown(self):
        help_tear_down()
Пример #2
0
class TestWorkerConfig(unittest.TestCase):
    def setUp(self):
        help_set_up()
        self.my_config = WorkerConfig(test_configfile_path)

    def test_WorkerConfig_write_configfile(self):
        self.assertFalse(os.path.isfile(test_configfile_path))
        self.my_config.write_configfile()
        self.assertTrue(os.path.isfile(test_configfile_path))
        with open(test_configfile_path, 'rb') as configfile:
            self.assertEqual(configfile.read(), '# -*- task_manage_zfb: worker -*-\n')
        self.assertEqual(os.path.getsize(test_configfile_path), 34L)

    def test_WorkerConfig_is_config_file(self):
        self.my_config.write_configfile()
        self.assertFalse(WorkerConfig.is_config_file(normalfile_path))
        self.assertTrue(WorkerConfig.is_config_file(test_configfile_path))

    def tearDown(self):
        help_tear_down()
Пример #3
0
 def setUp(self):
     self.my_master_config = MasterConfig(master_configfile_path)
     self.my_worker_config = WorkerConfig(worker_configfile_path)
     help_set_up()
Пример #4
0
 def test_WorkerConfig_is_config_file(self):
     self.my_config.write_configfile()
     self.assertFalse(WorkerConfig.is_config_file(normalfile_path))
     self.assertTrue(WorkerConfig.is_config_file(test_configfile_path))
Пример #5
0
 def setUp(self):
     help_set_up()
     self.my_config = WorkerConfig(test_configfile_path)