-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
56 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from zope.component.testing import PlacelessSetup | ||
from zope.dublincore.browser.metadataedit import MetaDataEdit | ||
from zope.publisher.browser import TestRequest | ||
import unittest | ||
import zope.annotation.interfaces | ||
import zope.dublincore.testing | ||
|
||
|
||
@zope.interface.implementer(zope.annotation.interfaces.IAnnotations) | ||
class DummyContext(dict): | ||
"""A dummy class which can store annotations.""" | ||
|
||
|
||
class MetaDataEditTests(PlacelessSetup, unittest.TestCase): | ||
"""Testing ..metadataedit.MetaDataEdit.""" | ||
|
||
def setUp(self): | ||
super(MetaDataEditTests, self).setUp() | ||
zope.dublincore.testing.setUpDublinCore() | ||
|
||
def test_metadataedit__MetaDataEdit__edit__1(self): | ||
"""It stores DC request values on the context.""" | ||
view = MetaDataEdit() | ||
request = TestRequest( | ||
form={'dctitle': 'Test', 'dcdescription': 'Testing'}) | ||
view.context = DummyContext() | ||
view.request = request | ||
result = view.edit() | ||
self.assertEqual({ | ||
'message': 'Changed data ${datetime}', | ||
'dctitle': 'Test', | ||
'dcdescription': 'Testing', | ||
'modified': '', | ||
'created': '', | ||
'creators': () | ||
}, result) | ||
|
||
self.assertEqual({ | ||
'zope.app.dublincore.ZopeDublinCore': { | ||
'Title': ('Test',), | ||
'Description': ('Testing',)}}, view.context) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters