Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BattlefieldDuck committed Mar 15, 2024
1 parent eb7e47d commit 060568b
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
# But do not ignore terms.md
!terms.md

# Ignore all tests files
tests/

# Ignore all log files
*.log

Expand Down
Empty file added tests/__init__.py
Empty file.
19 changes: 19 additions & 0 deletions tests/test_beammp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import pytest

from protocols import MasterServer, BeamMP


@pytest.fixture
def instance():
return BeamMP()


def test_job(instance: MasterServer):
assert instance.job() is None


def test_find(instance: MasterServer):
server = instance.collection.find_one()
host, port = server['ip'], server['port']
result = instance.find(host=host, port=port)
assert result['ip'] == host and result['port'] == port
19 changes: 19 additions & 0 deletions tests/test_factorio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import pytest

from protocols import MasterServer, Factorio


@pytest.fixture
def instance():
return Factorio()


def test_job(instance: MasterServer):
assert instance.job() is None


def test_find(instance: MasterServer):
server = instance.collection.find_one()
host, port = str(server['host_address']).split(':')
result = instance.find(host=host, port=port)
assert server['host_address'] == result['host_address']
19 changes: 19 additions & 0 deletions tests/test_front.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import pytest

from protocols import MasterServer, Front


@pytest.fixture
def instance():
return Front()


def test_job(instance: MasterServer):
assert instance.job() is None


def test_find(instance: MasterServer):
server = instance.collection.find_one()
host, port = server['addr'], server['port']
result = instance.find(host=host, port=port)
assert result['addr'] == host and result['port'] == port
19 changes: 19 additions & 0 deletions tests/test_palworld.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import pytest

from protocols import MasterServer, Palworld


@pytest.fixture
def instance():
return Palworld()


def test_job(instance: MasterServer):
assert instance.job() is None


def test_find(instance: MasterServer):
server = instance.collection.find_one()
host, port = server['address'], server['port']
result = instance.find(host=host, port=port)
assert result['address'] == host and result['port'] == port
19 changes: 19 additions & 0 deletions tests/test_scum.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import pytest

from protocols import MasterServer, Scum


@pytest.fixture
def instance():
return Scum()


def test_job(instance: MasterServer):
assert instance.job() is None


def test_find(instance: MasterServer):
server = instance.collection.find_one()
host, port = server['ip'], server['port']
result = instance.find(host=host, port=port)
assert result['ip'] == host and result['port'] == port

0 comments on commit 060568b

Please sign in to comment.