Esempio n. 1
0
    def send_message(self):
        """
        this is an actual task executed by locust framework, you can have mutiple tasks within
        one task set, in that case if you want to have some form of controlling execution
        ration of those tasks, that can done via weight argument

            :Example
            @task(1)
            def func1(self):
                .....

            @task(2)
            def func2(self):
                .....

        func2 will be executed twice more often than func1

        To programmatically stop execution of taskset can be achieved by raising StopLocust exception
        :return: None
        """

        if self.is_task_ready():
            headers = Headers.get_auth_json_header(self.user.access_token)
            data = {
                'roomId': self.room['id'],
                'text': 'This is message from Locust task'
            }

            logging.debug('Headers user are: %s', headers)

            self.post(path='messages', data=data, headers=headers)
        else:
            raise StopLocust('Task is not ready')
Esempio n. 2
0
    def send_messages(self):
        headers = Headers.get_auth_json_header(self.user)
        data = {
            'roomId': '%s' % self.room['id'],
            'text': 'Hello World %s' % Utils.randomString(10)
        }

        self.client.post('/messages', data=json.dumps(data), headers=headers)
    def create_memberships(self):
        headers = Headers.get_auth_json_header(
            self.user['token']['access_token'])
        data = {
            'roomId': '%s' % self.room['id'],
            'personEmail': Api.generate_email_address()
        }

        self.client.post('/messages', data=json.dumps(data), headers=headers)
Esempio n. 4
0
    def updateRoom(self):
        headers = Headers.get_auth_json_header(self.user.access_token)
        data = {
            'title': 'Room %s is a different room' % Utils.randomString(10)
        }

        self.client.put('/rooms/%s' % self.room['id'],
                        data=json.dumps(data),
                        headers=headers)
Esempio n. 5
0
    def get_messages(self):
        headers = Headers.get_auth_json_header(self.user.access_token)

        self.client.get('/messages', headers=headers)
    def get_membership_list(self):
        headers = Headers.get_auth_json_header(
            self.user['token']['access_token'])

        self.client.get('/memberships', headers=headers)
Esempio n. 7
0
    def create_room(self):
        headers = Headers.get_auth_json_header(self.user.access_token)
        data = {'title': 'Room %s is a good room' % Utils.randomString(10)}

        self.client.post('/rooms', data=json.dumps(data), headers=headers)
Esempio n. 8
0
 def get_room_details(self):
     headers = Headers.get_auth_json_header(self.user.access_token)
     self.client.get('/rooms/%s' % self.room['id'], headers=headers)
Esempio n. 9
0
 def get_room_list(self):
     headers = Headers.get_auth_json_header(self.user.access_token)
     self.client.get('/rooms', headers=headers)