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)
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)
def create_protocol(name): """ :param name: name of protocol :return: Protocol object """ return Protocol.create_protocol(name)
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)
def get_all(): """ Get all the data if superuser. Raise exception otherwise. Parameters: Returns: data collection """ return Protocol.get_all()
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)
def test_save_protocol_object(self): protocol = Protocol(name='MQTT',created_date=datetime.datetime.now()) protocol.save()