def create_outgoing_stock(stock, project_id, date, quantity, username): """Takes arguments and create a new record for outgoing stocks.""" db.connect() OutgoingStock.create(stock=stock, project_id=project_id, date=date, quantity=quantity, username=username) db.close()
def test_create_outgoing(self): """Create an outgoing record.""" Category.create(category_id='001', description='Testing Stock') Project.create(project_id='001', project_description="Testing") Role.create(role_name='Admin') User.create(first_name='Jay', second_name='Palm', phone='9783978223', role='Admin', username='******', password='******', email='*****@*****.**') create_stock('001', 'Testing stock', 1, '001', 9.99) create_outgoing_stock(stock='001', project_id='001', date="2015-07-22", quantity='7', username='******') OutgoingStock.get(OutgoingStock.stock == '001').delete_instance() Stock.get(Stock.category == '001').delete_instance() User.get(User.username == 'JayPalm').delete_instance() Role.get(Role.role_name == 'Admin').delete_instance() Project.get(Project.project_id == '001').delete_instance() Category.get(Category.category_id == '001').delete_instance()