def test_get_by_user(self, mock_get, mock_u_get, mock_u_pods): services = helpers.Services() mock_u_get.return_value = helpers.User mock_u_pods.return_value = [{'id': 'pod_id'}] services.get_by_user(3) mock_get.assert_called_once_with( [helpers.LABEL_SELECTOR_PODS.format('pod_id')])
def test_get_by_type_with_condition_list(self, mock_get): services = helpers.Services('public') services.get_by_type(conditions=['condition1']) mock_get.assert_called_once_with( ['condition1', helpers.LABEL_SELECTOR_TYPE.format('public')])
def test_get_by_type(self, mock_get): services = helpers.Services('public') services.get_by_type() mock_get.assert_called_once_with( [helpers.LABEL_SELECTOR_TYPE.format('public')])
def test_get_all(self, mock_get): services = helpers.Services() services.get_all() mock_get.assert_called_once_with([])
def test_get(self, mock_get): services = helpers.Services() mock_get.return_value = self.SERVICES svc = services._get() self.assertEqual(svc, self.SERVICES['items'])
def test_get_label_selector(self): services = helpers.Services() conditions = ['test1, test2'] rv = services._get_label_selector(conditions) self.assertEqual(rv, 'test1, test2') self.assertEqual('', services._get_label_selector([]))
def test_get_by_pod_list(self, mock_get): services = helpers.Services() services.get_by_pods(('pod_id', 'pod_id2')) mock_get.assert_called_once_with( [helpers.LABEL_SELECTOR_PODS.format('pod_id, pod_id2')])