def assert_option_fails(self, key):
        # key is a normal_key, converted to
        # __compaction_key__

        key = "__compaction_{0}__".format(key)

        with patch.object(self.model, key, 10):
            with self.assertRaises(CQLEngineException):
                get_compaction_options(self.model)
    def assert_option_fails(self, key):
        # key is a normal_key, converted to
        # __compaction_key__

        key = "__compaction_{0}__".format(key)

        with patch.object(self.model, key, 10):
            with self.assertRaises(CQLEngineException):
                get_compaction_options(self.model)
    def test_empty_compaction(self):
        class EmptyCompactionModel(Model):

            __compaction__ = None
            cid = columns.UUID(primary_key=True)
            name = columns.Text()

        result = get_compaction_options(EmptyCompactionModel)
        self.assertEqual({}, result)
    def test_empty_compaction(self):
        class EmptyCompactionModel(Model):

            __compaction__ = None
            cid = columns.UUID(primary_key=True)
            name = columns.Text()

        result = get_compaction_options(EmptyCompactionModel)
        self.assertEqual({}, result)
    def test_sstable_size_in_mb(self):
        with patch.object(self.model, '__compaction_sstable_size_in_mb__', 32):
            result = get_compaction_options(self.model)

        assert result['sstable_size_in_mb'] == '32'
 def test_simple_leveled(self):
     result = get_compaction_options(self.model)
     assert result['class'] == LeveledCompactionStrategy
 def test_min_threshold(self):
     self.model.__compaction_min_threshold__ = 2
     result = get_compaction_options(self.model)
     assert result['min_threshold'] == '2'
 def test_size_tiered(self):
     result = get_compaction_options(self.model)
     assert result['class'] == SizeTieredCompactionStrategy
    def test_sstable_size_in_mb(self):
        with patch.object(self.model, '__compaction_sstable_size_in_mb__', 32):
            result = get_compaction_options(self.model)

        assert result['sstable_size_in_mb'] == '32'
 def test_simple_leveled(self):
     result = get_compaction_options(self.model)
     assert result['class'] == LeveledCompactionStrategy
 def test_min_threshold(self):
     self.model.__compaction_min_threshold__ = 2
     result = get_compaction_options(self.model)
     assert result['min_threshold'] == '2'
 def test_size_tiered(self):
     result = get_compaction_options(self.model)
     assert result['class'] == SizeTieredCompactionStrategy