test_describe.py (removed)

Last source

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
"""Module holding BDD tests for isshub Namespace code_repository entity."""

import pytest
from pytest import mark
from pytest_bdd import given, parsers, scenario, scenarios, then

from isshub.domain.contexts.code_repository.entities.namespace import NamespaceKind
from isshub.domain.utils.testing.validation import (
    check_field,
    check_field_not_nullable,
    check_field_nullable,
    check_field_value,
    positive_integer_only,
    string_only,
)

from .fixtures import namespace, namespace_factory


@mark.parametrize(["value", "exception"], positive_integer_only)
@scenario("../features/describe.feature", "A Namespace id is a positive integer")
def test_namespace_id_is_a_positive_integer(value, exception):
    pass


@mark.parametrize(["value", "exception"], string_only)
@scenario("../features/describe.feature", "A Namespace name is a string")
def test_namespace_name_is_a_string(value, exception):
    pass


@mark.parametrize(
    ["value", "exception"],
    [(pytest.lazy_fixture("namespace"), None), ("foo", TypeError), (1, TypeError)],
)
@scenario("../features/describe.feature", "A Namespace namespace is a Namespace")
def test_namespace_namespace_is_a_namespace(value, exception):
    pass


@mark.parametrize(
    ["value", "exception"],
    [(NamespaceKind.GROUP, None), ("foo", TypeError), (1, TypeError)],
)
@scenario("../features/describe.feature", "A Namespace kind is a NamespaceKind")
def test_namespace_kind_is_a_namespacekind(value, exception):
    pass


@mark.parametrize(["value", "exception"], string_only)
@scenario("../features/describe.feature", "A Namespace description is a string")
def test_namespace_description_is_a_string(value, exception):
    pass


scenarios("../features/describe.feature")


@given("a Namespace")
def namespace(namespace_factory):
    return namespace_factory()


@then(parsers.parse("it must have a field named {field_name:w}"))
def namespace_has_field(namespace, field_name):
    check_field(namespace, field_name)


@then(parsers.parse("its {field_name:w} must be a {field_type}"))
def namespace_field_is_of_a_certain_type(
    namespace_factory,
    field_name,
    field_type,
    # next args are for parametrize
    value,
    exception,
):
    check_field_value(namespace_factory, field_name, value, exception)


@then(parsers.parse("its {field_name:w} cannot be none"))
def namespace_field_cannot_be_none(namespace_factory, field_name):
    check_field_not_nullable(namespace_factory, field_name)


@then(parsers.parse("its {field_name:w} can be none"))
def namespace_field_can_be_none(namespace_factory, field_name):
    check_field_nullable(namespace_factory, field_name)

Changes

refactor(core): Rename core domain context to code_repository

Commit
Hash

07e279b370c0924f2b2cf32aea016b307001dfa0

Date

2019-08-15 23:31:33 +0200

Type

Renamed

New path

isshub/domain/contexts/code_repository/entities/namespace/tests/test_describe.py

Stats

+2 -2

@@ -1,10 +1,10 @@
-"""Module holding BDD tests for isshub Namespace core entity."""
+"""Module holding BDD tests for isshub Namespace code_repository entity."""

 import pytest
 from pytest import mark
 from pytest_bdd import given, parsers, scenario, scenarios, then

-from isshub.domain.contexts.core.entities.namespace import NamespaceKind
+from isshub.domain.contexts.code_repository.entities.namespace import NamespaceKind
 from isshub.domain.utils.testing.validation import (
     check_field,
     check_field_not_nullable,

feat(namespace): Add Namespace entity a description field

Commit
Hash

1568d2faf1dddc36e2b277359d355fe08cae85c5

Date

2019-06-07 21:03:51 +0200

Type

Modified

Stats

+6 -0

@@ -47,6 +47,12 @@ def test_namespace_kind_is_a_namespacekind(value, exception):
     pass


+@mark.parametrize(["value", "exception"], string_only)
+@scenario("../features/describe.feature", "A Namespace description is a string")
+def test_namespace_description_is_a_string(value, exception):
+    pass
+
+
 scenarios("../features/describe.feature")

feat(namespace): Add Namespace entity a kind field

Commit
Hash

a6b70f9e6649bbb656f3df110c0518c583e63336

Date

2019-06-07 21:03:51 +0200

Type

Modified

Stats

+10 -0

@@ -4,6 +4,7 @@ import pytest
 from pytest import mark
 from pytest_bdd import given, parsers, scenario, scenarios, then

+from isshub.domain.contexts.core.entities.namespace import NamespaceKind
 from isshub.domain.utils.testing.validation import (
     check_field,
     check_field_not_nullable,
@@ -37,6 +38,15 @@ def test_namespace_namespace_is_a_namespace(value, exception):
     pass


+@mark.parametrize(
+    ["value", "exception"],
+    [(NamespaceKind.GROUP, None), ("foo", TypeError), (1, TypeError)],
+)
+@scenario("../features/describe.feature", "A Namespace kind is a NamespaceKind")
+def test_namespace_kind_is_a_namespacekind(value, exception):
+    pass
+
+
 scenarios("../features/describe.feature")

feat(namespace): Add Namespace entity in core domain context

Commit
Hash

3a2dd3cc6f6de1fa1b03db95eaa357628824f075

Date

2019-06-07 21:03:50 +0200

Type

Added

Stats

+72 -0

@@ -0,0 +1,72 @@
+"""Module holding BDD tests for isshub Namespace core entity."""
+
+import pytest
+from pytest import mark
+from pytest_bdd import given, parsers, scenario, scenarios, then
+
+from isshub.domain.utils.testing.validation import (
+    check_field,
+    check_field_not_nullable,
+    check_field_nullable,
+    check_field_value,
+    positive_integer_only,
+    string_only,
+)
+
+from .fixtures import namespace, namespace_factory
+
+
+@mark.parametrize(["value", "exception"], positive_integer_only)
+@scenario("../features/describe.feature", "A Namespace id is a positive integer")
+def test_namespace_id_is_a_positive_integer(value, exception):
+    pass
+
+
+@mark.parametrize(["value", "exception"], string_only)
+@scenario("../features/describe.feature", "A Namespace name is a string")
+def test_namespace_name_is_a_string(value, exception):
+    pass
+
+
+@mark.parametrize(
+    ["value", "exception"],
+    [(pytest.lazy_fixture("namespace"), None), ("foo", TypeError), (1, TypeError)],
+)
+@scenario("../features/describe.feature", "A Namespace namespace is a Namespace")
+def test_namespace_namespace_is_a_namespace(value, exception):
+    pass
+
+
+scenarios("../features/describe.feature")
+
+
+@given("a Namespace")
+def namespace(namespace_factory):
+    return namespace_factory()
+
+
+@then(parsers.parse("it must have a field named {field_name:w}"))
+def namespace_has_field(namespace, field_name):
+    check_field(namespace, field_name)
+
+
+@then(parsers.parse("its {field_name:w} must be a {field_type}"))
+def namespace_field_is_of_a_certain_type(
+    namespace_factory,
+    field_name,
+    field_type,
+    # next args are for parametrize
+    value,
+    exception,
+):
+    check_field_value(namespace_factory, field_name, value, exception)
+
+
+@then(parsers.parse("its {field_name:w} cannot be none"))
+def namespace_field_cannot_be_none(namespace_factory, field_name):
+    check_field_not_nullable(namespace_factory, field_name)
+
+
+@then(parsers.parse("its {field_name:w} can be none"))
+def namespace_field_can_be_none(namespace_factory, field_name):
+    check_field_nullable(namespace_factory, field_name)