コード例 #1
0
    async def test_get_concurrent_reserves(self):

        self.supboards = []
        for i in range(8):
            start_time = time(10 + i)
            user = User(f"Firstname{i}", phone_number="+7777")
            user.lastname = f"Lastname{i}"
            user.telegram_id = int(str(i) * 8)
            start_date = date.today()
            supboard = Supboard(user,
                                start_date=start_date,
                                start_time=start_time,
                                set_count=(i + 1),
                                count=(i % 3))
            self.supboards.append(supboard)
            self.adapter.append_data(supboard)

        supboard = self.supboards[1]
        supboard.set_count = 3
        rows = list(self.adapter.get_concurrent_reserves(self.supboards[1]))

        passed, alert = self.assert_params(len(rows), 2)
        assert passed, alert
コード例 #2
0
ファイル: t_user.py プロジェクト: alex13th/WakeBot
    async def test_set_properties(self):
        user = User("Firstname")
        user.firstname = "Newname"
        user.lastname = "Lastname1"
        user.middlename = "Middlename1"
        user.displayname = "Displayname1"
        user.phone_number = "+7999555443311"
        user.telegram_id = 1234
        user.user_id = 9876

        passed, alert = self.assert_params(user.firstname, "Newname")
        assert passed, alert
        passed, alert = self.assert_params(user.lastname, "Lastname1")
        assert passed, alert
        passed, alert = self.assert_params(user.middlename, "Middlename1")
        assert passed, alert
        passed, alert = self.assert_params(user.displayname, "Displayname1")
        assert passed, alert
        passed, alert = self.assert_params(user.phone_number, "+7999555443311")
        assert passed, alert
        passed, alert = self.assert_params(user.telegram_id, 1234)
        assert passed, alert
        passed, alert = self.assert_params(user.user_id, 9876)
        assert passed, alert
コード例 #3
0
ファイル: t_wake.py プロジェクト: alex13th/WakeBot
    async def test_get_concurrent_count(self):

        self.wakes = []
        for i in range(8):
            start_time = time(10 + i)
            user = User(f"Firstname{i}", phone_number="+7777")
            user.lastname = f"Lastname{i}"
            user.telegram_id = int(str(i) * 8)
            start_date = date.today()
            wake = Wake(user,
                        start_date=start_date,
                        start_time=start_time,
                        set_count=(i + 1))
            wake.board = i % 2
            wake.hydro = i % 3
            self.wakes.append(wake)
            self.adapter.append_data(wake)

        wake = self.wakes[1]
        wake.set_count = 10
        count = self.adapter.get_concurrent_count(self.wakes[1])

        passed, alert = self.assert_params(count, 2)
        assert passed, alert