def roo_id_to_current_issues(id): roo = last_switcharoo.get_roo(id) if roo.submission: issues = check_errors(reddit, last_switcharoo, roo, submission=roo.submission) else: issues = check_errors(reddit, last_switcharoo, roo, comment=roo.comment) for i in issues: print(i)
def test_normal(self): reddit = praw.Reddit(username=credentials['reddit']['username']) global last_switcharoo last_switcharoo = reset_database(reddit, last_switcharoo) previous_roo, previous_url, previous_submission = gen_url_and_roo( reddit, last_switcharoo, "sub1", "user1", "000000", "aaaaaa", "123abcd", 3, datetime(month=4, day=1, year=2021)) roo, url, submission = gen_url_and_roo(reddit, last_switcharoo, "sub1", "user1", "000001", "aaaaab", "123abce", 3, datetime(month=4, day=2, year=2021), init_db=True) reddit.comment("123abce", f"[Ah the ol' Reddit switcharoo!]({previous_url})", "user1", datetime(month=4, day=2, year=2020)) expected_tracker = IssueTracker() tracker = check_errors(reddit, last_switcharoo, roo, init_db=True, submission=submission) self.assertTrue(tracker == expected_tracker)
def test_sub_privated_allowed(self): reddit = praw.Reddit(username=credentials['reddit']['username']) global last_switcharoo last_switcharoo = reset_database(reddit, last_switcharoo) last_switcharoo.update_privated_sub("sub2", allowed=True, update_requested=False) previous_roo, previous_url, previous_submission = gen_url_and_roo( reddit, last_switcharoo, "sub1", "user1", "000000", "aaaaaa", "123abcd", 3, datetime(month=4, day=1, year=2021)) roo, url, submission = gen_url_and_roo( reddit, last_switcharoo, "sub2", "user1", "000001", "aaaaab", "123abce", 3, datetime(month=4, day=2, year=2021)) reddit.submission("aaaaab").private = True reddit.comment("123abce", f"[Ah the ol' Reddit switcharoo!]({previous_url})", "user1", datetime(month=4, day=2, year=2020), private=True) tracker = check_errors(reddit, last_switcharoo, roo, init_db=False, submission=submission) self.assertTrue(tracker is None)