def test_add_unknown_connector_with_ROOT_group(self, clear_data): data = parse_request( "post_connectors", { "$name": random_string(), "$url": "http://" + random_string(), "$groupId": root_group_id() }) response = Session.post(TestConnectors.url, data['request']) print(response.json()) assert response.status_code == 200 clear_data.append(response.json()['rid']) assert equal_schema(response.json(), data['schema'])
def test_add_connector_with_empty_url(self): data = parse_request("post_connectors", { "$name": random_string(), "$url": None, "$groupId": root_group_id() }) response = Session.post(TestConnectors.url, data['request']) print(response.json()) expected_result = { 'SMC_VALIDATION_CONNECTOR_URL': "Connector url mustn't be empty" } assert (response.status_code, response.json()) == (400, expected_result)
def test_edit_connector_without_name(self, connector): data = parse_request( "put_connectors", { "$rid": connector['rid'], "$name": None, "$url": "http://" + random_string(), "$groupId": root_group_id() }) response = Session.put(TestConnectors.url, data['request']) print(response.json()) expected_response = { 'SMC_VALIDATION_CONNECTOR_NAME': "Connector name mustn't be empty" } assert (response.status_code, response.json()) == (400, expected_response)
def test_add_connector_with_existing_URL(self, connector): existing_url = connector['url'] data = parse_request( "post_connectors", { "$name": random_string(), "$url": existing_url, "$groupId": root_group_id() }) response = Session.post(TestConnectors.url, data['request']) print(response.json()) expected_result = { 'SMC_VALIDATION_CONNECTOR_URL_UNIQUE': "Connector url must be unique" } assert (response.status_code, response.json()) == (400, expected_result)
def test_edit_connector_with_random_rid(self): random_rid = random_string() data = parse_request( "put_connectors", { "$rid": random_rid, "$name": random_string(), "$url": "http://" + random_string(), "$groupId": root_group_id() }) response = Session.put(TestConnectors.url, data['request']) print(response.json()) expected_response = { 'UNMAPPED_EXCEPTION': 'SMCRequestException: Connector with rid=%s not found' % random_rid } assert (response.status_code, response.json()) == (500, expected_response)