12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- import os
- from time import sleep
- os.chdir(os.path.dirname(__file__))
- import sys
- sys.path.append("..")
- sys.path.append("..\\Sources")
- from Sources.Modules.Inventory.inventory import * #altered
- import Sources.main as main_func
- import Sources.Model.model_manager as model_manager
- import requests
- from werkzeug.security import generate_password_hash
- import Sources.View.view_manager as view
- item_id_to_delete = 0
- import threading
- import pytest
- from pytest import Module, Session
- @pytest.fixture(autouse=True,scope='session')
- def fixture2():
- def run() :
- main_func.init()
- persistence.wipeout_database()
- persistence.init()
- model_manager.init()
- main_func.main()
- t1 = threading.Thread(target=run)
- t1.start()
- while(not main_func.isRunning()) :
- sleep(1)
- yield
- main_func.stop()
- t1.join()
- # Perform cleanup on the data when the test function exits
- def test_login() :
- r = requests.post("http://192.168.1.86:8000/api/login",json={'username' : 'admin','password': 'aseqzdwxc'})
- print(r.__dict__)
- assert r.status_code == 200
|