Example #1
0
 def test_get_resources_filter_label(self, open_url_mock):
     url = 'https://api.marketplace.manifold.co/v1/resources?label=resource-1'
     mock_fixture(open_url_mock, fixture=url)
     client = ManifoldApiClient('token-123')
     self.assertListEqual(API_FIXTURES[url], client.get_resources(label='resource-1'))
     open_url_mock.assert_called_with(url,
                                      headers={'Accept': '*/*', 'Authorization': 'Bearer token-123'},
                                      http_agent='python-manifold-ansible-1.0.0')
Example #2
0
 def test_get_resources_filter_team_and_project(self, open_url_mock):
     url = 'https://api.marketplace.manifold.co/v1/resources?team_id=tid-1&project_id=pid-1'
     mock_fixture(open_url_mock, fixture=url)
     client = ManifoldApiClient('token-123')
     self.assertListEqual(API_FIXTURES[url], client.get_resources(team_id='tid-1', project_id='pid-1'))
     args, kwargs = open_url_mock.call_args
     url_called = args[0]
     # Dict order is not guaranteed, so an url may have querystring parameters order randomized
     self.assertIn('team_id=tid-1', url_called)
     self.assertIn('project_id=pid-1', url_called)