def test_fields(self): """Testing SVNTool repository form fields""" form = SVNTool.create_repository_form() self.assertEqual(list(form.fields), ['path', 'mirror_path']) self.assertEqual(form['path'].help_text, 'The path to the repository. This will generally be ' 'the URL you would use to check out the repository.') self.assertEqual(form['path'].label, 'Path') self.assertEqual(form['mirror_path'].help_text, '') self.assertEqual(form['mirror_path'].label, 'Mirror Path')
def test_load(self): """Tetting SVNTool repository form load""" repository = self.create_repository( tool_name='Subversion', path='https://svn.example.com/', mirror_path='https://svn.mirror.example.com') form = SVNTool.create_repository_form(repository=repository) form.load() self.assertEqual(form['path'].value(), 'https://svn.example.com/') self.assertEqual(form['mirror_path'].value(), 'https://svn.mirror.example.com')
def test_save(self): """Tetting SVNTool repository form save""" repository = self.create_repository(tool_name='Subversion') form = SVNTool.create_repository_form( repository=repository, data={ 'path': 'https://svn.example.com/', 'mirror_path': 'https://svn.mirror.example.com', }) self.assertTrue(form.is_valid()) form.save() self.assertEqual(repository.path, 'https://svn.example.com/') self.assertEqual(repository.mirror_path, 'https://svn.mirror.example.com')