Beispiel #1
0
    def test_file_exists_fails(self):
        def fake_call_method(module, method, *args, **kwargs):
            if method == 'SearchDatastore_Task':
                return 'fake_exists_task'

            # Should never get here
            self.fail()

        def fake_wait_for_task(task_ref):
            if task_ref == 'fake_exists_task':
                raise vexc.FileNotFoundException()

            # Should never get here
            self.fail()

        with contextlib.nested(
                mock.patch.object(self.session, '_call_method',
                                  fake_call_method),
                mock.patch.object(self.session, '_wait_for_task',
                                  fake_wait_for_task)):
            ds_path = ds_util.DatastorePath('ds', 'fake/path')
            file_exists = ds_util.file_exists(self.session, 'fake-browser',
                                              ds_path, 'fake-file')
            self.assertFalse(file_exists)
Beispiel #2
0
 def test_equal(self):
     a = ds_util.DatastorePath('ds_name', 'a')
     b = ds_util.DatastorePath('ds_name', 'a')
     self.assertEqual(a, b)