def testAddService(self):
        collection = getDbObject(DB)[COLLECTION]
        with self.assertRaises(ServiceAlreadyExistsException):
            obj = addService(INVALID_SERVICE_NAME, 1, ' ')
        obj_id = addService(VALID_SERVICE_NAME, 1, ' ')
        obj = collection.find_one({ID: obj_id})
        self.assertNotEqual(obj, None)

        checkGeneratedDb(self, VALID_SERVICE_NAME)
 def testServiceDeleteRequest(self):
     response = requests.delete(self.getUrl(TEST_NOT_VALID_URL))
     responseCode = response.status_code
     self.assertEquals(responseCode, VALID_RESPONSE_CODE_NOT_VALID_URL)
     addService('testservice_1', 1, 1)
     response = requests.delete(self.getUrl(TEST_URL))
     responseCode = response.status_code
     self.assertEquals(responseCode, VALID_RESPONSE_CODE)
     response = requests.get(self.getUrl(TEST_URL))
 def testServiceDeleteRequest(self):
     response = requests.delete(self.getUrl(TEST_NOT_VALID_URL))
     responseCode = response.status_code
     self.assertEquals(responseCode, VALID_RESPONSE_CODE_NOT_VALID_URL)
     addService('testservice_1', 1, 1)
     response = requests.delete(self.getUrl(TEST_URL))
     responseCode = response.status_code
     self.assertEquals(responseCode, VALID_RESPONSE_CODE)
     response = requests.get(self.getUrl(TEST_URL))
    def testAddService(self):
        collection = getDbObject(DB)[COLLECTION]
        with self.assertRaises(ServiceAlreadyExistsException):
            obj = addService(INVALID_SERVICE_NAME, 1, ' ')
        obj_id = addService(VALID_SERVICE_NAME, 1, ' ')
        obj = collection.find_one({ID: obj_id})
        self.assertNotEqual(obj, None)

        checkGeneratedDb(self, VALID_SERVICE_NAME)
Esempio n. 5
0
    def testServiceNameGetRequest(self):

        addService(TEST_SERVICE_NAME, TEST_SERVICE_LOG_SIZE,
                   TEST_SERVICE_OWNER_ID)

        response = requests.get(self.getUrl(TEST_URL))
        responseText = response.text
        responseJson = json.loads(responseText)
        responseCode = response.status_code
        self.assertEquals(responseCode, VALID_RESPONSE_CODE)
        self.assertEquals(responseJson['name'], TEST_SERVICE_NAME)
        self.assertEquals(responseJson['config']['log_size'],
                          TEST_SERVICE_LOG_SIZE)
        self.assertEquals(responseJson['owner_id'], TEST_SERVICE_OWNER_ID)

        removeService(TEST_SERVICE_NAME)

        response = requests.get(self.getUrl(TEST_URL))
        responseCode = response.status_code
        self.assertEquals(responseCode, INVALID_RESPONSE_CODE)
Esempio n. 6
0
    def testServiceNameGetRequest(self):

        addService(
            TEST_SERVICE_NAME,
            TEST_SERVICE_LOG_SIZE,
            TEST_SERVICE_OWNER_ID)

        response = requests.get(self.getUrl(TEST_URL))
        responseText = response.text
        responseJson = json.loads(responseText)
        responseCode = response.status_code
        self.assertEquals(responseCode, VALID_RESPONSE_CODE)
        self.assertEquals(responseJson['name'], TEST_SERVICE_NAME)
        self.assertEquals(
            responseJson['config']['log_size'],
            TEST_SERVICE_LOG_SIZE)
        self.assertEquals(responseJson['owner_id'], TEST_SERVICE_OWNER_ID)

        removeService(TEST_SERVICE_NAME)

        response = requests.get(self.getUrl(TEST_URL))
        responseCode = response.status_code
        self.assertEquals(responseCode, INVALID_RESPONSE_CODE)
Esempio n. 7
0
 def post(self):
     listAgrs = ServiceListParser.parsePostParameters()
     result = addService(listAgrs.get(POST_ARGS_NAME), listAgrs.get(
         POST_ARGS_LOG_SIZE), listAgrs.get(POST_ARGS_OWNER_ID))
     return dumps(result, ensure_ascii=False).encode('utf8')