@@ -17,7 +17,6 @@ func TestAccessPoint_ConfigureTeamWifi(t *testing.T) {
17
17
var request configurationRequest
18
18
wifiStatuses := [6 ]* TeamWifiStatus {{}, {}, {}, {}, {}, {}}
19
19
ap .SetSettings ("dummy" , "password1" , 123 , true , wifiStatuses )
20
- ap .Status = "INITIAL"
21
20
22
21
// Mock the radio API server.
23
22
radioServer := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
@@ -77,7 +76,7 @@ func TestAccessPoint_ConfigureTeamWifi(t *testing.T) {
77
76
if assert .NotNil (t , err ) {
78
77
assert .Contains (t , err .Error (), "returned status 507: oh noes" )
79
78
}
80
- assert .Equal (t , "INITIAL " , ap .Status )
79
+ assert .Equal (t , "CONFIGURING " , ap .Status )
81
80
}
82
81
83
82
func TestAccessPoint_updateMonitoring (t * testing.T ) {
@@ -148,3 +147,23 @@ func TestAccessPoint_updateMonitoring(t *testing.T) {
148
147
}
149
148
assert .Equal (t , "ERROR" , ap .Status )
150
149
}
150
+
151
+ func TestAccessPoint_statusMatchesLastConfiguration (t * testing.T ) {
152
+ var ap AccessPoint
153
+ wifiStatuses := [6 ]* TeamWifiStatus {{}, {}, {}, {}, {}, {}}
154
+ ap .SetSettings ("dummy" , "" , 123 , true , wifiStatuses )
155
+
156
+ assert .True (t , ap .statusMatchesLastConfiguration ())
157
+ team1 := & model.Team {Id : 254 , WpaKey : "11111111" }
158
+ team2 := & model.Team {Id : 1678 , WpaKey : "22222222" }
159
+ ap .ConfigureTeamWifi ([6 ]* model.Team {nil , team1 , nil , team2 , nil , nil })
160
+ assert .False (t , ap .statusMatchesLastConfiguration ())
161
+ ap .TeamWifiStatuses [1 ].TeamId = 254
162
+ assert .False (t , ap .statusMatchesLastConfiguration ())
163
+ ap .TeamWifiStatuses [3 ].TeamId = 1677
164
+ assert .False (t , ap .statusMatchesLastConfiguration ())
165
+ ap .TeamWifiStatuses [3 ].TeamId = 1678
166
+ assert .True (t , ap .statusMatchesLastConfiguration ())
167
+ ap .TeamWifiStatuses [4 ].TeamId = 111
168
+ assert .False (t , ap .statusMatchesLastConfiguration ())
169
+ }
0 commit comments