From 0ea13cdadde0ac4f98747a66a7b68378af86b7a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Mon, 7 Aug 2017 08:24:45 +0200 Subject: [PATCH] API improvements (#13) --- .../dashboard/marks/MarksFragment.java | 8 +- .../wulkanowy/activity/main/LoginTask.java | 6 +- .../wulkanowy/api/StudentAndParent.java | 66 +++++----- .../github/wulkanowy/api/grades/Grades.java | 28 ----- .../wulkanowy/api/grades/GradesList.java | 15 +-- .../github/wulkanowy/api/grades/Subject.java | 4 +- .../wulkanowy/api/grades/SubjectsList.java | 16 +-- .../io/github/wulkanowy/api/login/Login.java | 13 +- .../wulkanowy/api/notes/AchievementsList.java | 12 +- .../io/github/wulkanowy/api/notes/Notes.java | 33 ----- .../github/wulkanowy/api/notes/NotesList.java | 9 +- .../github/wulkanowy/api/school/School.java | 32 ----- .../wulkanowy/api/school/SchoolInfo.java | 9 +- .../wulkanowy/api/school/TeachersInfo.java | 11 +- .../wulkanowy/api/timetable/Lesson.java | 14 +++ .../github/wulkanowy/api/timetable/Table.java | 19 +-- .../wulkanowy/api/timetable/Timetable.java | 33 ----- .../wulkanowy/api/user/AddressData.java | 6 +- .../wulkanowy/api/user/BasicInformation.java | 41 +++--- .../wulkanowy/api/user/ContactDetails.java | 6 +- .../wulkanowy/api/user/FamilyInformation.java | 42 +++++++ .../wulkanowy/api/user/FamilyMember.java | 59 +++++++++ .../wulkanowy/api/user/PersonalData.java | 60 +++++---- .../io/github/wulkanowy/api/user/User.java | 33 ----- .../wulkanowy/api/StudentAndParentTest.java | 31 ++++- .../wulkanowy/api/grades/GradesListTest.java | 30 +---- .../wulkanowy/api/grades/GradesTest.java | 26 ++++ .../api/grades/SubjectsListTest.java | 83 ++++++++++++ .../github/wulkanowy/api/login/LoginTest.java | 4 +- .../api/notes/AchievementsListTest.java | 29 ++--- .../wulkanowy/api/notes/NotesListTest.java | 47 +++---- .../wulkanowy/api/school/SchoolInfoTest.java | 2 +- .../wulkanowy/api/school/SchoolTest.java | 4 +- .../api/school/TeachersInfoTest.java | 2 +- .../wulkanowy/api/timetable/TableTest.java | 30 +++-- .../api/user/BasicInformationTest.java | 50 ++++++++ .../api/user/FamilyInformationTest.java | 39 ++++++ .../github/wulkanowy/api/user/UserTest.java | 29 +++++ .../OcenyWszystkie-subjects-average.html | 70 +++++++++++ .../api/grades/OcenyWszystkie-subjects.html | 64 ++++++++++ .../api/user/UczenDanePodstawowe.html | 119 ++++++++++++++++++ 41 files changed, 829 insertions(+), 405 deletions(-) delete mode 100644 app/src/main/java/io/github/wulkanowy/api/grades/Grades.java delete mode 100644 app/src/main/java/io/github/wulkanowy/api/notes/Notes.java delete mode 100644 app/src/main/java/io/github/wulkanowy/api/school/School.java delete mode 100644 app/src/main/java/io/github/wulkanowy/api/timetable/Timetable.java create mode 100644 app/src/main/java/io/github/wulkanowy/api/user/FamilyInformation.java create mode 100644 app/src/main/java/io/github/wulkanowy/api/user/FamilyMember.java delete mode 100644 app/src/main/java/io/github/wulkanowy/api/user/User.java create mode 100644 app/src/test/java/io/github/wulkanowy/api/grades/GradesTest.java create mode 100644 app/src/test/java/io/github/wulkanowy/api/grades/SubjectsListTest.java create mode 100644 app/src/test/java/io/github/wulkanowy/api/user/BasicInformationTest.java create mode 100644 app/src/test/java/io/github/wulkanowy/api/user/FamilyInformationTest.java create mode 100644 app/src/test/java/io/github/wulkanowy/api/user/UserTest.java create mode 100644 app/src/test/resources/io/github/wulkanowy/api/grades/OcenyWszystkie-subjects-average.html create mode 100644 app/src/test/resources/io/github/wulkanowy/api/grades/OcenyWszystkie-subjects.html create mode 100644 app/src/test/resources/io/github/wulkanowy/api/user/UczenDanePodstawowe.html diff --git a/app/src/main/java/io/github/wulkanowy/activity/dashboard/marks/MarksFragment.java b/app/src/main/java/io/github/wulkanowy/activity/dashboard/marks/MarksFragment.java index 3f3da013a..43620affc 100644 --- a/app/src/main/java/io/github/wulkanowy/activity/dashboard/marks/MarksFragment.java +++ b/app/src/main/java/io/github/wulkanowy/activity/dashboard/marks/MarksFragment.java @@ -19,7 +19,6 @@ import java.util.Map; import io.github.wulkanowy.R; import io.github.wulkanowy.api.Cookies; import io.github.wulkanowy.api.StudentAndParent; -import io.github.wulkanowy.api.grades.Grades; import io.github.wulkanowy.api.grades.GradesList; import io.github.wulkanowy.api.grades.Subject; import io.github.wulkanowy.api.grades.SubjectsList; @@ -93,8 +92,8 @@ public class MarksFragment extends Fragment { Account account = accountsDatabase.getAccount(mContext.getSharedPreferences("LoginData", mContext.MODE_PRIVATE).getLong("isLogin", 0)); accountsDatabase.close(); - StudentAndParent snp = new StudentAndParent(cookies, account.getCounty()).setUp(); - SubjectsList subjectsList = new SubjectsList(snp.getCookiesObject(), snp); + StudentAndParent snp = new StudentAndParent(cookies, account.getCounty()); + SubjectsList subjectsList = new SubjectsList(snp); SubjectsDatabase subjectsDatabase = new SubjectsDatabase(mContext); subjectsDatabase.open(); @@ -106,8 +105,7 @@ public class MarksFragment extends Fragment { subjectsName.add(subject.getName()); } - Grades gradesObject = new Grades(snp.getCookiesObject(), snp); - GradesList gradesList = new GradesList(gradesObject, snp); + GradesList gradesList = new GradesList(snp); GradesDatabase gradesDatabase = new GradesDatabase(mContext); gradesDatabase.open(); gradesDatabase.put(gradesList.getAll()); diff --git a/app/src/main/java/io/github/wulkanowy/activity/main/LoginTask.java b/app/src/main/java/io/github/wulkanowy/activity/main/LoginTask.java index 889407841..2f86af6c0 100644 --- a/app/src/main/java/io/github/wulkanowy/activity/main/LoginTask.java +++ b/app/src/main/java/io/github/wulkanowy/activity/main/LoginTask.java @@ -22,7 +22,6 @@ import io.github.wulkanowy.api.login.Login; import io.github.wulkanowy.api.login.LoginErrorException; import io.github.wulkanowy.api.user.BasicInformation; import io.github.wulkanowy.api.user.PersonalData; -import io.github.wulkanowy.api.user.User; import io.github.wulkanowy.database.accounts.Account; import io.github.wulkanowy.database.accounts.AccountsDatabase; import io.github.wulkanowy.security.CryptoException; @@ -80,9 +79,8 @@ public class LoginTask extends AsyncTask { if (save) { try { StudentAndParent snp = new StudentAndParent(login.getCookiesObject(), - credentials[2]).setUp(); - User user = new User(snp.getCookiesObject(), snp); - BasicInformation userInfo = new BasicInformation(user, snp); + credentials[2]); + BasicInformation userInfo = new BasicInformation(snp); PersonalData personalData = userInfo.getPersonalData(); String firstAndLastName = personalData.getFirstAndLastName(); diff --git a/app/src/main/java/io/github/wulkanowy/api/StudentAndParent.java b/app/src/main/java/io/github/wulkanowy/api/StudentAndParent.java index 02103cf07..ab00a2e44 100644 --- a/app/src/main/java/io/github/wulkanowy/api/StudentAndParent.java +++ b/app/src/main/java/io/github/wulkanowy/api/StudentAndParent.java @@ -9,8 +9,6 @@ import org.jsoup.select.Elements; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import io.github.wulkanowy.api.login.LoginErrorException; @@ -18,32 +16,22 @@ public class StudentAndParent extends Vulcan { private String startPageUrl = "https://uonetplus.vulcan.net.pl/{locationID}/Start.mvc/Index"; - private String gradesPageUrl = "https://uonetplus-opiekun.vulcan.net.pl/{locationID}/{ID}/" - + "Oceny/Wszystkie"; + private String baseUrl = "https://uonetplus-opiekun.vulcan.net.pl/{locationID}/{ID}/"; + + private String gradesPageUrl = baseUrl + "Oceny/Wszystkie"; private String locationID = ""; - private String uonetPlusOpiekunUrl = ""; + private String id = ""; - public StudentAndParent(Cookies cookies, String locID) throws IOException { + public StudentAndParent(Cookies cookies, String locID) throws IOException, LoginErrorException { this.cookies = cookies; this.locationID = locID; - } - - public String getGradesPageUrl() { - return gradesPageUrl; - } - - public StudentAndParent setUp() throws IOException { - startPageUrl = startPageUrl.replace("{locationID}", locationID); // get link to uonetplus-opiekun.vulcan.net.pl module - Document startPage = Jsoup.connect(startPageUrl) - .followRedirects(true) - .cookies(getCookies()) - .get(); + Document startPage = getPageByUrl(startPageUrl.replace("{locationID}", locationID)); Element studentTileLink = startPage.select(".panel.linkownia.pracownik.klient > a").first(); - uonetPlusOpiekunUrl = studentTileLink.attr("href"); + String uonetPlusOpiekunUrl = studentTileLink.attr("href"); //get context module cookie Connection.Response res = Jsoup.connect(uonetPlusOpiekunUrl) @@ -53,39 +41,42 @@ public class StudentAndParent extends Vulcan { cookies.addItems(res.cookies()); - return this; + this.id = getCalculatedID(uonetPlusOpiekunUrl); + this.baseUrl = baseUrl + .replace("{locationID}", getLocationID()) + .replace("{ID}", getID()); } public String getLocationID() { return locationID; } - public String getID() throws LoginErrorException { - Pattern pattern = Pattern.compile("([0-9]{6})"); - Matcher matcher = pattern.matcher(uonetPlusOpiekunUrl); + public String getID() { + return id; + } - // Finds all the matches until found by moving the `matcher` forward - if (!matcher.find()) { + public String getCalculatedID(String uonetPlusOpiekunUrl) throws LoginErrorException { + String[] path = uonetPlusOpiekunUrl.split("vulcan.net.pl/")[1].split("/"); + + if (4 != path.length) { throw new LoginErrorException(); } - String match = matcher.group(1); - - return match; + return path[1]; } public String getRowDataChildValue(Element e, int index) { - return e.select(".daneWiersz .wartosc").get(index - 1).text(); + Elements es = e.select(".daneWiersz .wartosc"); + + return es.get(index - 1).text(); } - public List getSemesters() throws IOException, LoginErrorException { - String url = getGradesPageUrl(); - url = url.replace("{locationID}", getLocationID()); - url = url.replace("{ID}", getID()); + public Document getSnPPageDocument(String url) throws IOException { + return getPageByUrl(baseUrl + url); + } - Document gradesPage = getPageByUrl(url); - - return getSemesters(gradesPage); + public List getSemesters() throws IOException { + return getSemesters(getSnPPageDocument(gradesPageUrl)); } public List getSemesters(Document gradesPage) { @@ -108,8 +99,7 @@ public class StudentAndParent extends Vulcan { return semesters; } - public Semester getCurrentSemester(List semesterList) - throws IOException, LoginErrorException { + public Semester getCurrentSemester(List semesterList) { Semester current = null; for (Semester s : semesterList) { if (s.isCurrent()) { diff --git a/app/src/main/java/io/github/wulkanowy/api/grades/Grades.java b/app/src/main/java/io/github/wulkanowy/api/grades/Grades.java deleted file mode 100644 index aef658b37..000000000 --- a/app/src/main/java/io/github/wulkanowy/api/grades/Grades.java +++ /dev/null @@ -1,28 +0,0 @@ -package io.github.wulkanowy.api.grades; - -import org.jsoup.nodes.Document; - -import java.io.IOException; - -import io.github.wulkanowy.api.Cookies; -import io.github.wulkanowy.api.StudentAndParent; -import io.github.wulkanowy.api.Vulcan; -import io.github.wulkanowy.api.login.LoginErrorException; - -public class Grades extends Vulcan { - - private StudentAndParent snp = null; - - public Grades(Cookies cookies, StudentAndParent snp) { - this.cookies = cookies; - this.snp = snp; - } - - //TODO: move to snp - public Document getGradesPageDocument(String url) throws IOException, LoginErrorException { - return getPageByUrl(url - .replace("{locationID}", snp.getLocationID()) - .replace("{ID}", snp.getID()) - ); - } -} diff --git a/app/src/main/java/io/github/wulkanowy/api/grades/GradesList.java b/app/src/main/java/io/github/wulkanowy/api/grades/GradesList.java index 559acc2e6..0c76a4abc 100644 --- a/app/src/main/java/io/github/wulkanowy/api/grades/GradesList.java +++ b/app/src/main/java/io/github/wulkanowy/api/grades/GradesList.java @@ -17,16 +17,13 @@ import io.github.wulkanowy.api.login.LoginErrorException; public class GradesList extends Vulcan { - private Grades grades = null; private StudentAndParent snp = null; - private String gradesPageUrl = "https://uonetplus-opiekun.vulcan.net.pl/{locationID}/{ID}" - + "/Oceny/Wszystkie?details=2&okres="; + private String gradesPageUrl = "Oceny/Wszystkie?details=2&okres="; - private List gradesList = new ArrayList<>(); + private List grades = new ArrayList<>(); - public GradesList(Grades grades, StudentAndParent snp) { - this.grades = grades; + public GradesList(StudentAndParent snp) { this.snp = snp; } @@ -39,7 +36,7 @@ public class GradesList extends Vulcan { } public List getAll(String semester) throws IOException, LoginErrorException { - Document gradesPage = grades.getGradesPageDocument(getGradesPageUrl() + semester); + Document gradesPage = snp.getSnPPageDocument(getGradesPageUrl() + semester); Elements gradesRows = gradesPage.select(".ocenySzczegoly-table > tbody > tr"); Semester currentSemester = snp.getCurrentSemester(snp.getSemesters(gradesPage)); @@ -57,7 +54,7 @@ public class GradesList extends Vulcan { .attr("style")); String color = matcher.find() ? matcher.group(1) : ""; - gradesList.add(new Grade() + grades.add(new Grade() .setSubject(row.select("td:nth-child(1)").text()) .setValue(row.select("td:nth-child(2)").text()) .setColor(color) @@ -70,6 +67,6 @@ public class GradesList extends Vulcan { ); } - return gradesList; + return grades; } } diff --git a/app/src/main/java/io/github/wulkanowy/api/grades/Subject.java b/app/src/main/java/io/github/wulkanowy/api/grades/Subject.java index 06eda2a27..50a23b38e 100644 --- a/app/src/main/java/io/github/wulkanowy/api/grades/Subject.java +++ b/app/src/main/java/io/github/wulkanowy/api/grades/Subject.java @@ -10,11 +10,11 @@ public class Subject { private String finalRating; - public int getId(){ + public int getId() { return id; } - public Subject setId(int id){ + public Subject setId(int id) { this.id = id; return this; diff --git a/app/src/main/java/io/github/wulkanowy/api/grades/SubjectsList.java b/app/src/main/java/io/github/wulkanowy/api/grades/SubjectsList.java index 1de1fad1a..e9a1dfc5b 100644 --- a/app/src/main/java/io/github/wulkanowy/api/grades/SubjectsList.java +++ b/app/src/main/java/io/github/wulkanowy/api/grades/SubjectsList.java @@ -8,7 +8,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import io.github.wulkanowy.api.Cookies; import io.github.wulkanowy.api.StudentAndParent; import io.github.wulkanowy.api.Vulcan; import io.github.wulkanowy.api.login.LoginErrorException; @@ -17,29 +16,24 @@ public class SubjectsList extends Vulcan { private StudentAndParent snp = null; - private String subjectsPageUrl = - "https://uonetplus-opiekun.vulcan.net.pl/{locationID}/{ID}/Oceny/Wszystkie?details=1"; + private String subjectsPageUrl = "Oceny/Wszystkie?details=1"; private List subjects = new ArrayList<>(); - public SubjectsList(Cookies cookies, StudentAndParent snp) { - this.cookies = cookies; + public SubjectsList(StudentAndParent snp) { this.snp = snp; } public List getAll() throws IOException, LoginErrorException { - subjectsPageUrl = subjectsPageUrl.replace("{locationID}", snp.getLocationID()); - subjectsPageUrl = subjectsPageUrl.replace("{ID}", snp.getID()); - - Document subjectPage = getPageByUrl(subjectsPageUrl); + Document subjectPage = snp.getSnPPageDocument(subjectsPageUrl); Elements rows = subjectPage.select(".ocenyZwykle-table > tbody > tr"); for (Element subjectRow : rows) { subjects.add(new Subject() .setName(subjectRow.select("td:nth-child(1)").text()) - .setPredictedRating(subjectRow.select("td:nth-child(3)").text()) - .setFinalRating(subjectRow.select("td:nth-child(4)").text()) + .setPredictedRating(subjectRow.select("td:nth-last-child(2)").text()) + .setFinalRating(subjectRow.select("td:nth-last-child(1)").text()) ); } diff --git a/app/src/main/java/io/github/wulkanowy/api/login/Login.java b/app/src/main/java/io/github/wulkanowy/api/login/Login.java index a27928464..88562425a 100644 --- a/app/src/main/java/io/github/wulkanowy/api/login/Login.java +++ b/app/src/main/java/io/github/wulkanowy/api/login/Login.java @@ -13,11 +13,10 @@ public class Login extends Vulcan { private String loginPageUrl = "https://cufs.vulcan.net.pl/{locationID}/Account/LogOn"; - private String certificatePageUrl = - "https://cufs.vulcan.net.pl/" - + "{locationID}/FS/LS?wa=wsignin1.0&wtrealm=https://uonetplus.vulcan.net.pl/" - + "{locationID}/LoginEndpoint.aspx&wctx=https://uonetplus.vulcan.net.pl/" - + "{locationID}/LoginEndpoint.aspx"; + private String certificatePageUrl = "https://cufs.vulcan.net.pl/{locationID}" + + "/FS/LS?wa=wsignin1.0&wtrealm=https://uonetplus.vulcan.net.pl/{locationID}" + + "/LoginEndpoint.aspx&wctx=https://uonetplus.vulcan.net.pl/{locationID}" + + "/LoginEndpoint.aspx"; private String loginEndpointPageUrl = "https://uonetplus.vulcan.net.pl/{locationID}/LoginEndpoint.aspx"; @@ -60,9 +59,7 @@ public class Login extends Vulcan { private String[] getCertificateData(String county) throws IOException { certificatePageUrl = certificatePageUrl.replace("{locationID}", county); - Document certificatePage = Jsoup.connect(certificatePageUrl) - .cookies(getCookies()) - .get(); + Document certificatePage = getPageByUrl(certificatePageUrl); return new String[]{ certificatePage.select("input[name=wa]").attr("value"), diff --git a/app/src/main/java/io/github/wulkanowy/api/notes/AchievementsList.java b/app/src/main/java/io/github/wulkanowy/api/notes/AchievementsList.java index cff89f23a..b4421cda1 100644 --- a/app/src/main/java/io/github/wulkanowy/api/notes/AchievementsList.java +++ b/app/src/main/java/io/github/wulkanowy/api/notes/AchievementsList.java @@ -7,20 +7,24 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; +import io.github.wulkanowy.api.StudentAndParent; import io.github.wulkanowy.api.login.LoginErrorException; public class AchievementsList { - private Notes notes = null; + private StudentAndParent snp = null; private List achievementsList = new ArrayList<>(); - public AchievementsList(Notes notes) { - this.notes = notes; + private String notesPageUrl = "UwagiOsiagniecia.mvc/Wszystkie"; + + public AchievementsList(StudentAndParent snp) { + this.snp = snp; } public List getAllAchievements() throws LoginErrorException, IOException { - Element pageFragment = notes.getNotesPageDocument().select(".mainContainer > div").get(1); + Element pageFragment = snp.getSnPPageDocument(notesPageUrl) + .select(".mainContainer > div").get(1); Elements items = pageFragment.select("article"); for (Element item : items) { diff --git a/app/src/main/java/io/github/wulkanowy/api/notes/Notes.java b/app/src/main/java/io/github/wulkanowy/api/notes/Notes.java deleted file mode 100644 index e3fe550e6..000000000 --- a/app/src/main/java/io/github/wulkanowy/api/notes/Notes.java +++ /dev/null @@ -1,33 +0,0 @@ -package io.github.wulkanowy.api.notes; - -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; - -import java.io.IOException; - -import io.github.wulkanowy.api.Cookies; -import io.github.wulkanowy.api.StudentAndParent; -import io.github.wulkanowy.api.Vulcan; -import io.github.wulkanowy.api.login.LoginErrorException; - -public class Notes extends Vulcan { - - private StudentAndParent snp = null; - - private String notesPageUrl = "https://uonetplus-opiekun.vulcan.net.pl/{locationID}/{ID}/" - + "UwagiOsiagniecia.mvc/Wszystkie"; - - public Notes(Cookies cookies, StudentAndParent snp) { - this.cookies = cookies; - this.snp = snp; - } - - public Document getNotesPageDocument() throws IOException, LoginErrorException { - notesPageUrl = notesPageUrl.replace("{locationID}", snp.getLocationID()); - notesPageUrl = notesPageUrl.replace("{ID}", snp.getID()); - - return Jsoup.connect(notesPageUrl) - .cookies(getCookies()) - .get(); - } -} diff --git a/app/src/main/java/io/github/wulkanowy/api/notes/NotesList.java b/app/src/main/java/io/github/wulkanowy/api/notes/NotesList.java index 05aa820ec..3ae52bd45 100644 --- a/app/src/main/java/io/github/wulkanowy/api/notes/NotesList.java +++ b/app/src/main/java/io/github/wulkanowy/api/notes/NotesList.java @@ -12,18 +12,19 @@ import io.github.wulkanowy.api.login.LoginErrorException; public class NotesList { - private Notes notes = null; private StudentAndParent snp = null; private List notesList = new ArrayList<>(); - public NotesList(Notes notes, StudentAndParent snp) { - this.notes = notes; + private String notesPageUrl = "UwagiOsiagniecia.mvc/Wszystkie"; + + public NotesList(StudentAndParent snp) { this.snp = snp; } public List getAllNotes() throws LoginErrorException, IOException { - Element pageFragment = notes.getNotesPageDocument().select(".mainContainer > div").get(0); + Element pageFragment = snp.getSnPPageDocument(notesPageUrl) + .select(".mainContainer > div").get(0); Elements items = pageFragment.select("article"); Elements dates = pageFragment.select("h2"); diff --git a/app/src/main/java/io/github/wulkanowy/api/school/School.java b/app/src/main/java/io/github/wulkanowy/api/school/School.java deleted file mode 100644 index 89b436272..000000000 --- a/app/src/main/java/io/github/wulkanowy/api/school/School.java +++ /dev/null @@ -1,32 +0,0 @@ -package io.github.wulkanowy.api.school; - -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; - -import java.io.IOException; - -import io.github.wulkanowy.api.Cookies; -import io.github.wulkanowy.api.StudentAndParent; -import io.github.wulkanowy.api.Vulcan; -import io.github.wulkanowy.api.login.LoginErrorException; - -public class School extends Vulcan { - private StudentAndParent snp = null; - - private String schoolPageUrl = "https://uonetplus-opiekun.vulcan.net.pl/{locationID}/{ID}/" - + "Szkola.mvc/Nauczyciele"; - - public School(Cookies cookies, StudentAndParent snp) { - this.cookies = cookies; - this.snp = snp; - } - - public Document getSchoolPageDocument() throws IOException, LoginErrorException { - schoolPageUrl = schoolPageUrl.replace("{locationID}", snp.getLocationID()); - schoolPageUrl = schoolPageUrl.replace("{ID}", snp.getID()); - - return Jsoup.connect(schoolPageUrl) - .cookies(getCookies()) - .get(); - } -} diff --git a/app/src/main/java/io/github/wulkanowy/api/school/SchoolInfo.java b/app/src/main/java/io/github/wulkanowy/api/school/SchoolInfo.java index 861a1be8a..0b05b7a85 100644 --- a/app/src/main/java/io/github/wulkanowy/api/school/SchoolInfo.java +++ b/app/src/main/java/io/github/wulkanowy/api/school/SchoolInfo.java @@ -10,16 +10,17 @@ import io.github.wulkanowy.api.login.LoginErrorException; public class SchoolInfo extends Vulcan { - private School school = null; private StudentAndParent snp = null; - public SchoolInfo(School school, StudentAndParent snp) { - this.school = school; + private String schoolPageUrl = "Szkola.mvc/Nauczyciele"; + + public SchoolInfo(StudentAndParent snp) { this.snp = snp; } public SchoolData getSchoolData() throws IOException, LoginErrorException { - Element e = school.getSchoolPageDocument().select(".mainContainer > article").get(0); + Element e = snp.getSnPPageDocument(schoolPageUrl) + .select(".mainContainer > article").get(0); return new SchoolData() .setName(snp.getRowDataChildValue(e, 1)) diff --git a/app/src/main/java/io/github/wulkanowy/api/school/TeachersInfo.java b/app/src/main/java/io/github/wulkanowy/api/school/TeachersInfo.java index 4c330f736..915455486 100644 --- a/app/src/main/java/io/github/wulkanowy/api/school/TeachersInfo.java +++ b/app/src/main/java/io/github/wulkanowy/api/school/TeachersInfo.java @@ -8,19 +8,22 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; +import io.github.wulkanowy.api.StudentAndParent; import io.github.wulkanowy.api.Vulcan; import io.github.wulkanowy.api.login.LoginErrorException; public class TeachersInfo extends Vulcan { - private School school = null; + private StudentAndParent snp = null; - public TeachersInfo(School school) { - this.school = school; + private String schoolPageUrl = "Szkola.mvc/Nauczyciele"; + + public TeachersInfo(StudentAndParent snp) { + this.snp = snp; } public TeachersData getTeachersData() throws IOException, LoginErrorException { - Document doc = school.getSchoolPageDocument(); + Document doc = snp.getSnPPageDocument(schoolPageUrl); Elements rows = doc.select(".mainContainer > table tbody tr"); String description = doc.select(".mainContainer > p").first().text(); diff --git a/app/src/main/java/io/github/wulkanowy/api/timetable/Lesson.java b/app/src/main/java/io/github/wulkanowy/api/timetable/Lesson.java index b7aaa16fe..f15e2928d 100644 --- a/app/src/main/java/io/github/wulkanowy/api/timetable/Lesson.java +++ b/app/src/main/java/io/github/wulkanowy/api/timetable/Lesson.java @@ -3,23 +3,37 @@ package io.github.wulkanowy.api.timetable; public class Lesson { public static final String CLASS_PLANNING = "x-treelabel-ppl"; + public static final String CLASS_REALIZED = "x-treelabel-rlz"; + public static final String CLASS_MOVED_OR_CANCELED = "x-treelabel-inv"; + public static final String CLASS_NEW_MOVED_IN_OR_CHANGED = "x-treelabel-zas"; private String subject = ""; + private String teacher = ""; + private String room = ""; + private String description = ""; + private String groupName = ""; + private String startTime = ""; + private String endTime = ""; private boolean isEmpty = false; + private boolean isDivisionIntoGroups = false; + private boolean isPlanning = false; + private boolean isRealized = false; + private boolean isMovedOrCanceled = false; + private boolean isNewMovedInOrChanged = false; public String getSubject() { diff --git a/app/src/main/java/io/github/wulkanowy/api/timetable/Table.java b/app/src/main/java/io/github/wulkanowy/api/timetable/Table.java index 0a52778bc..503538855 100644 --- a/app/src/main/java/io/github/wulkanowy/api/timetable/Table.java +++ b/app/src/main/java/io/github/wulkanowy/api/timetable/Table.java @@ -8,15 +8,18 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; +import io.github.wulkanowy.api.StudentAndParent; import io.github.wulkanowy.api.Vulcan; import io.github.wulkanowy.api.login.LoginErrorException; public class Table extends Vulcan { - private Timetable timetable; + private StudentAndParent snp; - public Table(Timetable timetable) { - this.timetable = timetable; + private String timetablePageurl = "Lekcja.mvc/PlanLekcji?data="; + + public Table(StudentAndParent snp) { + this.snp = snp; } public Week getWeekTable() throws IOException, LoginErrorException { @@ -24,7 +27,7 @@ public class Table extends Vulcan { } public Week getWeekTable(String tick) throws IOException, LoginErrorException { - Element table = timetable.getTablePageDocument(tick) + Element table = snp.getSnPPageDocument(timetablePageurl + tick) .select(".mainContainer .presentData").first(); Elements tableHeaderCells = table.select("thead th"); @@ -84,7 +87,7 @@ public class Table extends Vulcan { .setDays(days); } - public Lesson getLessonFromElement(Element e) { + private Lesson getLessonFromElement(Element e) { Lesson lesson = new Lesson(); Elements spans = e.select("span"); @@ -99,7 +102,7 @@ public class Table extends Vulcan { return lesson; } - public Lesson getLessonGroupDivisionInfo(Lesson lesson, Elements e) { + private Lesson getLessonGroupDivisionInfo(Lesson lesson, Elements e) { if ((4 == e.size() && (e.first().attr("class").equals("")) || (5 == e.size() && e.first().hasClass(Lesson.CLASS_NEW_MOVED_IN_OR_CHANGED)))) { lesson.setDivisionIntoGroups(true); @@ -114,7 +117,7 @@ public class Table extends Vulcan { return lesson; } - public Lesson getLessonTypeInfo(Lesson lesson, Elements e) { + private Lesson getLessonTypeInfo(Lesson lesson, Elements e) { if (e.first().hasClass(Lesson.CLASS_MOVED_OR_CANCELED)) { lesson.setMovedOrCanceled(true); } else if (e.first().hasClass(Lesson.CLASS_NEW_MOVED_IN_OR_CHANGED)) { @@ -131,7 +134,7 @@ public class Table extends Vulcan { return lesson; } - public Lesson getLessonDescriptionInfo(Lesson lesson, Elements e) { + private Lesson getLessonDescriptionInfo(Lesson lesson, Elements e) { if ((4 == e.size() || 5 == e.size()) && (e.first().hasClass(Lesson.CLASS_MOVED_OR_CANCELED) || e.first().hasClass(Lesson.CLASS_NEW_MOVED_IN_OR_CHANGED))) { diff --git a/app/src/main/java/io/github/wulkanowy/api/timetable/Timetable.java b/app/src/main/java/io/github/wulkanowy/api/timetable/Timetable.java deleted file mode 100644 index ce2cf2f65..000000000 --- a/app/src/main/java/io/github/wulkanowy/api/timetable/Timetable.java +++ /dev/null @@ -1,33 +0,0 @@ -package io.github.wulkanowy.api.timetable; - -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; - -import java.io.IOException; - -import io.github.wulkanowy.api.Cookies; -import io.github.wulkanowy.api.StudentAndParent; -import io.github.wulkanowy.api.Vulcan; -import io.github.wulkanowy.api.login.LoginErrorException; - -public class Timetable extends Vulcan { - - private StudentAndParent snp; - - private String timetablePageurl = - "https://uonetplus-opiekun.vulcan.net.pl/{locationID}/{ID}/Lekcja.mvc/PlanLekcji?data="; - - public Timetable(Cookies cookies, StudentAndParent snp) { - this.cookies = cookies; - this.snp = snp; - } - - public Document getTablePageDocument(String tick) throws IOException, LoginErrorException { - timetablePageurl = timetablePageurl.replace("{locationID}", snp.getLocationID()); - timetablePageurl = timetablePageurl.replace("{ID}", snp.getID()); - - return Jsoup.connect(timetablePageurl + tick) - .cookies(getCookies()) - .get(); - } -} diff --git a/app/src/main/java/io/github/wulkanowy/api/user/AddressData.java b/app/src/main/java/io/github/wulkanowy/api/user/AddressData.java index 806e85131..3d6fc6d54 100644 --- a/app/src/main/java/io/github/wulkanowy/api/user/AddressData.java +++ b/app/src/main/java/io/github/wulkanowy/api/user/AddressData.java @@ -2,11 +2,11 @@ package io.github.wulkanowy.api.user; public class AddressData { - private String address; + private String address = ""; - private String registeredAddress; + private String registeredAddress = ""; - private String correspondenceAddress; + private String correspondenceAddress = ""; public String getAddress() { return address; diff --git a/app/src/main/java/io/github/wulkanowy/api/user/BasicInformation.java b/app/src/main/java/io/github/wulkanowy/api/user/BasicInformation.java index a2a5affb2..a75c44018 100644 --- a/app/src/main/java/io/github/wulkanowy/api/user/BasicInformation.java +++ b/app/src/main/java/io/github/wulkanowy/api/user/BasicInformation.java @@ -10,32 +10,45 @@ import io.github.wulkanowy.api.login.LoginErrorException; public class BasicInformation { - private StudentAndParent snp = null; + private static Document studentDataPageDocument; - private Document studentDataPageDocument; + private StudentAndParent snp; - public BasicInformation(User user, StudentAndParent snp) - throws IOException, LoginErrorException { + private String studentDataPageUrl = "Uczen.mvc/DanePodstawowe"; + + public BasicInformation(StudentAndParent snp) { this.snp = snp; - - studentDataPageDocument = user.getPage(); } - public PersonalData getPersonalData() { - Element e = studentDataPageDocument.select(".mainContainer > article").get(0); + public Document getStudentDataPageDocument() throws IOException, LoginErrorException { + if (null == studentDataPageDocument) { + studentDataPageDocument = snp.getSnPPageDocument(studentDataPageUrl); + } + + return studentDataPageDocument; + } + + public PersonalData getPersonalData() throws IOException, LoginErrorException { + Element e = getStudentDataPageDocument().select(".mainContainer > article").get(0); + + String name = snp.getRowDataChildValue(e, 1); + String[] names = name.split(" "); return new PersonalData() - .setNames(snp.getRowDataChildValue(e, 1)) + .setName(name) + .setFirstName(names[0]) + .setSurname(names[names.length - 1]) + .setFirstAndLastName(names[0] + " " + names[names.length - 1]) .setDateAndBirthPlace(snp.getRowDataChildValue(e, 2)) .setPesel(snp.getRowDataChildValue(e, 3)) .setGender(snp.getRowDataChildValue(e, 4)) - .setPolishCitizenship(snp.getRowDataChildValue(e, 5)) + .setPolishCitizenship("Tak".equals(snp.getRowDataChildValue(e, 5))) .setFamilyName(snp.getRowDataChildValue(e, 6)) .setParentsNames(snp.getRowDataChildValue(e, 7)); } - public AddressData getAddresData() { - Element e = studentDataPageDocument.select(".mainContainer > article").get(1); + public AddressData getAddressData() throws IOException, LoginErrorException { + Element e = getStudentDataPageDocument().select(".mainContainer > article").get(1); return new AddressData() .setAddress(snp.getRowDataChildValue(e, 1)) @@ -44,8 +57,8 @@ public class BasicInformation { } - public ContactDetails getContactDetails() { - Element e = studentDataPageDocument.select(".mainContainer > article").get(2); + public ContactDetails getContactDetails() throws IOException, LoginErrorException { + Element e = getStudentDataPageDocument().select(".mainContainer > article").get(2); return new ContactDetails() .setPhoneNumber(snp.getRowDataChildValue(e, 1)) diff --git a/app/src/main/java/io/github/wulkanowy/api/user/ContactDetails.java b/app/src/main/java/io/github/wulkanowy/api/user/ContactDetails.java index 77d8e1c3d..c8556944e 100644 --- a/app/src/main/java/io/github/wulkanowy/api/user/ContactDetails.java +++ b/app/src/main/java/io/github/wulkanowy/api/user/ContactDetails.java @@ -2,11 +2,11 @@ package io.github.wulkanowy.api.user; public class ContactDetails { - private String phoneNumber; + private String phoneNumber = ""; - private String cellPhoneNumber; + private String cellPhoneNumber = ""; - private String email; + private String email = ""; public String getPhoneNumber() { return phoneNumber; diff --git a/app/src/main/java/io/github/wulkanowy/api/user/FamilyInformation.java b/app/src/main/java/io/github/wulkanowy/api/user/FamilyInformation.java new file mode 100644 index 000000000..997402907 --- /dev/null +++ b/app/src/main/java/io/github/wulkanowy/api/user/FamilyInformation.java @@ -0,0 +1,42 @@ +package io.github.wulkanowy.api.user; + +import org.jsoup.nodes.Element; +import org.jsoup.select.Elements; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import io.github.wulkanowy.api.StudentAndParent; +import io.github.wulkanowy.api.Vulcan; +import io.github.wulkanowy.api.login.LoginErrorException; + +public class FamilyInformation extends Vulcan { + + private StudentAndParent snp; + + private String studentDataPageUrl = "Uczen.mvc/DanePodstawowe"; + + public FamilyInformation(StudentAndParent snp) throws IOException, LoginErrorException { + this.snp = snp; + } + + public List getFamilyMembers() throws IOException, LoginErrorException { + Elements membersElements = snp.getSnPPageDocument(studentDataPageUrl) + .select(".mainContainer > article:nth-of-type(n+4)"); + + List familyMembers = new ArrayList<>(); + + for (Element e : membersElements) { + familyMembers.add(new FamilyMember() + .setName(snp.getRowDataChildValue(e, 1)) + .setKinship(snp.getRowDataChildValue(e, 2)) + .setAddress(snp.getRowDataChildValue(e, 3)) + .setTelephones(snp.getRowDataChildValue(e, 4)) + .setEmail(snp.getRowDataChildValue(e, 5)) + ); + } + + return familyMembers; + } +} diff --git a/app/src/main/java/io/github/wulkanowy/api/user/FamilyMember.java b/app/src/main/java/io/github/wulkanowy/api/user/FamilyMember.java new file mode 100644 index 000000000..dfb966745 --- /dev/null +++ b/app/src/main/java/io/github/wulkanowy/api/user/FamilyMember.java @@ -0,0 +1,59 @@ +package io.github.wulkanowy.api.user; + +public class FamilyMember { + + private String name = ""; + + private String kinship = ""; + + private String address = ""; + + private String telephones = ""; + + private String email = ""; + + public String getName() { + return name; + } + + public FamilyMember setName(String name) { + this.name = name; + return this; + } + + public String getKinship() { + return kinship; + } + + public FamilyMember setKinship(String kinship) { + this.kinship = kinship; + return this; + } + + public String getAddress() { + return address; + } + + public FamilyMember setAddress(String address) { + this.address = address; + return this; + } + + public String getTelephones() { + return telephones; + } + + public FamilyMember setTelephones(String telephones) { + this.telephones = telephones; + return this; + } + + public String getEmail() { + return email; + } + + public FamilyMember setEmail(String email) { + this.email = email; + return this; + } +} diff --git a/app/src/main/java/io/github/wulkanowy/api/user/PersonalData.java b/app/src/main/java/io/github/wulkanowy/api/user/PersonalData.java index 68607136c..d2991e613 100644 --- a/app/src/main/java/io/github/wulkanowy/api/user/PersonalData.java +++ b/app/src/main/java/io/github/wulkanowy/api/user/PersonalData.java @@ -2,44 +2,60 @@ package io.github.wulkanowy.api.user; public class PersonalData { - private String names; + private String name = ""; - private String dateAndBirthPlace; + private String firstName = ""; - private String pesel; + private String surname = ""; - private String gender; + private String firstAndLastName = ""; - private String isPolishCitizenship; + private String dateAndBirthPlace = ""; - private String familyName; + private String pesel = ""; - private String parentsNames; + private String gender = ""; - public String getNames() { - return names; + private boolean isPolishCitizenship; + + private String familyName = ""; + + private String parentsNames = ""; + + public String getName() { + return name; } - public PersonalData setNames(String names) { - this.names = names; - + public PersonalData setName(String name) { + this.name = name; return this; } public String getFirstName() { - String[] name = names.split(" "); + return firstName; + } - return name[0]; + public PersonalData setFirstName(String firstName) { + this.firstName = firstName; + return this; } public String getSurname() { - String[] name = names.split(" "); + return surname; + } - return name[name.length - 1]; + public PersonalData setSurname(String surname) { + this.surname = surname; + return this; } public String getFirstAndLastName() { - return getFirstName() + " " + getSurname(); + return firstAndLastName; + } + + public PersonalData setFirstAndLastName(String firstAndLastName) { + this.firstAndLastName = firstAndLastName; + return this; } public String getDateAndBirthPlace() { @@ -48,7 +64,6 @@ public class PersonalData { public PersonalData setDateAndBirthPlace(String dateAndBirthPlace) { this.dateAndBirthPlace = dateAndBirthPlace; - return this; } @@ -58,7 +73,6 @@ public class PersonalData { public PersonalData setPesel(String pesel) { this.pesel = pesel; - return this; } @@ -68,17 +82,15 @@ public class PersonalData { public PersonalData setGender(String gender) { this.gender = gender; - return this; } public boolean isPolishCitizenship() { - return "Tak".equals(isPolishCitizenship); + return isPolishCitizenship; } - public PersonalData setPolishCitizenship(String polishCitizenship) { + public PersonalData setPolishCitizenship(boolean polishCitizenship) { isPolishCitizenship = polishCitizenship; - return this; } @@ -88,7 +100,6 @@ public class PersonalData { public PersonalData setFamilyName(String familyName) { this.familyName = familyName; - return this; } @@ -98,7 +109,6 @@ public class PersonalData { public PersonalData setParentsNames(String parentsNames) { this.parentsNames = parentsNames; - return this; } } diff --git a/app/src/main/java/io/github/wulkanowy/api/user/User.java b/app/src/main/java/io/github/wulkanowy/api/user/User.java deleted file mode 100644 index c75fb7da2..000000000 --- a/app/src/main/java/io/github/wulkanowy/api/user/User.java +++ /dev/null @@ -1,33 +0,0 @@ -package io.github.wulkanowy.api.user; - -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; - -import java.io.IOException; - -import io.github.wulkanowy.api.Cookies; -import io.github.wulkanowy.api.StudentAndParent; -import io.github.wulkanowy.api.Vulcan; -import io.github.wulkanowy.api.login.LoginErrorException; - -public class User extends Vulcan { - - private StudentAndParent snp = null; - - private String studentDataPageUrl = - "https://uonetplus-opiekun.vulcan.net.pl/{locationID}/{ID}/Uczen.mvc/DanePodstawowe"; - - public User(Cookies cookies, StudentAndParent snp) { - this.cookies = cookies; - this.snp = snp; - } - - public Document getPage() throws IOException, LoginErrorException { - studentDataPageUrl = studentDataPageUrl.replace("{locationID}", snp.getLocationID()); - studentDataPageUrl = studentDataPageUrl.replace("{ID}", snp.getID()); - - return Jsoup.connect(studentDataPageUrl) - .cookies(getCookies()) - .get(); - } -} diff --git a/app/src/test/java/io/github/wulkanowy/api/StudentAndParentTest.java b/app/src/test/java/io/github/wulkanowy/api/StudentAndParentTest.java index a01ee7a7a..a77853c89 100644 --- a/app/src/test/java/io/github/wulkanowy/api/StudentAndParentTest.java +++ b/app/src/test/java/io/github/wulkanowy/api/StudentAndParentTest.java @@ -11,6 +11,8 @@ import org.powermock.api.mockito.PowerMockito; import java.util.ArrayList; import java.util.List; +import io.github.wulkanowy.api.login.LoginErrorException; + public class StudentAndParentTest { private String fixtureFileName = "OcenyWszystkie-semester.html"; @@ -26,8 +28,8 @@ public class StudentAndParentTest { PowerMockito.whenNew(StudentAndParent.class) .withArguments(Mockito.any(Cookies.class), Mockito.anyString()).thenReturn(snp); - Mockito.when(snp.getPageByUrl(Mockito.anyString())).thenReturn(gradesPageDocument); - Mockito.when(snp.getGradesPageUrl()).thenReturn("http://example.null"); + Mockito.when(snp.getSnPPageDocument(Mockito.anyString())).thenReturn(gradesPageDocument); + Mockito.when(snp.getCalculatedID(Mockito.anyString())).thenCallRealMethod(); Mockito.when(snp.getLocationID()).thenReturn("symbol"); Mockito.when(snp.getID()).thenReturn("123456"); Mockito.when(snp.getSemesters()).thenCallRealMethod(); @@ -36,6 +38,24 @@ public class StudentAndParentTest { .thenCallRealMethod(); } + @Test + public void getCalculatedIDStandardTest() throws Exception { + Assert.assertEquals("123456", snp.getCalculatedID("https://uonetplus-opiekun" + + ".vulcan.net.pl/powiat/123456/Start/Index/")); + } + + @Test + public void getCalculatedIDDemoTest() throws Exception { + Assert.assertEquals("demo12345", snp.getCalculatedID("https://uonetplus-opiekundemo" + + ".vulcan.net.pl/demoupowiat/demo12345/Start/Index/")); + } + + @Test(expected = LoginErrorException.class) + public void getCalculatedIDNotLoggedTest() throws Exception { + Assert.assertEquals("123", snp.getCalculatedID("https://uonetplus" + + ".vulcan.net.pl/powiat/")); + } + @Test public void getSemestersTest() throws Exception { List semesters = snp.getSemesters(); @@ -61,4 +81,11 @@ public class StudentAndParentTest { Assert.assertEquals("2", snp.getCurrentSemester(semesters).getId()); Assert.assertEquals("1500100901", snp.getCurrentSemester(semesters).getNumber()); } + + @Test + public void getCurrentSemesterFromEmptyTest() throws Exception { + List semesters = new ArrayList<>(); + + Assert.assertNull(snp.getCurrentSemester(semesters)); + } } diff --git a/app/src/test/java/io/github/wulkanowy/api/grades/GradesListTest.java b/app/src/test/java/io/github/wulkanowy/api/grades/GradesListTest.java index 319e365f8..47f232f2b 100644 --- a/app/src/test/java/io/github/wulkanowy/api/grades/GradesListTest.java +++ b/app/src/test/java/io/github/wulkanowy/api/grades/GradesListTest.java @@ -1,20 +1,12 @@ package io.github.wulkanowy.api.grades; -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.mockito.Mockito; -import org.powermock.api.mockito.PowerMockito; import java.util.List; -import io.github.wulkanowy.api.FixtureHelper; -import io.github.wulkanowy.api.Semester; -import io.github.wulkanowy.api.StudentAndParent; - -public class GradesListTest { +public class GradesListTest extends GradesTest { private String fixtureFileName = "OcenyWszystkie-filled.html"; @@ -22,25 +14,9 @@ public class GradesListTest { @Before public void setUp() throws Exception { - String input = FixtureHelper.getAsString(getClass().getResourceAsStream(fixtureFileName)); - Document gradesPageDocument = Jsoup.parse(input); + super.setUp(fixtureFileName); - StudentAndParent snp = Mockito.mock(StudentAndParent.class); - PowerMockito.whenNew(StudentAndParent.class).withAnyArguments().thenReturn(snp); - Mockito.when(snp.getLocationID()).thenReturn("symbol"); - Mockito.when(snp.getID()).thenReturn("123456"); - Mockito.when(snp.getGradesPageUrl()).thenReturn("http://example.null"); - Mockito.when(snp.getSemesters()).thenCallRealMethod(); - Mockito.when(snp.getSemesters(Mockito.any(Document.class))).thenCallRealMethod(); - Mockito.when(snp.getCurrentSemester(Mockito.anyListOf(Semester.class))) - .thenCallRealMethod(); - - Grades grades = Mockito.mock(Grades.class); - PowerMockito.whenNew(Grades.class).withAnyArguments().thenReturn(grades); - Mockito.when(grades.getGradesPageDocument(Mockito.anyString())) - .thenReturn(gradesPageDocument); - - gradesList = new GradesList(grades, snp); + gradesList = new GradesList(snp); } @Test diff --git a/app/src/test/java/io/github/wulkanowy/api/grades/GradesTest.java b/app/src/test/java/io/github/wulkanowy/api/grades/GradesTest.java new file mode 100644 index 000000000..b5f69b8eb --- /dev/null +++ b/app/src/test/java/io/github/wulkanowy/api/grades/GradesTest.java @@ -0,0 +1,26 @@ +package io.github.wulkanowy.api.grades; + +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.mockito.Mockito; + +import io.github.wulkanowy.api.FixtureHelper; +import io.github.wulkanowy.api.Semester; +import io.github.wulkanowy.api.StudentAndParent; + +public class GradesTest { + + protected StudentAndParent snp; + + public void setUp(String fixtureFileName) throws Exception { + String input = FixtureHelper.getAsString(getClass().getResourceAsStream(fixtureFileName)); + Document gradesPageDocument = Jsoup.parse(input); + + snp = Mockito.mock(StudentAndParent.class); + Mockito.when(snp.getSnPPageDocument(Mockito.anyString())) + .thenReturn(gradesPageDocument); + Mockito.when(snp.getSemesters(Mockito.any(Document.class))).thenCallRealMethod(); + Mockito.when(snp.getCurrentSemester(Mockito.anyListOf(Semester.class))) + .thenCallRealMethod(); + } +} diff --git a/app/src/test/java/io/github/wulkanowy/api/grades/SubjectsListTest.java b/app/src/test/java/io/github/wulkanowy/api/grades/SubjectsListTest.java new file mode 100644 index 000000000..fcae12624 --- /dev/null +++ b/app/src/test/java/io/github/wulkanowy/api/grades/SubjectsListTest.java @@ -0,0 +1,83 @@ +package io.github.wulkanowy.api.grades; + +import org.junit.Assert; +import org.junit.Test; + +import java.util.List; + +public class SubjectsListTest extends GradesTest { + + private String fixtureStdFileName = "OcenyWszystkie-subjects.html"; + + private String fixtureAverageFileName = "OcenyWszystkie-subjects-average.html"; + + public SubjectsList getSetUpSubjectsList(String fixtureFileName) throws Exception { + super.setUp(fixtureFileName); + + return new SubjectsList(snp); + } + + @Test + public void getAllStdTest() throws Exception { + List list = getSetUpSubjectsList(fixtureStdFileName).getAll(); + + Assert.assertEquals(5, list.size()); + + Subject subject0 = list.get(0); + Assert.assertEquals("Zachowanie", subject0.getName()); + Assert.assertEquals("bardzo dobre", subject0.getPredictedRating()); + Assert.assertEquals("bardzo dobre", subject0.getFinalRating()); + + Subject subject1 = list.get(1); + Assert.assertEquals("Praktyka zawodowa", subject1.getName()); + Assert.assertEquals("-", subject1.getPredictedRating()); + Assert.assertEquals("celujący", subject1.getFinalRating()); + + Subject subject2 = list.get(2); + Assert.assertEquals("Metodologia programowania", subject2.getName()); + Assert.assertEquals("bardzo dobry", subject2.getPredictedRating()); + Assert.assertEquals("celujący", subject2.getFinalRating()); + + Subject subject3 = list.get(3); + Assert.assertEquals("Podstawy przedsiębiorczości", subject3.getName()); + Assert.assertEquals("3/4", subject3.getPredictedRating()); + Assert.assertEquals("dostateczny", subject3.getFinalRating()); + + Subject subject4 = list.get(4); + Assert.assertEquals("Wychowanie do życia w rodzinie", subject4.getName()); + Assert.assertEquals("-", subject4.getPredictedRating()); + Assert.assertEquals("-", subject4.getFinalRating()); + } + + @Test + public void getAllAverageTest() throws Exception { + List list = getSetUpSubjectsList(fixtureAverageFileName).getAll(); + + Assert.assertEquals(5, list.size()); + + Subject subject0 = list.get(0); + Assert.assertEquals("Zachowanie", subject0.getName()); + Assert.assertEquals("bardzo dobre", subject0.getPredictedRating()); + Assert.assertEquals("bardzo dobre", subject0.getFinalRating()); + + Subject subject1 = list.get(1); + Assert.assertEquals("Język polski", subject1.getName()); + Assert.assertEquals("-", subject1.getPredictedRating()); + Assert.assertEquals("dobry", subject1.getFinalRating()); + + Subject subject2 = list.get(2); + Assert.assertEquals("Wychowanie fizyczne", subject2.getName()); + Assert.assertEquals("bardzo dobry", subject2.getPredictedRating()); + Assert.assertEquals("celujący", subject2.getFinalRating()); + + Subject subject3 = list.get(3); + Assert.assertEquals("Język angielski", subject3.getName()); + Assert.assertEquals("4/5", subject3.getPredictedRating()); + Assert.assertEquals("bardzo dobry", subject3.getFinalRating()); + + Subject subject4 = list.get(4); + Assert.assertEquals("Wiedza o społeczeństwie", subject4.getName()); + Assert.assertEquals("-", subject4.getPredictedRating()); + Assert.assertEquals("-", subject4.getFinalRating()); + } +} diff --git a/app/src/test/java/io/github/wulkanowy/api/login/LoginTest.java b/app/src/test/java/io/github/wulkanowy/api/login/LoginTest.java index 5bbfc27c4..7fe25836a 100644 --- a/app/src/test/java/io/github/wulkanowy/api/login/LoginTest.java +++ b/app/src/test/java/io/github/wulkanowy/api/login/LoginTest.java @@ -1,8 +1,8 @@ package io.github.wulkanowy.api.login; -import org.junit.Test; +import static org.junit.Assert.assertEquals; -import static org.junit.Assert.*; +import org.junit.Test; public class LoginTest { diff --git a/app/src/test/java/io/github/wulkanowy/api/notes/AchievementsListTest.java b/app/src/test/java/io/github/wulkanowy/api/notes/AchievementsListTest.java index 63775e209..2f0e340ff 100644 --- a/app/src/test/java/io/github/wulkanowy/api/notes/AchievementsListTest.java +++ b/app/src/test/java/io/github/wulkanowy/api/notes/AchievementsListTest.java @@ -5,12 +5,11 @@ import org.jsoup.nodes.Document; import org.junit.Assert; import org.junit.Test; import org.mockito.Mockito; -import org.unitils.reflectionassert.ReflectionAssert; -import java.util.ArrayList; import java.util.List; import io.github.wulkanowy.api.FixtureHelper; +import io.github.wulkanowy.api.StudentAndParent; public class AchievementsListTest { @@ -23,33 +22,25 @@ public class AchievementsListTest { Document notesPageDocument = Jsoup.parse(input); - Notes notes = Mockito.mock(Notes.class); - Mockito.when(notes.getNotesPageDocument()).thenReturn(notesPageDocument); + StudentAndParent snp = Mockito.mock(StudentAndParent.class); + Mockito.when(snp.getSnPPageDocument(Mockito.anyString())).thenReturn(notesPageDocument); - return new AchievementsList(notes); + return new AchievementsList(snp); } @Test public void getAllAchievementsFilledTest() throws Exception { - List expectedList = new ArrayList<>(); - expectedList.add("I miejsce w ogólnopolskim konkursie ortograficznym"); - expectedList.add("III miejsce w ogólnopolskim konkursie plastycznym"); + List list = getSetUpAchievementsList(fixtureFilledFileName).getAllAchievements(); - List actualList = getSetUpAchievementsList( - fixtureFilledFileName).getAllAchievements(); - - Assert.assertEquals(2, actualList.size()); - ReflectionAssert.assertReflectionEquals(expectedList, actualList); + Assert.assertEquals(2, list.size()); + Assert.assertEquals("I miejsce w ogólnopolskim konkursie ortograficznym", list.get(0)); + Assert.assertEquals("III miejsce w ogólnopolskim konkursie plastycznym", list.get(1)); } @Test public void getAllAchievementsEmptyTest() throws Exception { - List expectedList = new ArrayList<>(); + List list = getSetUpAchievementsList(fixtureEmptyFileName).getAllAchievements(); - List actualList = getSetUpAchievementsList( - fixtureEmptyFileName).getAllAchievements(); - - Assert.assertEquals(0, actualList.size()); - ReflectionAssert.assertReflectionEquals(expectedList, actualList); + Assert.assertEquals(0, list.size()); } } diff --git a/app/src/test/java/io/github/wulkanowy/api/notes/NotesListTest.java b/app/src/test/java/io/github/wulkanowy/api/notes/NotesListTest.java index 8a1f79da1..14f1f69f2 100644 --- a/app/src/test/java/io/github/wulkanowy/api/notes/NotesListTest.java +++ b/app/src/test/java/io/github/wulkanowy/api/notes/NotesListTest.java @@ -6,9 +6,7 @@ import org.jsoup.nodes.Element; import org.junit.Assert; import org.junit.Test; import org.mockito.Mockito; -import org.unitils.reflectionassert.ReflectionAssert; -import java.util.ArrayList; import java.util.List; import io.github.wulkanowy.api.FixtureHelper; @@ -25,50 +23,35 @@ public class NotesListTest { Document notesPageDocument = Jsoup.parse(input); - Notes notes = Mockito.mock(Notes.class); - Mockito.when(notes.getNotesPageDocument()).thenReturn(notesPageDocument); StudentAndParent snp = Mockito.mock(StudentAndParent.class); + Mockito.when(snp.getSnPPageDocument(Mockito.anyString())).thenReturn(notesPageDocument); Mockito.when(snp.getRowDataChildValue(Mockito.any(Element.class), Mockito.anyInt())).thenCallRealMethod(); - return new NotesList(notes, snp); + return new NotesList(snp); } @Test public void getAllNotesFilledTest() throws Exception { - List expectedList = new ArrayList<>(); - expectedList.add(new Note() - .setDate("06.06.2017") - .setTeacher("Jan Kowalski [JK]") - .setCategory("Zaangażowanie społeczne") - .setContent("Pomoc przy pikniku charytatywnym") - ); - expectedList.add(new Note() - .setDate("01.12.2016") - .setTeacher("Ochocka Zofia [PZ]") - .setCategory("Reprezentowanie szkoły") - .setContent("Udział w przygotowaniu spektaklu") - ); - expectedList.add(new Note() - .setDate("01.10.2016") - .setTeacher("Kochański Leszek [KL]") - .setCategory("Zachowanie na lekcji") - .setContent("Przeszkadzanie w prowadzeniu lekcji") - ); + List list = getSetUpNotesList(fixtureFilledFileName).getAllNotes(); - List actualList = getSetUpNotesList(fixtureFilledFileName).getAllNotes(); + Assert.assertEquals(3, list.size()); - Assert.assertEquals(3, actualList.size()); - ReflectionAssert.assertReflectionEquals(expectedList, actualList); + Assert.assertEquals("06.06.2017", list.get(0).getDate()); + Assert.assertEquals("Jan Kowalski [JK]", list.get(0).getTeacher()); + Assert.assertEquals("Zaangażowanie społeczne", list.get(0).getCategory()); + Assert.assertEquals("Pomoc przy pikniku charytatywnym", list.get(0).getContent()); + + Assert.assertEquals("01.10.2016", list.get(2).getDate()); + Assert.assertEquals("Kochański Leszek [KL]", list.get(2).getTeacher()); + Assert.assertEquals("Zachowanie na lekcji", list.get(2).getCategory()); + Assert.assertEquals("Przeszkadzanie w prowadzeniu lekcji", list.get(2).getContent()); } @Test public void getAllNotesWhenEmpty() throws Exception { - List actualList = getSetUpNotesList(fixtureEmptyFileName).getAllNotes(); + List list = getSetUpNotesList(fixtureEmptyFileName).getAllNotes(); - List expectedList = new ArrayList<>(); - - Assert.assertEquals(0, actualList.size()); - ReflectionAssert.assertReflectionEquals(expectedList, actualList); + Assert.assertEquals(0, list.size()); } } diff --git a/app/src/test/java/io/github/wulkanowy/api/school/SchoolInfoTest.java b/app/src/test/java/io/github/wulkanowy/api/school/SchoolInfoTest.java index 2875fd11d..850de52f8 100644 --- a/app/src/test/java/io/github/wulkanowy/api/school/SchoolInfoTest.java +++ b/app/src/test/java/io/github/wulkanowy/api/school/SchoolInfoTest.java @@ -11,7 +11,7 @@ public class SchoolInfoTest extends SchoolTest { @Before public void setUp() throws Exception { super.setUp(); - schoolInfo = new SchoolInfo(school, snp); + schoolInfo = new SchoolInfo(snp); } @Test diff --git a/app/src/test/java/io/github/wulkanowy/api/school/SchoolTest.java b/app/src/test/java/io/github/wulkanowy/api/school/SchoolTest.java index 213586915..81c3d28dd 100644 --- a/app/src/test/java/io/github/wulkanowy/api/school/SchoolTest.java +++ b/app/src/test/java/io/github/wulkanowy/api/school/SchoolTest.java @@ -11,7 +11,6 @@ import io.github.wulkanowy.api.StudentAndParent; public class SchoolTest { - protected School school; protected StudentAndParent snp; private String fixtureFileName = "Szkola.html"; @@ -21,9 +20,8 @@ public class SchoolTest { Document schoolPageDocument = Jsoup.parse(input); - school = Mockito.mock(School.class); - Mockito.when(school.getSchoolPageDocument()).thenReturn(schoolPageDocument); snp = Mockito.mock(StudentAndParent.class); + Mockito.when(snp.getSnPPageDocument(Mockito.anyString())).thenReturn(schoolPageDocument); Mockito.when(snp.getRowDataChildValue(Mockito.any(Element.class), Mockito.anyInt())).thenCallRealMethod(); } diff --git a/app/src/test/java/io/github/wulkanowy/api/school/TeachersInfoTest.java b/app/src/test/java/io/github/wulkanowy/api/school/TeachersInfoTest.java index 1b79dd989..3c7237c8c 100644 --- a/app/src/test/java/io/github/wulkanowy/api/school/TeachersInfoTest.java +++ b/app/src/test/java/io/github/wulkanowy/api/school/TeachersInfoTest.java @@ -13,7 +13,7 @@ public class TeachersInfoTest extends SchoolTest { @Before public void setUp() throws Exception { super.setUp(); - teachersInfo = new TeachersInfo(school); + teachersInfo = new TeachersInfo(snp); } @Test diff --git a/app/src/test/java/io/github/wulkanowy/api/timetable/TableTest.java b/app/src/test/java/io/github/wulkanowy/api/timetable/TableTest.java index b813f1238..230d68d48 100644 --- a/app/src/test/java/io/github/wulkanowy/api/timetable/TableTest.java +++ b/app/src/test/java/io/github/wulkanowy/api/timetable/TableTest.java @@ -7,27 +7,31 @@ import org.junit.Test; import org.mockito.Mockito; import io.github.wulkanowy.api.FixtureHelper; +import io.github.wulkanowy.api.StudentAndParent; public class TableTest { private String fixtureStdFileName = "PlanLekcji-std.html"; + private String fixtureHolidaysFileName = "PlanLekcji-holidays.html"; + private String fixtureFullFileName = "PlanLekcji-full.html"; - private Table getSetUpTable(String tick, String fixtureFileName) throws Exception { + private Table getSetUpTable(String fixtureFileName) throws Exception { String input = FixtureHelper.getAsString(getClass().getResourceAsStream(fixtureFileName)); Document tablePageDocument = Jsoup.parse(input); - Timetable timetable = Mockito.mock(Timetable.class); - Mockito.when(timetable.getTablePageDocument(tick)).thenReturn(tablePageDocument); + StudentAndParent timetable = Mockito.mock(StudentAndParent.class); + Mockito.when(timetable.getSnPPageDocument(Mockito.anyString())) + .thenReturn(tablePageDocument); return new Table(timetable); } @Test public void getWeekTableStandardTest() throws Exception { - Table table = getSetUpTable("", fixtureStdFileName); + Table table = getSetUpTable(fixtureStdFileName); Week week = table.getWeekTable(); Assert.assertEquals(5, week.getDays().size()); @@ -41,7 +45,7 @@ public class TableTest { @Test public void getWeekTableStandardLessonStartEndEndTest() throws Exception { - Table tableStd = getSetUpTable("", fixtureStdFileName); + Table tableStd = getSetUpTable(fixtureStdFileName); Week stdWeek = tableStd.getWeekTable(); Assert.assertEquals("08:00", stdWeek.getDay(0).getLesson(0).getStartTime()); @@ -49,7 +53,7 @@ public class TableTest { Assert.assertEquals("12:15", stdWeek.getDay(2).getLesson(4).getEndTime()); Assert.assertEquals("14:10", stdWeek.getDay(3).getLesson(7).getStartTime()); - Table tableFull = getSetUpTable("", fixtureFullFileName); + Table tableFull = getSetUpTable(fixtureFullFileName); Week fullWeek = tableFull.getWeekTable(); Assert.assertEquals("07:10", fullWeek.getDay(0).getLesson(0).getStartTime()); @@ -61,7 +65,7 @@ public class TableTest { @Test(expected = IndexOutOfBoundsException.class) public void getWeekTableStandardOutOfBoundsIndex() throws Exception { - Table table = getSetUpTable("", fixtureStdFileName); + Table table = getSetUpTable(fixtureStdFileName); Week week = table.getWeekTable(); week.getDay(5); @@ -69,7 +73,7 @@ public class TableTest { @Test public void getWeekTableHolidaysTest() throws Exception { - Table table = getSetUpTable("", fixtureHolidaysFileName); + Table table = getSetUpTable(fixtureHolidaysFileName); Week week = table.getWeekTable(); Assert.assertTrue(week.getDay(1).isFreeDay()); @@ -84,7 +88,7 @@ public class TableTest { @Test public void getWeekTableHolidaysWithEmptyLessonsTest() throws Exception { - Table table = getSetUpTable("", fixtureHolidaysFileName); + Table table = getSetUpTable(fixtureHolidaysFileName); Week week = table.getWeekTable(); Assert.assertEquals(5, week.getDays().size()); @@ -97,7 +101,7 @@ public class TableTest { @Test public void getWeekTableFullTest() throws Exception { - Table table = getSetUpTable("", fixtureFullFileName); + Table table = getSetUpTable(fixtureFullFileName); Week week = table.getWeekTable(); Assert.assertFalse(week.getDay(1).getLesson(2).isEmpty()); @@ -105,7 +109,7 @@ public class TableTest { @Test public void getWeekTableFullLessonsGroupsDivisionTest() throws Exception { - Table table = getSetUpTable("", fixtureFullFileName); + Table table = getSetUpTable(fixtureFullFileName); Week week = table.getWeekTable(); // class="", span*4 @@ -136,7 +140,7 @@ public class TableTest { @Test public void getWeekTableFullLessonsTypesTest() throws Exception { - Table table = getSetUpTable("", fixtureFullFileName); + Table table = getSetUpTable(fixtureFullFileName); Week week = table.getWeekTable(); // class="", span*4 @@ -177,7 +181,7 @@ public class TableTest { @Test public void getWeekTableFullLessonsBasicInfoTest() throws Exception { - Table table = getSetUpTable("", fixtureFullFileName); + Table table = getSetUpTable(fixtureFullFileName); Week week = table.getWeekTable(); // class="", span*4 diff --git a/app/src/test/java/io/github/wulkanowy/api/user/BasicInformationTest.java b/app/src/test/java/io/github/wulkanowy/api/user/BasicInformationTest.java new file mode 100644 index 000000000..e948235c8 --- /dev/null +++ b/app/src/test/java/io/github/wulkanowy/api/user/BasicInformationTest.java @@ -0,0 +1,50 @@ +package io.github.wulkanowy.api.user; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +public class BasicInformationTest extends UserTest { + + private BasicInformation basicInformation; + + @Before + public void setUp() throws Exception { + super.setUp(); + basicInformation = new BasicInformation(snp); + } + + @Test + public void getPersonalData() throws Exception { + PersonalData data = basicInformation.getPersonalData(); + + Assert.assertEquals("Maria", data.getFirstName()); + Assert.assertEquals("Kamińska", data.getSurname()); + Assert.assertEquals("Maria Kamińska", data.getFirstAndLastName()); + Assert.assertEquals("Maria Aneta Kamińska", data.getName()); + Assert.assertEquals("01.01.1900, Warszawa", data.getDateAndBirthPlace()); + Assert.assertEquals("12345678900", data.getPesel()); + Assert.assertEquals("Kobieta", data.getGender()); + Assert.assertTrue(data.isPolishCitizenship()); + Assert.assertEquals("Nowak", data.getFamilyName()); + Assert.assertEquals("Gabriela, Kamil", data.getParentsNames()); + } + + @Test + public void getAddressData() throws Exception { + AddressData data = basicInformation.getAddressData(); + + Assert.assertEquals("ul. Sportowa 16, 00-123 Warszawa", data.getAddress()); + Assert.assertEquals("ul. Sportowa 17, 00-123 Warszawa", data.getRegisteredAddress()); + Assert.assertEquals("ul. Sportowa 18, 00-123 Warszawa", data.getCorrespondenceAddress()); + } + + @Test + public void getContactDetails() throws Exception { + ContactDetails data = basicInformation.getContactDetails(); + + Assert.assertEquals("005554433", data.getPhoneNumber()); + Assert.assertEquals("555444333", data.getCellPhoneNumber()); + Assert.assertEquals("wulkanowy@example.null", data.getEmail()); + } +} diff --git a/app/src/test/java/io/github/wulkanowy/api/user/FamilyInformationTest.java b/app/src/test/java/io/github/wulkanowy/api/user/FamilyInformationTest.java new file mode 100644 index 000000000..a523836f1 --- /dev/null +++ b/app/src/test/java/io/github/wulkanowy/api/user/FamilyInformationTest.java @@ -0,0 +1,39 @@ +package io.github.wulkanowy.api.user; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import java.util.List; + +public class FamilyInformationTest extends UserTest { + + private FamilyInformation familyInformation; + + @Before + public void setUp() throws Exception { + super.setUp(); + familyInformation = new FamilyInformation(snp); + } + + @Test + public void getFamilyMembers() throws Exception { + List familyMemberList = familyInformation.getFamilyMembers(); + + Assert.assertEquals(2, familyMemberList.size()); + + FamilyMember member0 = familyMemberList.get(0); + Assert.assertEquals("Marianna Pająk", member0.getName()); + Assert.assertEquals("matka", member0.getKinship()); + Assert.assertEquals("ul. Sportowa 16, 00-123 Warszawa", member0.getAddress()); + Assert.assertEquals("555111222", member0.getTelephones()); + Assert.assertEquals("wulkanowy@example.null", member0.getEmail()); + + FamilyMember member1 = familyMemberList.get(1); + Assert.assertEquals("Dawid Świątek", member1.getName()); + Assert.assertEquals("ojciec", member1.getKinship()); + Assert.assertEquals("ul. Sportowa 18, 00-123 Warszawa", member1.getAddress()); + Assert.assertEquals("555222111", member1.getTelephones()); + Assert.assertEquals("wulkanowy@example.null", member1.getEmail()); + } +} diff --git a/app/src/test/java/io/github/wulkanowy/api/user/UserTest.java b/app/src/test/java/io/github/wulkanowy/api/user/UserTest.java new file mode 100644 index 000000000..ab0ed9d49 --- /dev/null +++ b/app/src/test/java/io/github/wulkanowy/api/user/UserTest.java @@ -0,0 +1,29 @@ +package io.github.wulkanowy.api.user; + +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; +import org.junit.Before; +import org.mockito.Mockito; + +import io.github.wulkanowy.api.FixtureHelper; +import io.github.wulkanowy.api.StudentAndParent; + +public class UserTest { + + protected StudentAndParent snp; + + private String fixtureFileName = "UczenDanePodstawowe.html"; + + @Before + public void setUp() throws Exception { + String input = FixtureHelper.getAsString(getClass().getResourceAsStream(fixtureFileName)); + + Document pageDocument = Jsoup.parse(input); + + snp = Mockito.mock(StudentAndParent.class); + Mockito.when(snp.getSnPPageDocument(Mockito.anyString())).thenReturn(pageDocument); + Mockito.when(snp.getRowDataChildValue(Mockito.any(Element.class), Mockito.anyInt())) + .thenCallRealMethod(); + } +} diff --git a/app/src/test/resources/io/github/wulkanowy/api/grades/OcenyWszystkie-subjects-average.html b/app/src/test/resources/io/github/wulkanowy/api/grades/OcenyWszystkie-subjects-average.html new file mode 100644 index 000000000..023b5405e --- /dev/null +++ b/app/src/test/resources/io/github/wulkanowy/api/grades/OcenyWszystkie-subjects-average.html @@ -0,0 +1,70 @@ + + + + + Witryna ucznia i rodzica – Oceny + + +
+

Oceny

+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PrzedmiotOceny cząstkoweŚredniaPrzewidywana ocena rocznaOcena roczna
ZachowanieBrak ocen-bardzo dobrebardzo dobre
Język polski03,53-dobry
Wychowanie fizyczne05,05bardzo dobrycelujący
Język angielski04,44/5bardzo dobry
Wiedza o społeczeństwieBrak ocen---
+
+
wersja: 17.02.0000.23328
+ + diff --git a/app/src/test/resources/io/github/wulkanowy/api/grades/OcenyWszystkie-subjects.html b/app/src/test/resources/io/github/wulkanowy/api/grades/OcenyWszystkie-subjects.html new file mode 100644 index 000000000..0f6da4148 --- /dev/null +++ b/app/src/test/resources/io/github/wulkanowy/api/grades/OcenyWszystkie-subjects.html @@ -0,0 +1,64 @@ + + + + + Witryna ucznia i rodzica – Oceny + + +
+

Oceny

+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PrzedmiotOceny cząstkowePrzewidywana ocena rocznaOcena roczna
Zachowanie-bardzo dobrebardzo dobre
Praktyka zawodowa--celujący
Metodologia programowania-bardzo dobrycelujący
Podstawy przedsiębiorczości-3/4dostateczny
Wychowanie do życia w rodzinie---
+
+
wersja: 17.05.0000.24042
+ + diff --git a/app/src/test/resources/io/github/wulkanowy/api/user/UczenDanePodstawowe.html b/app/src/test/resources/io/github/wulkanowy/api/user/UczenDanePodstawowe.html new file mode 100644 index 000000000..c54dd8614 --- /dev/null +++ b/app/src/test/resources/io/github/wulkanowy/api/user/UczenDanePodstawowe.html @@ -0,0 +1,119 @@ + + + + + Witryna ucznia i rodzica – Dane ucznia + + +
+

Dane podstawowe

+

Dane osobowe

+
+
+ Imię (imiona) nazwisko: + Maria Aneta Kamińska +
+
+ Data i miejsce urodzenia: + 01.01.1900, Warszawa +
+
+ PESEL: + 12345678900 +
+
+ Płeć: + Kobieta +
+
+ Obywatelstwo polskie: + Tak +
+
+ Nazwisko rodowe: + Nowak +
+
+ Imię matki i ojca: + Gabriela, Kamil +
+
+

Dane adresowe

+
+
+ Adres zamieszkania: + ul. Sportowa 16, 00-123 Warszawa +
+
+ Adres zameldowania: + ul. Sportowa 17, 00-123 Warszawa +
+
+ Adres korespondencji: + ul. Sportowa 18, 00-123 Warszawa +
+
+

Kontakt

+
+
+ Telefon: + 005554433 +
+
+ Telefon komórkowy: + 555444333 +
+
+ E-mail: + wulkanowy@example.null +
+
+

Rodzina

+
+
+ Nazwisko i imię: + Marianna Pająk +
+
+ Stopień pokrewieństwa: + matka +
+
+ Adres: + ul. Sportowa 16, 00-123 Warszawa +
+
+ Telefony: + 555111222 +
+
+ E-mail: + wulkanowy@example.null +
+
+
+
+ Nazwisko i imię: + Dawid Świątek +
+
+ Stopień pokrewieństwa: + ojciec +
+
+ Adres: + ul. Sportowa 18, 00-123 Warszawa +
+
+ Telefony: + 555222111 +
+
+ E-mail: + wulkanowy@example.null +
+
+
+ + +