~ubuntu-branches/ubuntu/saucy/migrate/saucy-proposed

« back to all changes in this revision

Viewing changes to migrate/tests/versioning/test_cfgparse.py

  • Committer: Bazaar Package Importer
  • Author(s): Jan Dittberner
  • Date: 2010-07-12 00:24:57 UTC
  • mfrom: (1.1.5 upstream) (2.1.8 sid)
  • Revision ID: james.westby@ubuntu.com-20100712002457-4j2fdmco4u9kqzm5
Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
# -*- coding: utf-8 -*-
 
3
 
 
4
from migrate.versioning import cfgparse
 
5
from migrate.versioning.repository import *
 
6
from migrate.versioning.template import Template
 
7
from migrate.tests import fixture
 
8
 
 
9
 
 
10
class TestConfigParser(fixture.Base):
 
11
 
 
12
    def test_to_dict(self):
 
13
        """Correctly interpret config results as dictionaries"""
 
14
        parser = cfgparse.Parser(dict(default_value=42))
 
15
        self.assert_(len(parser.sections()) == 0)
 
16
        parser.add_section('section')
 
17
        parser.set('section','option','value')
 
18
        self.assertEqual(parser.get('section', 'option'), 'value')
 
19
        self.assertEqual(parser.to_dict()['section']['option'], 'value')
 
20
    
 
21
    def test_table_config(self):
 
22
        """We should be able to specify the table to be used with a repository"""
 
23
        default_text = Repository.prepare_config(Template().get_repository(),
 
24
            'repository_name', {})
 
25
        specified_text = Repository.prepare_config(Template().get_repository(),
 
26
            'repository_name', {'version_table': '_other_table'})
 
27
        self.assertNotEquals(default_text, specified_text)