Beispiel #1
0
    def test_write_node_contents(self):
        selector = ModelFileSelector(projection='%(content_file)s', file_field_name='content_file', model_class=Thing)
        node = selector.get_nodes(AbstractNode(selector))[0]

        expected_contents = 'Blah blah blah'

        node.write_contents(expected_contents, reset=True)
        self.assertEqual(selector.read_node_contents(node), expected_contents)

        node.write_contents(expected_contents, reset=False)
        self.assertEqual(selector.read_node_contents(node), expected_contents * 2)
Beispiel #2
0
    def test_read_node_contents(self):
        selector = ModelFileSelector(projection='%(content_file)s', file_field_name='content_file', model_class=Thing)
        node = selector.get_nodes(AbstractNode(selector))[0]

        expected_contents = open(__file__).read()

        self.assertEqual(selector.read_node_contents(node), expected_contents)