def test_empty(tmp_xml_paths):
    """If no copy is present, we get an empty list"""
    url = 'http://example.com/some/url'
    assert notice_xml.local_copies(url) == []

    tmp_xml_paths[0].mkdir('some')
    assert notice_xml.local_copies(url) == []
예제 #2
0
def test_empty(tmp_xml_paths):
    """If no copy is present, we get an empty list"""
    url = 'http://example.com/some/url'
    assert notice_xml.local_copies(url) == []

    tmp_xml_paths[0].mkdir('some')
    assert notice_xml.local_copies(url) == []
def test_order(tmp_xml_paths):
    """The first source will override the second"""
    url = 'http://example.com/some/url'
    paths = []
    for d in tmp_xml_paths:
        d.mkdir('some')
        paths.append(d.join('some', 'url'))

    paths[1].write('aaaaa')
    assert [str(paths[1])] == notice_xml.local_copies(url)

    paths[0].write('bbbbb')
    assert [str(paths[0])] == notice_xml.local_copies(url)
예제 #4
0
def test_order(tmp_xml_paths):
    """The first source will override the second"""
    url = 'http://example.com/some/url'
    paths = []
    for d in tmp_xml_paths:
        d.mkdir('some')
        paths.append(d.join('some', 'url'))

    paths[1].write('aaaaa')
    assert [str(paths[1])] == notice_xml.local_copies(url)

    paths[0].write('bbbbb')
    assert [str(paths[0])] == notice_xml.local_copies(url)
    def test_order(self):
        """The first source will override the second"""
        url = 'http://example.com/some/url'
        paths = []
        for d in (self.dir1, self.dir2):
            os.mkdir(os.path.join(d, "some"))
            paths.append(os.path.join(d, "some", "url"))

        with open(paths[1], "w") as f:
            f.write('aaaaa')
        self.assertEqual([paths[1]], notice_xml.local_copies(url))

        with open(paths[0], "w") as f:
            f.write('bbbbb')
        self.assertEqual([paths[0]], notice_xml.local_copies(url))
    def test_order(self):
        """The first source will override the second"""
        url = 'http://example.com/some/url'
        paths = []
        for d in (self.dir1, self.dir2):
            os.mkdir(os.path.join(d, "some"))
            paths.append(os.path.join(d, "some", "url"))

        with open(paths[1], "w") as f:
            f.write('aaaaa')
        self.assertEqual([paths[1]], notice_xml.local_copies(url))

        with open(paths[0], "w") as f:
            f.write('bbbbb')
        self.assertEqual([paths[0]], notice_xml.local_copies(url))
def test_splits(tmp_xml_paths):
    """If multiple files are present from a single source, return all"""
    url = 'http://example.com/xml/503.xml'
    dir1, _ = tmp_xml_paths
    dir1.mkdir('xml')
    paths = []
    for i in range(3):
        path = dir1.join('xml', '503-{0}.xml'.format(i + 1))
        paths.append(str(path))
        path.write(str(i) * 10)

    assert set(paths) == set(notice_xml.local_copies(url))
    def test_splits(self):
        """If multiple files are present from a single source, return all"""
        url = 'http://example.com/xml/503.xml'
        os.mkdir(os.path.join(self.dir1, 'xml'))
        paths = []
        for i in range(3):
            path = os.path.join(self.dir1, 'xml', '503-{}.xml'.format(i + 1))
            paths.append(path)
            with open(path, 'w') as f:
                f.write(str(i)*10)

        self.assertEqual(set(paths), set(notice_xml.local_copies(url)))
예제 #9
0
def test_splits(tmp_xml_paths):
    """If multiple files are present from a single source, return all"""
    url = 'http://example.com/xml/503.xml'
    dir1, _ = tmp_xml_paths
    dir1.mkdir('xml')
    paths = []
    for i in range(3):
        path = dir1.join('xml', '503-{0}.xml'.format(i + 1))
        paths.append(str(path))
        path.write(str(i) * 10)

    assert set(paths) == set(notice_xml.local_copies(url))
    def test_splits(self):
        """If multiple files are present from a single source, return all"""
        url = 'http://example.com/xml/503.xml'
        os.mkdir(os.path.join(self.dir1, 'xml'))
        paths = []
        for i in range(3):
            path = os.path.join(self.dir1, 'xml', '503-{}.xml'.format(i + 1))
            paths.append(path)
            with open(path, 'w') as f:
                f.write(str(i) * 10)

        self.assertEqual(set(paths), set(notice_xml.local_copies(url)))
    def test_empty(self):
        """If no copy is present, we get an empty list"""
        self.assertEqual([], notice_xml.local_copies(self.url))

        os.mkdir(os.path.join(self.dir1, "some"))
        self.assertEqual([], notice_xml.local_copies(self.url))
    def test_empty(self):
        """If no copy is present, we get an empty list"""
        self.assertEqual([], notice_xml.local_copies(self.url))

        os.mkdir(os.path.join(self.dir1, "some"))
        self.assertEqual([], notice_xml.local_copies(self.url))