Skip to content

Commit

Permalink
configured miqsel test
Browse files Browse the repository at this point in the history
Signed-off-by: Nikhil Dhandre <[email protected]>
  • Loading branch information
digitronik committed Apr 19, 2019
1 parent 35704ef commit cf51525
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import os
from subprocess import Popen, PIPE

import pytest


@pytest.fixture(scope="module")
def config():
"""Configured miqsel"""
if not os.path.isdir("conf"):
os.mkdir("conf")
path = os.path.join(os.getcwd(), "conf")
proc = Popen(["miqsel", "config"], stdin=PIPE, stdout=PIPE)
input = str.encode("{}\n\n\n\n\n".format(path))
proc.communicate(input=input)
yield
if os.path.isdir("conf"):
os.rmdir("conf")
8 changes: 8 additions & 0 deletions tests/test_status.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import subprocess


Expand Down Expand Up @@ -27,9 +28,16 @@ def test_miqsel_help():

def test_miqsel_unconfigured():
"""Check Status of unconfigured miqsel"""
os.system("rm -rf ~/.config/miqsel/conf.yml")
out, err, returncode = miqsel_cmd("miqsel status")
assert returncode == 0
assert (
out.strip()
== "Please run command from project directory or set project directory with config"
)


def test_miqsel_configured(config):
out, err, returncode = miqsel_cmd("miqsel status")
assert returncode == 0
assert out.strip() == "Not running..."

0 comments on commit cf51525

Please sign in to comment.