Skip to content

Commit 058ae06

Browse files
author
Steve Canny
committed
add PackageWriter._write_pkg_rels()
1 parent 74c06f9 commit 058ae06

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

opc/pkgwriter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from opc.constants import CONTENT_TYPE as CT
1616
from opc.oxml import CT_Types, oxml_tostring
17-
from opc.packuri import CONTENT_TYPES_URI
17+
from opc.packuri import CONTENT_TYPES_URI, PACKAGE_URI
1818
from opc.phys_pkg import PhysPkgWriter
1919
from opc.spec import default_content_types
2020

@@ -61,7 +61,7 @@ def _write_pkg_rels(phys_writer, pkg_rels):
6161
Write the XML rels item for *pkg_rels* ('/_rels/.rels') to the
6262
package.
6363
"""
64-
raise NotImplementedError()
64+
phys_writer.write(PACKAGE_URI.rels_uri, pkg_rels.xml)
6565

6666

6767
class _ContentTypesItem(object):

tests/test_pkgwriter.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ def it_can_write_a_content_types_stream(self, xml_for):
8080
phys_writer.write.assert_called_once_with('/[Content_Types].xml',
8181
xml_for.return_value)
8282

83+
def it_can_write_a_pkg_rels_item(self):
84+
# mockery ----------------------
85+
phys_writer = Mock(name='phys_writer')
86+
pkg_rels = Mock(name='pkg_rels')
87+
# exercise ---------------------
88+
PackageWriter._write_pkg_rels(phys_writer, pkg_rels)
89+
# verify -----------------------
90+
phys_writer.write.assert_called_once_with('/_rels/.rels',
91+
pkg_rels.xml)
92+
8393

8494
class Describe_ContentTypesItem(object):
8595

0 commit comments

Comments
 (0)