Skip to content

UAS RPL - Perubahan kecil untuk PR #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 40 additions & 7 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,47 @@
import os
from flask import Flask
from flask import Flask, render_template, request, redirect, url_for, session

app = Flask(__name__)
app.secret_key = 'rahasia' # untuk session

# Data login dummy
USER_CREDENTIALS = {
'admin': 'admin'
}

@app.route("/")
def main():
return "Welcome!"
def index():
return render_template("login.html")

@app.route("/login", methods=["POST"])
def login():
username = request.form["username"]
password = request.form["password"]
if username in USER_CREDENTIALS and USER_CREDENTIALS[username] == password:
session['user'] = username
return redirect(url_for('dashboard'))
return "Login gagal! <a href='/'>Coba lagi</a>"

@app.route("/dashboard")
def dashboard():
if 'user' not in session:
return redirect(url_for('index'))
return render_template("dashboard.html")

@app.route("/create", methods=["GET", "POST"])
def create():
if 'user' not in session:
return redirect(url_for('index'))
if request.method == "POST":
nama = request.form["nama"]
jumlah = request.form["jumlah"]
print(f"Data disimpan: {nama}, jumlah: {jumlah}")
return render_template("success.html")
return render_template("create.html")

@app.route('/how are you')
def hello():
return 'I am good, how about you?'
@app.route("/logout")
def logout():
session.pop('user', None)
return render_template("logout.html")

if __name__ == "__main__":
app.run(host="0.0.0.0", port=8080)
15 changes: 15 additions & 0 deletions docs/uml/class-diagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@startuml class-diagram
class User {
+id: int
+name: str
+login()
}

class Item {
+id: int
+title: str
+create()
}

User --> Item : owns
@enduml
13 changes: 13 additions & 0 deletions docs/uml/sequence-create-item.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@startuml sequence-create-item
actor User
participant "Create Item Page" as ItemPage
participant "routes.py" as Route
participant "models.py" as ItemModel

User -> ItemPage : open form
User -> ItemPage : input item data
ItemPage -> Route : POST /create
Route -> ItemModel : save new item
ItemModel --> Route : success
Route --> ItemPage : show confirmation
@enduml
17 changes: 17 additions & 0 deletions docs/uml/sequence-login.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@startuml sequence-login
actor User
participant "Login Page" as LoginPage
participant "routes.py" as Route
participant "models.py" as UserModel

User -> LoginPage : open form
User -> LoginPage : input username & password
LoginPage -> Route : POST /login
Route -> UserModel : validate_user()
UserModel --> Route : user exists or not
alt valid
Route --> LoginPage : redirect to dashboard
else invalid
Route --> LoginPage : show error
end
@enduml
18 changes: 18 additions & 0 deletions evaluasi/blackbox/hasil-blackbox.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Hasil Black-Box Testing – UAS RPL

### ✅ Test 1 – Login
- Input: admin / admin
- Expected: Masuk dashboard
- Result: ✅ Pass

### ✅ Test 2 – Tambah Item
- Input: "Item Baru"
- Expected: Redirect ke halaman sukses
- Result: ✅ Pass

### ✅ Test 3 – Logout
- Action: Klik tombol logout
- Expected: Redirect ke login
- Result: ✅ Pass

### File Selenium IDE: `uas-blackbox.side`
Loading