@@ -59,90 +59,91 @@ def setUp(self):
59
59
).objects .get_or_create (asset_incident_report_id = self .incident_report .id )
60
60
self .transition_state = self .transition_state [0 ]
61
61
62
- def test_update_asset_status_from_lost_to_available (self ):
62
+ def test_update_asset_status_from_available_to_lost (self ):
63
63
status = (
64
64
apps .get_model ("core" , "AssetStatus" )
65
65
.objects .filter (asset = self .asset )
66
66
.latest ('created_at' )
67
67
)
68
68
# update status to lost
69
- status .current_status = constants .LOST
69
+ status .current_status = constants .AVAILABLE
70
70
status .save ()
71
71
# update status to available
72
72
status = (
73
73
apps .get_model ("core" , "AssetStatus" )
74
74
.objects .filter (asset = self .asset )
75
75
.latest ('created_at' )
76
76
)
77
- status .current_status = constants .AVAILABLE
77
+ status .current_status = constants .LOST
78
78
status .save ()
79
79
# verify that transition state has been updated to closed
80
80
transition_state = apps .get_model ("core" , "StateTransition" ).objects .get (
81
81
asset_incident_report = self .incident_report
82
82
)
83
83
self .assertEqual (transition_state .incident_report_state , constants .CLOSED )
84
84
85
- def test_update_asset_status_from_damaged_to_available (self ):
85
+ def test_update_asset_status_from_available_to_damaged (self ):
86
86
status = (
87
87
apps .get_model ("core" , "AssetStatus" )
88
88
.objects .filter (asset = self .asset )
89
89
.latest ('created_at' )
90
90
)
91
91
92
92
# update status to lost
93
- status .current_status = constants .DAMAGED
93
+ status .current_status = constants .AVAILABLE
94
94
status .save ()
95
95
# update status to available
96
96
status = (
97
97
apps .get_model ("core" , "AssetStatus" )
98
98
.objects .filter (asset = self .asset )
99
99
.latest ('created_at' )
100
100
)
101
- status .current_status = constants .AVAILABLE
101
+ status .current_status = constants .DAMAGED
102
102
status .save ()
103
103
# verify that transition state has been updated to closed
104
104
transition_state = apps .get_model ("core" , "StateTransition" ).objects .get (
105
105
asset_incident_report = self .incident_report
106
106
)
107
107
self .assertEqual (transition_state .incident_report_state , constants .CLOSED )
108
108
109
- def test_update_asset_status_from_lost_to_allocated (self ):
109
+ def test_update_asset_status_from_allocated_to_lost (self ):
110
110
status = (
111
111
apps .get_model ("core" , "AssetStatus" )
112
112
.objects .filter (asset = self .asset )
113
113
.latest ('created_at' )
114
114
)
115
115
116
- # update status to lost
117
- status .current_status = constants .LOST
118
- status .save ()
119
-
120
116
# allocate asset to a user
121
117
apps .get_model ("core" , "AllocationHistory" ).objects .create (
122
118
asset = self .asset , current_assignee = self .asset_assignee2
123
119
)
124
120
121
+ # update status to lost
122
+ status .current_status = constants .LOST
123
+ status .save ()
124
+
125
125
transition_state = apps .get_model ("core" , "StateTransition" ).objects .get (
126
126
asset_incident_report = self .incident_report
127
127
)
128
128
129
129
self .assertEqual (transition_state .incident_report_state , constants .CLOSED )
130
130
131
- def test_update_asset_status_from_damaged_to_allocated (self ):
131
+ def test_update_asset_status_from_allocated_to_damaged (self ):
132
132
status = (
133
133
apps .get_model ("core" , "AssetStatus" )
134
134
.objects .filter (asset = self .asset )
135
135
.latest ('created_at' )
136
136
)
137
137
138
- # update status to lost
139
- status .current_status = constants .DAMAGED
140
- status .save ()
141
138
# allocate asset to a user
142
139
apps .get_model ("core" , "AllocationHistory" ).objects .create (
143
140
asset = self .asset , current_assignee = self .asset_assignee2
144
141
)
145
142
143
+ # update status to lost
144
+ status .current_status = constants .DAMAGED
145
+ status .save ()
146
+
146
147
transition_state = apps .get_model ("core" , "StateTransition" ).objects .get (
147
148
asset_incident_report = self .incident_report
148
149
)
0 commit comments