| @@ 119-150 (lines=32) @@ | ||
| 116 | def test_fake_bad_auth_http(self): |
|
| 117 | """ |
|
| 118 | Tests authenticating against APRS-IS using an invalid call+pass. |
|
| 119 | """ |
|
| 120 | httpretty.HTTPretty.register_uri( |
|
| 121 | httpretty.HTTPretty.POST, |
|
| 122 | self.fake_server, |
|
| 123 | status=401 |
|
| 124 | ) |
|
| 125 | ||
| 126 | aprs_conn = apex.aprs.aprs_internet_service.AprsInternetService( |
|
| 127 | user=self.fake_callsign, |
|
| 128 | input_url=self.fake_server |
|
| 129 | ) |
|
| 130 | aprs_conn.connect() |
|
| 131 | ||
| 132 | msg = { |
|
| 133 | 'source': self.fake_callsign, |
|
| 134 | 'destination': 'APRS', |
|
| 135 | 'path': ['TCPIP*'], |
|
| 136 | 'text': '=3745.00N/12227.00W-Simulated Location' |
|
| 137 | } |
|
| 138 | self.logger.debug(locals()) |
|
| 139 | ||
| 140 | result = aprs_conn.send(msg, protocol='HTTP') |
|
| 141 | ||
| 142 | self.assertFalse(result) |
|
| 143 | ||
| 144 | @unittest.skip('Test only works with real server.') |
|
| 145 | def test_more(self): |
|
| 146 | """ |
|
| 147 | Tests APRS-IS binding against a real APRS-IS server. |
|
| 148 | """ |
|
| 149 | aprs_conn = apex.aprs.aprs_internet_service.AprsInternetService( |
|
| 150 | user=self.real_callsign, |
|
| 151 | input_url=self.real_server |
|
| 152 | ) |
|
| 153 | aprs_conn.connect() |
|
| @@ 86-117 (lines=32) @@ | ||
| 83 | ) |
|
| 84 | ||
| 85 | if sys.version_info < (3, 0): |
|
| 86 | @httpretty.httprettified |
|
| 87 | def test_fake_good_auth(self): |
|
| 88 | """ |
|
| 89 | Tests authenticating against APRS-IS using a valid call+pass. |
|
| 90 | """ |
|
| 91 | httpretty.HTTPretty.register_uri( |
|
| 92 | httpretty.HTTPretty.POST, |
|
| 93 | self.fake_server, |
|
| 94 | status=204 |
|
| 95 | ) |
|
| 96 | ||
| 97 | aprs_conn = apex.aprs.aprs_internet_service.AprsInternetService( |
|
| 98 | user=self.fake_callsign, |
|
| 99 | input_url=self.fake_server |
|
| 100 | ) |
|
| 101 | aprs_conn.connect() |
|
| 102 | ||
| 103 | msg = { |
|
| 104 | 'source': self.fake_callsign, |
|
| 105 | 'destination': 'APRS', |
|
| 106 | 'path': ['TCPIP*'], |
|
| 107 | 'text': '=3745.00N/12227.00W-Simulated Location' |
|
| 108 | } |
|
| 109 | self.logger.debug(locals()) |
|
| 110 | ||
| 111 | result = aprs_conn.send(msg) |
|
| 112 | ||
| 113 | self.assertTrue(result) |
|
| 114 | ||
| 115 | @httpretty.httprettified |
|
| 116 | def test_fake_bad_auth_http(self): |
|
| 117 | """ |
|
| 118 | Tests authenticating against APRS-IS using an invalid call+pass. |
|
| 119 | """ |
|
| 120 | httpretty.HTTPretty.register_uri( |
|