def test_config_override(self):
     '''Tests if a parameter has precedence over a config value.'''
     factories.Dataset(name='trees')
     assert_equal(
         HarvesterBase._gen_new_name('Trees',
                                     append_type='number-sequence'),
         'trees1')
Beispiel #2
0
    def _before_create(self, harvest_object, dataset_dict):
        title = dataset_dict['title']
        name = HarvesterBase._gen_new_name(title)

        if not name:
            raise Exception('Could not generate a unique name '
                            'from the title or the GUID. Please '
                            'choose a more unique title.')
        dataset_dict['name'] = name
Beispiel #3
0
 def test_munge(self):
     assert_equal(HarvesterBase._gen_new_name("Trees and branches - survey."), "trees-and-branches-survey")
Beispiel #4
0
 def test_basic(self):
     assert_equal(HarvesterBase._gen_new_name("Trees"), "trees")
Beispiel #5
0
    def test_random_config(self):
        factories.Dataset(name='trees')
        new_name = HarvesterBase._gen_new_name('Trees')

        assert re.match(r'trees[\da-f]{5}', new_name)
Beispiel #6
0
 def test_number_config(self):
     factories.Dataset(name='trees')
     assert HarvesterBase._gen_new_name('Trees') == 'trees1'
Beispiel #7
0
 def test_without_config(self):
     '''Tests if the number suffix is used when no config is set.'''
     factories.Dataset(name='trees')
     assert HarvesterBase._gen_new_name('Trees') == 'trees1'
Beispiel #8
0
 def test_munge(self):
     assert HarvesterBase._gen_new_name(
         'Trees and branches - survey.') == 'trees-and-branches-survey'
Beispiel #9
0
 def test_basic(self):
     assert HarvesterBase._gen_new_name('Trees') == 'trees'
 def test_config_override(self):
     '''Tests if a parameter has precedence over a config value.'''
     factories.Dataset(name='trees')
     assert_equal(
         HarvesterBase._gen_new_name('Trees', append_type='number-sequence'),
         'trees1')
 def test_random_config(self):
     factories.Dataset(name='trees')
     new_name =  HarvesterBase._gen_new_name('Trees')
     
     assert re.match('trees[\da-f]{5}', new_name)
 def test_number_config(self):
     factories.Dataset(name='trees')
     assert_equal(
         HarvesterBase._gen_new_name('Trees'),
         'trees1')
 def test_without_config(self):
     '''Tests if the number suffix is used when no config is set.'''
     factories.Dataset(name='trees')
     assert_equal(
         HarvesterBase._gen_new_name('Trees'),
         'trees1')
 def test_munge(self):
     assert_equal(
         HarvesterBase._gen_new_name('Trees and branches - survey.'),
         'trees-and-branches-survey')
 def test_basic(self):
     assert_equal(HarvesterBase._gen_new_name('Trees'), 'trees')
Beispiel #16
0
 def test_basic(self):
     assert_equal(HarvesterBase._gen_new_name('Trees'), 'trees')