Пример #1
0
    def test_column_family_definition(self):
        '''
        Test for Return a dictionary of column family definitions for the given
        keyspace/column_family
        '''
        class MockSystemManager(object):
            def get_keyspace_column_families(self, keyspace):
                if keyspace == 'A':
                    return {'a': object, 'b': object}
                if keyspace == 'B':
                    raise Exception

        mock_sys_mgr = MagicMock(return_value=MockSystemManager())

        with patch.object(cassandra, '_sys_mgr', mock_sys_mgr):
            self.assertEqual(cassandra.column_family_definition('A', 'a'), vars(object))
            self.assertEqual(cassandra.column_family_definition('B', 'a'), None)
Пример #2
0
    def test_column_family_definition(self):
        '''
        Test for Return a dictionary of column family definitions for the given
        keyspace/column_family
        '''
        class MockSystemManager(object):
            def get_keyspace_column_families(self, keyspace):
                if keyspace == 'A':
                    return {'a': object, 'b': object}
                if keyspace == 'B':
                    raise Exception

        mock_sys_mgr = MagicMock(return_value=MockSystemManager())

        with patch.object(cassandra, '_sys_mgr', mock_sys_mgr):
            self.assertEqual(cassandra.column_family_definition('A', 'a'), vars(object))
            self.assertEqual(cassandra.column_family_definition('B', 'a'), None)
Пример #3
0
    def test_column_family_definition(self):
        """
        Test for Return a dictionary of column family definitions for the given
        keyspace/column_family
        """

        class MockSystemManager(object):
            def get_keyspace_column_families(self, keyspace):
                if keyspace == "A":
                    return {"a": object, "b": object}
                if keyspace == "B":
                    raise Exception

        mock_sys_mgr = MagicMock(return_value=MockSystemManager())

        with patch.object(cassandra, "_sys_mgr", mock_sys_mgr):
            self.assertEqual(cassandra.column_family_definition("A", "a"), vars(object))
            self.assertEqual(cassandra.column_family_definition("B", "a"), None)
Пример #4
0
    def test_column_family_definition(self):
        """
        Test for Return a dictionary of column family definitions for the given
        keyspace/column_family
        """

        class MockSystemManager(object):
            def get_keyspace_column_families(self, keyspace):
                if keyspace == "A":
                    return {"a": object, "b": object}
                if keyspace == "B":
                    raise Exception

        mock_sys_mgr = MagicMock(return_value=MockSystemManager())

        with patch.object(cassandra, "_sys_mgr", mock_sys_mgr):
            self.assertEqual(cassandra.column_family_definition("A", "a"), vars(object))
            self.assertEqual(cassandra.column_family_definition("B", "a"), None)