def testSimpleObjects(self): ns_config_dict = NamespaceConfig('ns_name').build() self.assertEqual(ns_config_dict['metadata']['name'], 'ns_name') role_config_dict = RoleConfig( 'mars-pod-reader', 'ns_name', '', 'pods', 'get,watch,list').build() self.assertEqual(role_config_dict['metadata']['name'], 'mars-pod-reader') self.assertIn('get', role_config_dict['rules'][0]['verbs']) role_binding_config_dict = RoleBindingConfig( 'mars-pod-reader-binding', 'ns_name', 'mars-pod-reader', 'default').build() self.assertEqual(role_binding_config_dict['metadata']['name'], 'mars-pod-reader-binding') service_config_dict = ServiceConfig( 'mars-test-service', 'NodePort', 'mars/service-type=marsscheduler', 7103, 7103).build() self.assertEqual(service_config_dict['metadata']['name'], 'mars-test-service')
def test_simple_objects(): ns_config_dict = NamespaceConfig('ns_name').build() assert ns_config_dict['metadata']['name'] == 'ns_name' role_config_dict = RoleConfig('mars-pod-reader', 'ns_name', '', 'pods', 'get,watch,list').build() assert role_config_dict['metadata']['name'] == 'mars-pod-reader' assert 'get' in role_config_dict['rules'][0]['verbs'] role_binding_config_dict = RoleBindingConfig('mars-pod-reader-binding', 'ns_name', 'mars-pod-reader', 'default').build() assert role_binding_config_dict['metadata'][ 'name'] == 'mars-pod-reader-binding' service_config_dict = ServiceConfig('mars-test-service', 'NodePort', 'mars/service-type=marssupervisor', 7103, 7103).build() assert service_config_dict['metadata']['name'] == 'mars-test-service'