|
13 | 13 |
|
14 | 14 | from mock import call, Mock, patch, PropertyMock
|
15 | 15 |
|
| 16 | +from opc.constants import CONTENT_TYPE as CT |
16 | 17 | from opc.oxml import CT_Relationships
|
17 | 18 | from opc.package import (
|
18 | 19 | OpcPackage, Part, PartFactory, _Relationship, RelationshipCollection,
|
@@ -192,6 +193,18 @@ def it_constructs_a_part_instance(self, Part_):
|
192 | 193 | Part_.assert_called_once_with(partname, content_type, blob)
|
193 | 194 | assert part == Part_.return_value
|
194 | 195 |
|
| 196 | + def it_constructs_custom_part_type_for_registered_content_types(self): |
| 197 | + # mockery ---------------------- |
| 198 | + CustomPartClass = Mock(name='CustomPartClass') |
| 199 | + partname, blob = (Mock(name='partname'), Mock(name='blob')) |
| 200 | + # exercise --------------------- |
| 201 | + PartFactory.part_type_for[CT.WML_DOCUMENT_MAIN] = CustomPartClass |
| 202 | + part = PartFactory(partname, CT.WML_DOCUMENT_MAIN, blob) |
| 203 | + # verify ----------------------- |
| 204 | + CustomPartClass.assert_called_once_with(partname, |
| 205 | + CT.WML_DOCUMENT_MAIN, blob) |
| 206 | + assert part is CustomPartClass.return_value |
| 207 | + |
195 | 208 |
|
196 | 209 | class Describe_Relationship(object):
|
197 | 210 |
|
|
0 commit comments