| @@ 209-235 (lines=27) @@ | ||
| 206 | ||
| 207 | self.assertTrue(result) |
|
| 208 | ||
| 209 | @httpretty.httprettified |
|
| 210 | def test_fake_bad_auth_http(self): |
|
| 211 | """ |
|
| 212 | Tests authenticating against APRS-IS using an invalid call+pass. |
|
| 213 | """ |
|
| 214 | httpretty.HTTPretty.register_uri( |
|
| 215 | httpretty.HTTPretty.POST, |
|
| 216 | self.fake_server, |
|
| 217 | status=401 |
|
| 218 | ) |
|
| 219 | ||
| 220 | aprs_conn = apex.aprs.aprs_internet_service.AprsInternetService( |
|
| 221 | user=self.fake_callsign, |
|
| 222 | input_url=self.fake_server |
|
| 223 | ) |
|
| 224 | aprs_conn.connect() |
|
| 225 | ||
| 226 | msg = { |
|
| 227 | 'source': self.fake_callsign, |
|
| 228 | 'destination': 'APRS', |
|
| 229 | 'path': ['TCPIP*'], |
|
| 230 | 'text': '=3745.00N/12227.00W-Simulated Location' |
|
| 231 | } |
|
| 232 | ||
| 233 | result = aprs_conn.send(msg, protocol='HTTP') |
|
| 234 | ||
| 235 | self.assertFalse(result) |
|
| 236 | ||
| 237 | @unittest.skip('Test only works with real server.') |
|
| 238 | def test_more(self): |
|
| @@ 181-207 (lines=27) @@ | ||
| 178 | self.assertEqual(full_callsign, 'W2GMD') |
|
| 179 | ||
| 180 | if sys.version_info < (3, 0): |
|
| 181 | @httpretty.httprettified |
|
| 182 | def test_fake_good_auth(self): |
|
| 183 | """ |
|
| 184 | Tests authenticating against APRS-IS using a valid call+pass. |
|
| 185 | """ |
|
| 186 | httpretty.HTTPretty.register_uri( |
|
| 187 | httpretty.HTTPretty.POST, |
|
| 188 | self.fake_server, |
|
| 189 | status=204 |
|
| 190 | ) |
|
| 191 | ||
| 192 | aprs_conn = apex.aprs.aprs_internet_service.AprsInternetService( |
|
| 193 | user=self.fake_callsign, |
|
| 194 | input_url=self.fake_server |
|
| 195 | ) |
|
| 196 | aprs_conn.connect() |
|
| 197 | ||
| 198 | msg = { |
|
| 199 | 'source': self.fake_callsign, |
|
| 200 | 'destination': 'APRS', |
|
| 201 | 'path': ['TCPIP*'], |
|
| 202 | 'text': '=3745.00N/12227.00W-Simulated Location' |
|
| 203 | } |
|
| 204 | ||
| 205 | result = aprs_conn.send(msg) |
|
| 206 | ||
| 207 | self.assertTrue(result) |
|
| 208 | ||
| 209 | @httpretty.httprettified |
|
| 210 | def test_fake_bad_auth_http(self): |
|