File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
layer/nrlf/core/dynamodb/tests Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ import pytest
2+
3+ from nrlf .core .constants import PointerTypes
4+ from nrlf .core .dynamodb .repository import _get_sk_ids_for_type
5+
6+
7+ def test_get_sk_ids_for_type_exception_thrown_for_invalid_type ():
8+ with pytest .raises (ValueError ) as error :
9+ _get_sk_ids_for_type ("invalid_type" )
10+
11+ assert str (error .value ) == "Cannot find category for pointer type: invalid_type"
12+
13+
14+ def test_get_sk_ids_for_type_returns_type_and_category_for_every_type ():
15+ for each in PointerTypes .list ():
16+ category , type = _get_sk_ids_for_type (each )
17+ assert category and type
18+
19+
20+ def test_get_sk_ids_for_type_exception_thrown_if_new_type_has_no_category ():
21+ pointer_types = PointerTypes .list ()
22+ pointer_types .append ("some_pointer_type" )
23+ with pytest .raises (ValueError ) as error :
24+ for each in pointer_types :
25+ category , type = _get_sk_ids_for_type (each )
26+ assert category and type
27+
28+ assert (
29+ str (error .value ) == "Cannot find category for pointer type: some_pointer_type"
30+ )
31+
32+
33+ # TODO: Add unit tests for Repository Class
You can’t perform that action at this time.
0 commit comments