Added tests for skeleton module
continuous-integration/drone the build failed Details

pull/15/head
Jef Roosens 2021-04-26 19:57:54 +02:00
parent 2d06c7feeb
commit c436e12b46
Signed by: Jef Roosens
GPG Key ID: B580B976584B5F30
9 changed files with 69 additions and 15 deletions

View File

@ -1,6 +1,4 @@
"""The main entrypoint of the program."""
import argparse
import sys
from parser import read_specs_file

View File

@ -1,6 +1,4 @@
"""Module handling IFTTT notifications."""
from typing import List
import os
import requests

View File

@ -1,6 +1,4 @@
"""Handles parsing a config file from disk."""
import yaml
from pathlib import Path
from typing import List, Union

View File

@ -1,6 +1,4 @@
"""Module defining a directory-based spec."""
from .spec import Spec
from pathlib import Path
from typing import Union

View File

@ -1,7 +1,4 @@
"""This module contains the base Spec class."""
from pathlib import Path
from typing import Union, Dict
import skeleton
import os

View File

@ -1,6 +1,4 @@
"""Module defining a Docker volume-based spec."""
from .spec import Spec
from typing import Union
from pathlib import Path

View File

View File

@ -0,0 +1,69 @@
"""Tests for the skeleton module."""
from app.skeleton import merge
def test_merge_empty():
"""Test correct response for an empty merge."""
assert merge() == {}
def test_merge_single():
"""Test merge command with a single input."""
assert merge({}) == {}
dic = {"test": "value", "test2": "value2"}
assert merge(dic) == dic
def test_merge_double_no_overlap():
"""Test merge command with two non-overlapping inputs."""
d1 = {"test": "value", "test2": "value2"}
d2 = {"test3": "value3"}
d_res = {"test": "value", "test2": "value2", "test3": "value3"}
assert merge(d1, d2) == d_res
def test_merge_double_overlap():
"""Test merge command with two overlapping inputs."""
d1 = {"test": "value", "test2": "value2"}
d2 = {"test2": "value3"}
d_res = {"test": "value", "test2": "value3"}
assert merge(d1, d2) == d_res
def test_merge_triple_no_overlap():
"""Test merge command with three non-overlapping inputs.
This test tells us that the recursion works.
"""
d1 = {"test": "value", "test2": "value2"}
d2 = {"test3": "value3"}
d3 = {"test4": "value4"}
d_res = {
"test": "value",
"test2": "value2",
"test3": "value3",
"test4": "value4",
}
assert merge(d1, d2, d3) == d_res
def test_merge_triple_overlap():
"""Test merge command with three overlapping inputs.
This test tells us that the recursion works.
"""
d1 = {"test": "value", "test2": "value2"}
d2 = {"test3": "value3"}
d3 = {"test2": "value4"}
d_res = {
"test": "value",
"test2": "value4",
"test3": "value3",
}
assert merge(d1, d2, d3) == d_res

View File

@ -1,2 +0,0 @@
def test_succeed():
pass