コード例 #1
0
    def test_get_by_item_id(self):
        item_link = ItemLink(type=self.link_type, item_id=self.item_1.id, linked_id=self.item_2.id)
        db.session.add(item_link)
        db.session.flush()

        results = ItemLink.get_by_item_id(self.item_1.id)
        self.assertListEqual(results, [item_link])

        missing_results = ItemLink.get_by_item_id(self.item_2.id)
        self.assertListEqual(missing_results, [])