File: test_local_minecraft_server.py

package info (click to toggle)
python-rcon 2.4.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 348 kB
  • sloc: python: 1,224; makefile: 42; sh: 6
file content (24 lines) | stat: -rw-r--r-- 621 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from unittest import TestCase
from socket import socket, AF_INET

import pytest

from rcon.source import Client

HOST: str = "localhost"
PORT: int = 25575


class TestLocalMinecraftServer(TestCase):
    def setUp(self):
        self.client = Client(HOST, PORT, passwd="test")

    @pytest.mark.skipif(
        socket(AF_INET).connect_ex((HOST, PORT)) != 0,
        reason="requires a local Minecraft server to be running",
    )
    def test_list_empty(self):
        with self.client as client:
            response = client.run("list")

        self.assertEqual(response, "There are 0 of a max of 20 players online: ")