Exemple #1
0
 def test_valid_user_settings_json(self):
     with open(get_resource_file("test_user_settings.json"), 'r') as fp:
         mock_json = json.load(fp)
         responses.add(responses.GET,
                       'https://wallhaven.cc/api/v1/settings',
                       status=200,
                       json=mock_json)
         w = Wallhaven(api_key='testkeyisinvalid')
         settings = w.get_user_settings()
         self.assertIsInstance(settings, UserSettings)
         self.assertEqual(dataclasses.asdict(settings), mock_json['data'])
Exemple #2
0
 def test_without_api_key(self):
     w = Wallhaven()
     with self.assertRaises(AttributeError):
         w.get_user_settings()