File tree 2 files changed +17
-14
lines changed
section6/video_code/tests 2 files changed +17
-14
lines changed Original file line number Diff line number Diff line change 4
4
5
5
6
6
class StoreTest (BaseTest ):
7
+ def test_create_store (self ):
8
+ store = StoreModel ('test' )
9
+ self .assertListEqual (store .items .all (), [],
10
+ "The store's items length was not 0 even though no items were added." )
11
+
7
12
def test_crud (self ):
8
13
with self .app_context ():
9
14
store = StoreModel ('test' )
@@ -29,3 +34,15 @@ def test_store_relationship(self):
29
34
30
35
self .assertEqual (store .items .count (), 1 )
31
36
self .assertEqual (store .items .first ().name , 'test_item' )
37
+
38
+ def test_store_json (self ):
39
+ store = StoreModel ('test' )
40
+ expected = {
41
+ 'name' : 'test' ,
42
+ 'items' : []
43
+ }
44
+
45
+ self .assertEqual (
46
+ store .json (),
47
+ expected ,
48
+ "The JSON export of the store is incorrect. Received {}, expected {}." .format (store .json (), expected ))
Original file line number Diff line number Diff line change @@ -8,17 +8,3 @@ def test_create_store(self):
8
8
9
9
self .assertEqual (store .name , 'test' ,
10
10
"The name of the store after creation does not equal the constructor argument." )
11
- self .assertListEqual (store .items .all (), [],
12
- "The store's items length was not 0 even though no items were added." )
13
-
14
- def test_store_json (self ):
15
- store = StoreModel ('test' )
16
- expected = {
17
- 'name' : 'test' ,
18
- 'items' : []
19
- }
20
-
21
- self .assertEqual (
22
- store .json (),
23
- expected ,
24
- "The JSON export of the store is incorrect. Received {}, expected {}." .format (store .json (), expected ))
You can’t perform that action at this time.
0 commit comments