Example #1
0
    def test_get_protocol_all(self):
        protocol = Protocol(name='MQTT', created_date=datetime.datetime.now())
        protocol.save()

        results = protocol_query.get_all()

        for result in results:
            print(result.name)
Example #2
0
    def test_update_protocol_(self):
        protocol = Protocol(name='MQTT', created_date=datetime.datetime.now())
        protocol.save()

        result = protocol_query.get_by_name('MQTT')

        print(result.name)
        result.name = 'MQTT2'
        result.save()
        
        results_update = protocol_query.get_all()

        for result in results_update:
            print(result.name)
Example #3
0
def create_protocol(name):
    """

    :param name: name of protocol
    :return: Protocol object
    """
    return Protocol.create_protocol(name)
Example #4
0
def get_by_id(protocol_id):
    """ Return protocol object with the given id.

        Parameters:
            protocol_id:

        Returns: protocol object
    """
    return Protocol.get_by_id(protocol_id)
Example #5
0
def get_all():
    """ Get all the data if superuser. Raise exception otherwise.

    Parameters:


    Returns: data collection
    """
    return Protocol.get_all()
Example #6
0
def get_by_name(protocol_name):
    """ Return protocol object with the name protocol.

        Parameters:
            protocol_name:

        Returns: protocol object
    """
    return Protocol.get_by_name(protocol_name)
Example #7
0
 def test_save_protocol_object(self):
     protocol = Protocol(name='MQTT',created_date=datetime.datetime.now())
     protocol.save()