Total Complexity | 2 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | # !/usr/bin/python |
||
11 | class TestItem(unittest.TestCase): |
||
12 | """ |
||
13 | Test cases for the item model for the properties |
||
14 | """ |
||
15 | |||
16 | def setUp(self): |
||
17 | """Set up the sticker to add |
||
18 | |||
19 | :return: |
||
20 | """ |
||
21 | self._sticker = Sticker( |
||
22 | name="Howling Dawn", |
||
23 | image="some_sticker_image_link", |
||
24 | wear_value=0.43092 |
||
25 | ) |
||
26 | |||
27 | def test_item(self): |
||
28 | """Test the conversion to the APIResponse object and the json.dumps |
||
29 | |||
30 | :return: |
||
31 | """ |
||
32 | item_1 = Item( |
||
33 | app_id=730, |
||
34 | class_id=12345, |
||
35 | context_id=2, |
||
36 | instance_id=54321, |
||
37 | price=109999, |
||
38 | wear_value=0.14305446, |
||
39 | image="some_item_image_link", |
||
40 | inspect_link="some_steam_inspect_link" |
||
41 | ) |
||
42 | |||
43 | item_1.add_sticker(self._sticker) |
||
44 | |||
45 | item_2 = Item( |
||
46 | app_id=730, |
||
47 | class_id=12345, |
||
48 | context_id=2, |
||
49 | instance_id=54321, |
||
50 | price=109999, |
||
51 | wear_value=0.14305446, |
||
52 | image="some_item_image_link", |
||
53 | inspect_link="some_steam_inspect_link", |
||
54 | stickers=[self._sticker] |
||
55 | ) |
||
56 | |||
57 | # check if stickers added at a later moment are added properly |
||
58 | self.assertEqual(json.dumps(item_1.__dict__), json.dumps(item_2.__dict__)) |
||
59 | |||
64 |