コード例 #1
0
ファイル: test_utils.py プロジェクト: lonetwin/opencore
 def test_exists_two(self):
     self.context['name']=testing.DummyModel()
     self.context['name-2']=testing.DummyModel()
     self.assertEqual(
         make_name(self.context,'name'),
         'name-3'
         )
コード例 #2
0
ファイル: image.py プロジェクト: amarandon/opencore
    def relocate(match):
        matchdict = match.groupdict()
        tempid = matchdict['tempid']
        if tempid in relocated_images:
            # Already relocated this one
            url = relocated_images[tempid]
        else:
            # Move temp image to attachments folder
            image = tempfolder[tempid]
            del tempfolder[tempid]
            name = make_name(attachments, image.filename)
            attachments[name] = image
            size = (int(matchdict['width']), int(matchdict['height']))
            url = thumb_url(image, request, size)
            relocated_images[tempid] = url
            workflow = get_workflow(ICommunityFile, 'security', image)
            if workflow is not None:
                workflow.initialize(image)

        return ''.join([matchdict['pre'], url, matchdict['post'],])
コード例 #3
0
ファイル: test_utils.py プロジェクト: lonetwin/opencore
 def test_empty_cos_of_dodgy_characters(self):
     with ShouldRaise(ValueError('The name must not be empty')):
         make_name(self.context,'$%')
コード例 #4
0
ファイル: test_utils.py プロジェクト: lonetwin/opencore
 def test_empty(self):
     with ShouldRaise(ValueError('The name must not be empty')):
         make_name(self.context,'')
コード例 #5
0
ファイル: test_utils.py プロジェクト: lonetwin/opencore
 def test_complex(self):
     self.assertEqual(
         make_name(self.context,'$%^some thing'),
         'some-thing'
         )
コード例 #6
0
ファイル: test_utils.py プロジェクト: lonetwin/opencore
 def test_simple(self):
     self.assertEqual(
         make_name(self.context,'something'),
         'something'
         )