Exemplo n.º 1
0
 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')])
Exemplo n.º 2
0
 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')])
Exemplo n.º 3
0
 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')])
Exemplo n.º 4
0
 def test_get_all(self, mock_get):
     services = helpers.Services()
     services.get_all()
     mock_get.assert_called_once_with([])
Exemplo n.º 5
0
 def test_get(self, mock_get):
     services = helpers.Services()
     mock_get.return_value = self.SERVICES
     svc = services._get()
     self.assertEqual(svc, self.SERVICES['items'])
Exemplo n.º 6
0
 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([]))
Exemplo n.º 7
0
 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')])