def test_planning_data(self):
        planning_assignments.init_app(self.app)
        planning_planning.init_app(self.app)

        assignments = [{"coverage_item": "urn:coverage-id", "planning_item": "urn:planning-id"}]
        self.app.data.insert("assignments", assignments)

        article = {
            "_id": "tag:aap.com.au:20150613:12345",
            "guid": "tag:aap.com.au:20150613:12345",
            "type": "text",
            "version": 1,
            "assignment_id": assignments[0]["_id"],
        }

        seq, doc = self.formatter.format(article, {"name": "Test Subscriber"})[0]
        data = json.loads(doc)

        self.assertEqual("urn:planning-id", data["planning_id"])
        self.assertEqual("urn:coverage-id", data["coverage_id"])
    def test_planning_data(self):
        planning_assignments.init_app(self.app)
        planning_planning.init_app(self.app)

        assignments = [{'coverage_item': 'urn:coverage-id', 'planning_item': 'urn:planning-id'}]
        self.app.data.insert('assignments', assignments)

        article = {
            '_id': 'tag:aap.com.au:20150613:12345',
            'guid': 'tag:aap.com.au:20150613:12345',
            'type': 'text',
            'version': 1,
            'assignment_id': assignments[0]['_id'],
        }

        seq, doc = self.formatter.format(article, {'name': 'Test Subscriber'})[0]
        data = json.loads(doc)

        self.assertEqual('urn:planning-id', data['planning_id'])
        self.assertEqual('urn:coverage-id', data['coverage_id'])
    def test_planning_data(self):
        planning_assignments.init_app(self.app)
        planning_planning.init_app(self.app)

        assignments = [{
            'coverage_item': 'urn:coverage-id',
            'planning_item': 'urn:planning-id'
        }]
        self.app.data.insert('assignments', assignments)

        article = {
            '_id': 'tag:aap.com.au:20150613:12345',
            'guid': 'tag:aap.com.au:20150613:12345',
            'type': 'text',
            'version': 1,
            'assignment_id': assignments[0]['_id'],
        }

        seq, doc = self.formatter.format(article,
                                         {'name': 'Test Subscriber'})[0]
        data = json.loads(doc)

        self.assertEqual('urn:planning-id', data['planning_id'])
        self.assertEqual('urn:coverage-id', data['coverage_id'])