def test_stabilityOfMultipleSidebarUpdatesWithLiveData(self): r = praw.Reddit(user_agent='r/starcraft event tracker') originalSidebar = functions.liquipediaStringToSidebar("starcraft2", open('lpevents.txt', 'r').readlines()) newTable = functions.getCurrentLiquipediaEventsForSidebar("starcraft2") firstSidebar = functions.subEventTableIntoSidebar(originalSidebar, newTable) secondSidebar = functions.subEventTableIntoSidebar(firstSidebar, newTable) self.assertEqual(firstSidebar, secondSidebar)
def test_subEventTableIntoSidebar(self): oldSidebar = "**Event List**\n\n| table|\n| cells|\n\n" expectedSidebar = "**Event List**\n\nnew table text\n\n" newTable = "new table text\n" newSidebar = functions.subEventTableIntoSidebar(oldSidebar, newTable) self.assertEqual(newSidebar, expectedSidebar)
def test_subEventTableIntoSidebarReal(self): oldSidebar = open('sidebar.old.txt', 'r').read() expectedSidebar = open('sidebar.new.txt', 'r').read() newTable = open('newtable.txt', 'r').read() newSidebar = functions.subEventTableIntoSidebar(oldSidebar, newTable) self.assertEqual(newSidebar, expectedSidebar)