def test_activity_delay_large(mock_client, mock_reader): mock_reader.latest_event_time = timestamp.from_string( "2020-01-01 00:00:00") with mock.patch("bot.activity.datetime") as mock_datetime: mock_datetime.utcnow.return_value = timestamp.from_string( "2020-01-01 04:01:30") mock_datetime.side_effect = datetime assert get_activity( mock_client, mock_reader) == Game("/subscribe | 3 servers | 4 hours delay")
def test_activity_delay_small(mock_client, mock_reader): mock_reader.latest_event_time = timestamp.from_string( "2020-01-01 00:00:00") with mock.patch("bot.activity.datetime") as mock_datetime: mock_datetime.utcnow.return_value = timestamp.from_string( "2020-01-01 00:03:30") mock_datetime.side_effect = datetime # Delay is too small to be worth displaying here. assert get_activity(mock_client, mock_reader) == Game("/subscribe | 3 servers")
def test_activity_not_ready(mock_client, mock_reader): mock_client.is_ready = lambda: False assert get_activity(mock_client, mock_reader) == Game("/subscribe | Starting...")
def test_activity_singular(mock_client, mock_reader): mock_client.guilds = [object()] * 1 assert get_activity(mock_client, mock_reader) == Game("/subscribe | 1 server")
def test_activity(mock_client, mock_reader): assert get_activity(mock_client, mock_reader) == Game("/subscribe | 3 servers")
def test_activity(mock_client, mock_reader): assert get_activity(mock_client, mock_reader) == Game("+help | 3 servers")