Share workshop stock and track order handoffs
This commit is contained in:
1 parent
ddd31b2626
commit
7f9dea623b
24 files changed
+877
-126
No files matched your search
+27
-4
@@ -61,16 +61,17 @@ class RealHTTPTests(unittest.TestCase):
|
||||
self.alice.post("/bestellung/hinzufuegen/", payload)
|
||||
self.bob.post("/bestellung/hinzufuegen/", payload | {"quantity": 1})
|
||||
html = self.bob.get("/bestellung/")[1]
|
||||
self.assertIn('class="quantity">3</td>', html)
|
||||
self.assertIn("synthetic-one: <strong>2</strong>", html)
|
||||
self.assertIn("synthetic-two: <strong>1</strong>", html)
|
||||
self.assertIn("Bestellwunsch · synthetic-one", html)
|
||||
self.assertIn("Bestellwunsch · synthetic-two", html)
|
||||
self.assertIn('class="quantity">2</td>', html)
|
||||
self.assertIn('class="quantity">1</td>', html)
|
||||
css = re.search(r'href="(/static/[^"]+\.css)"', html).group(1)
|
||||
self.assertEqual(self.alice.get(css)[0], 200)
|
||||
self.assertIn("text/css", self.alice.get(css)[2]["Content-Type"])
|
||||
self.server.stop()
|
||||
self.server.start()
|
||||
self.assertIn('class="quantity">3</td>', self.alice.get("/bestand/")[1])
|
||||
self.assertIn('class="quantity">3</td>', self.bob.get("/bestellung/")[1])
|
||||
self.assertIn("Bestellwunsch · synthetic-one", self.bob.get("/bestellung/")[1])
|
||||
print(
|
||||
"HTTP: separate logins, private stock, 2+1 aggregation, CSS and Gunicorn restart verified."
|
||||
)
|
||||
@@ -88,3 +89,25 @@ class RealHTTPTests(unittest.TestCase):
|
||||
self.assertEqual(list(pool.map(add, clients)), [200] * 6)
|
||||
self.assertIn('class="quantity">6</td>', self.alice.get("/bestand/")[1])
|
||||
print("HTTP: six simultaneous additions, one position, quantity six verified.")
|
||||
|
||||
def test_member_can_share_and_revoke_stock_from_profile(self):
|
||||
payload = self.selection(2)
|
||||
self.alice.post("/bestand/hinzufuegen/", payload)
|
||||
shared = "/bestand/geteilt/"
|
||||
link = f'href="{shared}"'
|
||||
self.assertNotIn(link, self.bob.get("/bestand/")[1])
|
||||
self.assertNotIn('class="quantity">2</td>', self.bob.get(shared)[1])
|
||||
|
||||
self.alice.post("/profil/", {"share_inventory": "on", "first_name": "Private Example"})
|
||||
self.assertIn(link, self.bob.get("/bestand/")[1])
|
||||
status, html, headers, _ = self.bob.get(shared)
|
||||
self.assertEqual(status, 200)
|
||||
self.assertIn("synthetic-one", html)
|
||||
self.assertIn('class="quantity">2</td>', html)
|
||||
self.assertNotIn("Private Example", html)
|
||||
self.assertNotIn("data-consume", html)
|
||||
self.assertIn("no-store", headers["Cache-Control"])
|
||||
|
||||
self.alice.post("/profil/", {})
|
||||
self.assertNotIn('class="quantity">2</td>', self.bob.get(shared)[1])
|
||||
self.assertNotIn(link, self.bob.get("/bestand/")[1])
|
||||
Reference in new issue
Block a user