Exemplo n.º 1
0
def showall():
    form = SearchLicenseForm()
    search_results = None
    search_results = models.get_license()
    if form.validate_on_submit():
        search_results = models.get_license(
            software_name=form.software_name.data, end_date=form.end_date.data)
    return render_template('showall.html',
                           form=form,
                           search_results=search_results)
Exemplo n.º 2
0
 def test_del(self):
     '''
     Test del_license function
     '''
     get_lic = models.get_license(software_name=software_name)
     for i in get_lic: 
         self.assertEqual(models.del_license(key_id=i.key_id), True)
Exemplo n.º 3
0
def delete_license(id, approve):
    '''
    Delete a license from the database
    '''
    form = SearchLicenseForm()
    if approve == 1:
        models.del_license(id)
    search_results = models.get_license(id)
    return render_template('delete.html',
                           search_results=search_results,
                           form=form)
Exemplo n.º 4
0
def add():
    form = AddLicenseForm()
    search_results = None
    if form.validate_on_submit():
        models.add_license(software_name=form.software_name.data,
                           key=form.key.data,
                           folder=form.folder.data,
                           version=form.version.data,
                           start_date=form.start_date.data,
                           end_date=form.end_date.data,
                           user=form.user.data,
                           comment=form.comment.data,
                           count=form.count.data)
        search_results = models.get_license(
            software_name=form.software_name.data)
    return render_template('add.html',
                           search_results=search_results,
                           form=form)
Exemplo n.º 5
0
def change_license(id):
    '''
    Change a license in the database
    '''
    form = ChangeLicenseForm()
    search_results = models.get_license(key_id=id)
    if form.validate_on_submit():
        models.change_license(id,
                              software_name=form.software_name.data,
                              key=form.key.data,
                              folder=form.folder.data,
                              version=form.version.data,
                              start_date=form.start_date.data,
                              end_date=form.end_date.data,
                              user=form.user.data,
                              comment=form.comment.data)
        return redirect(id)
    return render_template('change.html',
                           search_results=search_results,
                           form=form)
Exemplo n.º 6
0
 def test_add_get(self):
     models.add_license(software_name=software_name, key=key, folder=folder, start_date=start_date, end_date=end_date)
     get_lic = models.get_license(software_name=software_name)
     for i in get_lic:
         self.assertEqual(i.key, "test-key")