DR695H | 303fda1 | 2019-09-19 12:24:38 -0400 | [diff] [blame^] | 1 | # Copyright 2019 AT&T Intellectual Property. All rights reserved. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | import requests_mock |
| 16 | from unittest import TestCase |
| 17 | from unittest import main |
| 18 | |
| 19 | from ONAPLibrary.SO import SO |
| 20 | |
| 21 | |
| 22 | class SOTests(TestCase): |
| 23 | |
| 24 | def test_get(self): |
| 25 | with requests_mock.mock() as m: |
| 26 | so = SO() |
| 27 | m.get('http://test.com/', text='data') |
| 28 | resp = so.run_get_request(endpoint="http://test.com", data_path="/", |
| 29 | accept="application/json", auth={"user", "pass"}) |
| 30 | self.assertEqual("data", resp.text) |
| 31 | |
| 32 | if __name__ == '__main__': |
| 33 | main() |