Skip to content

Commit

Permalink
Merge pull request #230 from JacobCallahan/0.4.0
Browse files Browse the repository at this point in the history
Fixing test that assumed local inventory was blank
  • Loading branch information
JacobCallahan committed Aug 30, 2023
2 parents c67b246 + 649a83c commit ca37b3f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tests/test_broker.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
from broker import broker, Broker, helpers
from broker import broker, Broker, helpers, settings
from broker.providers import test_provider
import pytest


@pytest.fixture(scope="module")
def temp_inventory():
"""Temporarily move the local inventory, then move it back when done"""
backup_path = settings.inventory_path.rename(f"{settings.inventory_path.absolute()}.bak")
yield
settings.inventory_path.unlink()
backup_path.rename(settings.inventory_path)


def test_empty_init():
"""Broker should be able to init without any arguments"""
broker_inst = Broker()
Expand Down Expand Up @@ -50,7 +59,7 @@ def test_broker_empty_checkin():
broker_inst.checkin()


def test_broker_checkin_n_sync_empty_hostname():
def test_broker_checkin_n_sync_empty_hostname(temp_inventory):
"""Test that broker can checkin and sync inventory with a host that has empty hostname"""
broker_inst = broker.Broker(nick="test_nick")
broker_inst.checkout()
Expand Down

0 comments on commit ca37b3f

Please sign in to comment.