Jelajahi Sumber

sessions in test OK

ash 2 tahun lalu
induk
melakukan
a80be4cd78
1 mengubah file dengan 22 tambahan dan 1 penghapusan
  1. 22 1
      Backend/Tests/core_test.py

+ 22 - 1
Backend/Tests/core_test.py

@@ -42,12 +42,33 @@ def fixture2():
 
 def test_login() :
 
+    s = requests.Session()
+
+    r = s.post("http://127.0.0.1:8000/api/login",json={'username' : 'admin','password': 'aseqzdwxc'})
+    print(r.__dict__)
+    assert r.status_code == 200
+
+    r = s.get("http://127.0.0.1:8000/tab")
+    print(r.__dict__)
+    assert r.status_code == 200
 
 
-    r = requests.post("http://192.168.1.86:8000/api/login",json={'username' : 'admin','password': 'aseqzdwxc'})
+def test_inventory() :
+    s = requests.Session()
+
+    r = s.post("http://127.0.0.1:8000/api/login",json={'username' : 'admin','password': 'aseqzdwxc'})
     print(r.__dict__)
     assert r.status_code == 200
 
+    r = s.get("http://127.0.0.1:8000/tab")
+    print(r.__dict__)
+    assert r.status_code == 200
+
+
+
+
+
+