| @@ 119-150 (lines=32) @@ | ||
| 116 | ||
| 117 | self.assertTrue(result) |
|
| 118 | ||
| 119 | @httpretty.httprettified |
|
| 120 | def test_fake_bad_auth_http(self): |
|
| 121 | """ |
|
| 122 | Tests authenticating against APRS-IS using an invalid call+pass. |
|
| 123 | """ |
|
| 124 | httpretty.HTTPretty.register_uri( |
|
| 125 | httpretty.HTTPretty.POST, |
|
| 126 | self.fake_server, |
|
| 127 | status=401 |
|
| 128 | ) |
|
| 129 | ||
| 130 | aprs_conn = apex.aprs.aprs_internet_service.AprsInternetService( |
|
| 131 | user=self.fake_callsign, |
|
| 132 | input_url=self.fake_server |
|
| 133 | ) |
|
| 134 | aprs_conn.connect() |
|
| 135 | ||
| 136 | # msg = '>'.join([ |
|
| 137 | # self.fake_callsign, |
|
| 138 | # 'APRS,TCPIP*:=3745.00N/12227.00W-Simulated Location' |
|
| 139 | # ]) |
|
| 140 | msg = { |
|
| 141 | 'source': self.fake_callsign, |
|
| 142 | 'destination': 'APRS', |
|
| 143 | 'path': ['TCPIP*'], |
|
| 144 | 'text': '=3745.00N/12227.00W-Simulated Location' |
|
| 145 | } |
|
| 146 | self.logger.debug(locals()) |
|
| 147 | ||
| 148 | result = aprs_conn.send(msg, protocol='HTTP') |
|
| 149 | ||
| 150 | self.assertFalse(result) |
|
| 151 | ||
| 152 | @unittest.skip('Test only works with real server.') |
|
| 153 | def test_more(self): |
|
| @@ 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 = '>'.join([ |
|
| 104 | # self.fake_callsign, |
|
| 105 | # 'APRS,TCPIP*:=3745.00N/12227.00W-Simulated Location' |
|
| 106 | # ]) |
|
| 107 | msg = { |
|
| 108 | 'source': self.fake_callsign, |
|
| 109 | 'destination': 'APRS', |
|
| 110 | 'path': ['TCPIP*'], |
|
| 111 | 'text': '=3745.00N/12227.00W-Simulated Location' |
|
| 112 | } |
|
| 113 | self.logger.debug(locals()) |
|
| 114 | ||
| 115 | result = aprs_conn.send(msg) |
|
| 116 | ||
| 117 | self.assertTrue(result) |
|
| 118 | ||
| 119 | @httpretty.httprettified |
|
| 120 | def test_fake_bad_auth_http(self): |
|