@@ -30,16 +30,55 @@ def test_remove_required_constraint():
3030 from flask_restplus import Namespace
3131
3232 ns = Namespace ('todos' , description = 'Namespace for testing' )
33- sample_model = ns .model ('Todo' , {
34- 'id' : fields .Integer (readonly = True , description = 'The task unique identifier' ),
35- 'task' : fields .String (required = True , description = 'The task details' ),
36- 'done' : fields .Boolean (required = False , description = 'Has it being done or not' )
37- })
33+ sample_model = ns .model (
34+ 'Todo' ,
35+ {
36+ 'id' : fields .Integer (
37+ readonly = True , description = 'The task unique identifier'
38+ ),
39+ 'task' : fields .String (
40+ required = True , description = 'The task details'
41+ ),
42+ 'done' : fields .Boolean (
43+ required = False , description = 'Has it being done or not'
44+ ),
45+ },
46+ )
3847
3948 new_model = remove_required_constraint (sample_model )
4049
4150 assert new_model is not sample_model
4251
4352 for attrib in sample_model :
44- assert new_model [attrib ].required is False , "No attribute should be required"
45- assert new_model [attrib ] is not sample_model [attrib ], "No attribute should be required"
53+ assert (
54+ new_model [attrib ].required is False
55+ ), "No attribute should be required"
56+ assert (
57+ new_model [attrib ] is not sample_model [attrib ]
58+ ), "No attribute should be required"
59+
60+
61+ def test_add_update_last_entry_flag ():
62+ from time_tracker_api .api import add_update_last_entry_flag
63+ from flask_restplus import fields
64+ from flask_restplus import Namespace
65+
66+ ns = Namespace ('todos' , description = 'Namespace for testing' )
67+ sample_model = ns .model (
68+ 'Todo' ,
69+ {
70+ 'id' : fields .Integer (
71+ readonly = True , description = 'The task unique identifier'
72+ ),
73+ 'task' : fields .String (
74+ required = True , description = 'The task details'
75+ ),
76+ },
77+ )
78+
79+ new_model = add_update_last_entry_flag (sample_model )
80+
81+ assert new_model is not sample_model
82+
83+ update_last_entry_flag = new_model .get ('update_last_entry' )
84+ assert update_last_entry_flag is not None
0 commit comments