Example #1
0
    def test_logs_yesterday(self):
        self.input.group = lambda x: [None, 'yesterday'][x]
        apertium_wiki.logs(self.phenny, self.input)
        out = self.phenny.say.call_args[0][0]
        string_check = "Log at " in out

        if string_check:
            url = out[7:]
            out_check = str(date.today() - timedelta(1)) in out
        self.assertTrue(string_check and out_check)
Example #2
0
    def test_logs_yesterday(self):
        self.input.group = lambda x: [None, 'yesterday'][x]
        apertium_wiki.logs(self.phenny, self.input)
        out = self.phenny.say.call_args[0][0]
        string_check = "Log at " in out

        if string_check:
            url = out[7:]
            out_check = str(date.today() - timedelta(1)) in out
        self.assertTrue(string_check and out_check)
Example #3
0
    def test_logs_bad_date(self):
        self.input.group = lambda x: [None, '99/99/9999'][x]
        apertium_wiki.logs(self.phenny, self.input)
        out = self.phenny.say.call_args[0][0]
        string_check = "Log at " in out

        if string_check:
            url = out[7:]
            day_query = str(date(9999, 99, 99))
            out_check = day_query in out
        self.assertFalse(string_check and out_check)
Example #4
0
    def test_logs_good_date(self):
        self.input.group = lambda x: [None, '10/23/2018'][x]
        apertium_wiki.logs(self.phenny, self.input)
        out = self.phenny.say.call_args[0][0]
        string_check = "Log at " in out

        if string_check:
            url = out[7:]
            day_query = str(date(2018, 10, 23))
            out_check = day_query in out
        self.assertTrue(string_check and out_check)
Example #5
0
    def test_logs_last_week(self):
        self.input.group = lambda x: [None, 'last monday'][x]
        apertium_wiki.logs(self.phenny, self.input)
        out = self.phenny.say.call_args[0][0]
        string_check = "Log at " in out

        if string_check:
            url = out[7:]
            last_mon = str(date.today() + timedelta(-7 - date.today().weekday()))
            out_check = last_mon in out
            self.assertTrue(string_check and out_check)
Example #6
0
    def test_logs_bad_date(self):
        self.input.group = lambda x: [None, '99/99/9999'][x]
        apertium_wiki.logs(self.phenny, self.input)
        out = self.phenny.say.call_args[0][0]
        string_check = "Log at " in out

        if string_check:
            url = out[7:]
            day_query = str(date(9999, 99, 99))
            out_check = day_query in out
        self.assertFalse(string_check and out_check)
Example #7
0
    def test_logs_good_date(self):
        self.input.group = lambda x: [None, '10/23/2018'][x]
        apertium_wiki.logs(self.phenny, self.input)
        out = self.phenny.say.call_args[0][0]
        string_check = "Log at " in out

        if string_check:
            url = out[7:]
            day_query = str(date(2018, 10, 23))
            out_check = day_query in out
        self.assertTrue(string_check and out_check)
Example #8
0
    def test_logs_last_week(self):
        self.input.group = lambda x: [None, 'last monday'][x]
        apertium_wiki.logs(self.phenny, self.input)
        out = self.phenny.say.call_args[0][0]
        string_check = "Log at " in out

        if string_check:
            url = out[7:]
            last_mon = str(date.today() + timedelta(-7 - date.today().weekday()))
            out_check = last_mon in out
            self.assertTrue(string_check and out_check)
Example #9
0
    def test_logs_no_date(self):
        self.input.group = lambda x: [None, None][x]
        apertium_wiki.logs(self.phenny, self.input)
        out = self.phenny.say.call_args[0][0]

        self.assertTrue(('Log at ' in out) and (not out.endswith('.log')))
    def test_logs_no_date(self):
        self.input.group = lambda x: [None, None][x]
        apertium_wiki.logs(self.phenny, self.input)
        out = self.phenny.say.call_args[0][0]

        self.assertTrue(('Log at ' in out) and (not out.endswith('.log')))