def test_purge_essay(self):
        self.assertEqual(Essay.objects.all().count(), 0)
        num_titles = Title.objects.all().count()

        load_essay(EssayLoaderTests.ESSAYS_EDITOR_URL + '/essay/3/', index=False)
        self.assertEqual(Essay.objects.all().count(), 1)

        # purge it
        purge_essay(EssayLoaderTests.ESSAYS_EDITOR_URL + '/essay/3/', index=False)
        self.assertEqual(Essay.objects.all().count(), 0)

        # same amount of titles (none should be deleted)
        self.assertEqual(Title.objects.all().count(), num_titles)
示例#2
0
    def test_purge_essay(self):
        self.assertEqual(Essay.objects.all().count(), 0)
        num_titles = Title.objects.all().count()

        load_essay(EssayLoaderTests.ESSAYS_EDITOR_URL + "/essay/3/", index=False)
        self.assertEqual(Essay.objects.all().count(), 1)

        # purge it
        purge_essay(EssayLoaderTests.ESSAYS_EDITOR_URL + "/essay/3/", index=False)
        self.assertEqual(Essay.objects.all().count(), 0)

        # same amount of titles (none should be deleted)
        self.assertEqual(Title.objects.all().count(), num_titles)
示例#3
0
    def test_purge_essay(self):
        self.assertEqual(Essay.objects.all().count(), 0)
        num_titles = Title.objects.all().count()

        load_essay('http://ndnp-essays.rdc.lctl.gov/essay/3/', index=False)
        self.assertEqual(Essay.objects.all().count(), 1)

        # purge it
        purge_essay('http://ndnp-essays.rdc.lctl.gov/essay/3/', index=False)
        self.assertEqual(Essay.objects.all().count(), 0)

        # same amount of titles (none should be deleted)
        self.assertEqual(Title.objects.all().count(), num_titles)
示例#4
0
    def test_purge_essay(self):
        self.assertEqual(Essay.objects.all().count(), 0)
        num_titles = Title.objects.all().count()

        load_essay('http://ndnp-essays.rdc.lctl.gov/essay/3/', index=False)
        self.assertEqual(Essay.objects.all().count(), 1)

        # purge it
        purge_essay('http://ndnp-essays.rdc.lctl.gov/essay/3/', index=False)
        self.assertEqual(Essay.objects.all().count(), 0)

        # same amount of titles (none should be deleted)
        self.assertEqual(Title.objects.all().count(), num_titles)
    def test_load_essay(self):
        e = load_essay(EssayLoaderTests.ESSAYS_EDITOR_URL + '/essay/3/', index=False)
        self.assertTrue(isinstance(e, Essay))

        # is it in the db now?
        essays = Essay.objects.all()
        self.assertEqual(len(essays), 1)

        # get an essay
        title = Title.objects.get(lccn='sn83027091')
        essay = title.essays.all()[0]

        self.assertEqual(essay.title, 'Colored American')
        self.assertEqual(essay.created, datetime.datetime(2007, 1, 19, 9, 0))
        self.assertTrue(type(essay.modified), datetime.datetime)
        self.assertEqual(essay.url, '/essays/3/')
        self.assertEqual(essay.essay_editor_url, EssayLoaderTests.ESSAYS_EDITOR_URL + '/essay/3/')
        self.assertEqual(essay.creator.name, 'Library of Congress, Washington, DC')
        self.assertTrue('<a href="http://chroniclingamerica.loc.gov/lccn/sn82016211/"><cite>Indianapolis Freeman</cite></a>' in essay.html)
示例#6
0
    def test_load_essay(self):
        e = load_essay(EssayLoaderTests.ESSAYS_EDITOR_URL + "/essay/3/", index=False)
        self.assertTrue(isinstance(e, Essay))

        # is it in the db now?
        essays = Essay.objects.all()
        self.assertEqual(len(essays), 1)

        # get an essay
        title = Title.objects.get(lccn="sn83027091")
        essay = title.essays.all()[0]

        self.assertEqual(essay.title, "Colored American")
        self.assertEqual(essay.created, datetime.datetime(2007, 1, 19, 9, 0))
        self.assertTrue(type(essay.modified), datetime.datetime)
        self.assertEqual(essay.url, "/essays/3/")
        self.assertEqual(essay.essay_editor_url, EssayLoaderTests.ESSAYS_EDITOR_URL + "/essay/3/")
        self.assertEqual(essay.creator.name, "Library of Congress, Washington, DC")
        self.assertTrue(
            '<a href="https://chroniclingamerica.loc.gov/lccn/sn82016211/"><cite>Indianapolis Freeman</cite></a>'
            in essay.html
        )
示例#7
0
    def test_load_essay(self):
        e = load_essay('http://ndnp-essays.rdc.lctl.gov/essay/3/', index=False)
        self.assertTrue(isinstance(e, Essay))

        # is it in the db now?
        essays = Essay.objects.all()
        self.assertEqual(len(essays), 1)

        # get an essay
        title = Title.objects.get(lccn='sn83027091')
        essay = title.essays.all()[0]

        self.assertEqual(essay.title, 'Colored American')
        self.assertEqual(essay.created, datetime.datetime(2007, 1, 19, 9, 0))
        self.assertTrue(type(essay.modified), datetime.datetime)
        self.assertEqual(essay.url, '/essays/3/')
        self.assertEqual(essay.essay_editor_url,
                         'http://ndnp-essays.rdc.lctl.gov/essay/3/')
        self.assertEqual(essay.creator.name,
                         'Library of Congress, Washington, DC')
        self.assertTrue(
            '<a href="http://chroniclingamerica.loc.gov/lccn/sn82016211/"><cite>Indianapolis Freeman</cite></a>'
            in essay.html)