def setUp(self):
     dirname = os.path.dirname(os.path.realpath(__file__))
     fixture = os.path.normpath(
         os.path.join(dirname, '../fixtures', self.filename))
     provider = {'name': 'test'}
     with open(fixture, 'rb') as f:
         parser = BelgaNewsMLOneFeedParser()
         self.xml_root = etree.parse(f).getroot()
         self.item = parser.parse(self.xml_root, provider)
 def setUp(self):
     dirname = os.path.dirname(os.path.realpath(__file__))
     fixture = os.path.normpath(
         os.path.join(dirname, '../fixtures', self.filename))
     media_fixture = os.path.normpath(
         os.path.join(dirname, '../fixtures', self.media_file))
     provider = {
         'name': 'test',
         'config': {
             'path': os.path.join(dirname, '../fixtures')
         }
     }
     parser = BelgaNewsMLOneFeedParser()
     with open(media_fixture, 'rb') as f:
         parser._get_file = MagicMock(return_value=BytesIO(f.read()))
     with open(fixture, 'rb') as f:
         self.xml_root = etree.parse(f).getroot()
         self.item = parser.parse(self.xml_root, provider)
    def setUp(self):
        super().setUp()

        self.users = [
            {
                'username': '******',
                'display_name': 'DWM'
            },
        ]

        self.app.data.insert('users', self.users)

        dirname = os.path.dirname(os.path.realpath(__file__))
        fixture = os.path.normpath(
            os.path.join(dirname, '../fixtures', self.filename))
        provider = {'name': 'test'}
        with open(fixture, 'rb') as f:
            parser = BelgaNewsMLOneFeedParser()
            self.xml_root = etree.parse(f).getroot()
            self.item = parser.parse(self.xml_root, provider)
 def setUp(self):
     super().setUp()
     self.users = [{"username": "******", "display_name": "John Doe"}]
     get_resource_service("users").create(self.users)
     dirname = os.path.dirname(os.path.realpath(__file__))
     fixture = os.path.normpath(
         os.path.join(dirname, '../fixtures', self.filename))
     media_fixture = os.path.normpath(
         os.path.join(dirname, '../fixtures', self.media_file))
     provider = {
         'name': 'test',
         'config': {
             'path': os.path.join(dirname, '../fixtures')
         }
     }
     parser = BelgaNewsMLOneFeedParser()
     with open(media_fixture, 'rb') as f:
         parser._get_file = MagicMock(return_value=BytesIO(f.read()))
     with open(fixture, 'rb') as f:
         self.xml_root = etree.parse(f).getroot()
         self.item = parser.parse(self.xml_root, provider)
    def setUp(self):
        super().setUp()
        dirname = os.path.dirname(os.path.realpath(__file__))
        fixture = os.path.normpath(
            os.path.join(dirname, '../fixtures', self.filename))
        provider = {
            'name': 'test',
            'config': {
                'path': os.path.join(dirname, '../fixtures')
            }
        }
        parser = BelgaNewsMLOneFeedParser()

        def get_file_side_effect(value):
            media_path = os.path.normpath(
                os.path.join(dirname, '../fixtures', value))
            with open(media_path, 'rb') as f:
                return BytesIO(f.read())

        parser._get_file = MagicMock(side_effect=get_file_side_effect)

        with open(fixture, 'rb') as f:
            self.xml_root = etree.parse(f).getroot()
            self.item = parser.parse(self.xml_root, provider)
 def test_can_parse(self):
     self.assertTrue(BelgaNewsMLOneFeedParser().can_parse(self.xml_root))