Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • andersharrisson/csentry
  • ics-infrastructure/csentry
2 results
Show changes
......@@ -1056,3 +1056,14 @@ def test_retrieve_groups(logged_client, ansible_group_factory):
response = logged_client.post("/network/_retrieve_groups")
groups = response.get_json()["data"]
assert {group1.name, group2.name} == set(group["name"] for group in groups)
def test_generate_excel_file(logged_client):
response = logged_client.get("/inventory/items/_generate_excel_file")
assert response.status_code == 202
assert "/status/" in response.headers["Location"]
job_id = response.headers["Location"].split("/")[-1]
task = models.Task.query.get(job_id)
assert task is not None
assert task.name == "generate_items_excel_file"
assert task.command == "app.tasks.generate_items_excel_file()"
......@@ -9,6 +9,7 @@ This module defines utils tests.
:license: BSD 2-Clause, see LICENSE for more details.
"""
import pytest
from pathlib import Path
from app import utils
......@@ -45,3 +46,17 @@ class TestUniqueFilename:
p = tmpdir.join("test")
p.write("Hello")
assert utils.unique_filename(p) == Path(tmpdir.join("test-1"))
@pytest.mark.parametrize(
"input,expected",
[
([], ""),
(["foo"], "foo"),
(["foo", "bar"], "foo"),
("hello", "hello"),
("", ""),
],
)
def test_attribute_to_string(input, expected):
assert utils.attribute_to_string(input) == expected