Added tests for skeleton module
continuous-integration/drone the build failed
Details
continuous-integration/drone the build failed
Details
parent
2d06c7feeb
commit
c436e12b46
|
@ -1,6 +1,4 @@
|
||||||
"""The main entrypoint of the program."""
|
"""The main entrypoint of the program."""
|
||||||
|
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
from parser import read_specs_file
|
from parser import read_specs_file
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
"""Module handling IFTTT notifications."""
|
"""Module handling IFTTT notifications."""
|
||||||
|
|
||||||
|
|
||||||
from typing import List
|
from typing import List
|
||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
"""Handles parsing a config file from disk."""
|
"""Handles parsing a config file from disk."""
|
||||||
|
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List, Union
|
from typing import List, Union
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
"""Module defining a directory-based spec."""
|
"""Module defining a directory-based spec."""
|
||||||
|
|
||||||
|
|
||||||
from .spec import Spec
|
from .spec import Spec
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
"""This module contains the base Spec class."""
|
"""This module contains the base Spec class."""
|
||||||
|
|
||||||
|
|
||||||
from pathlib import Path
|
|
||||||
from typing import Union, Dict
|
from typing import Union, Dict
|
||||||
import skeleton
|
import skeleton
|
||||||
import os
|
import os
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
"""Module defining a Docker volume-based spec."""
|
"""Module defining a Docker volume-based spec."""
|
||||||
|
|
||||||
|
|
||||||
from .spec import Spec
|
from .spec import Spec
|
||||||
from typing import Union
|
from typing import Union
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
|
@ -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
|
|
@ -1,2 +0,0 @@
|
||||||
def test_succeed():
|
|
||||||
pass
|
|
Loading…
Reference in New Issue