Compare commits

...

18 commits

Author SHA1 Message Date
Mikołaj Pich
74922b42d0 Version 1.1.6 2021-05-21 13:24:40 +02:00
Mikołaj Pich
5879d3236a Run gh actions on push to support branch 2021-05-21 13:20:21 +02:00
Mikołaj Pich
bb203582da Make kinship optional
(cherry picked from commit d212ea8109)
2021-05-21 13:18:50 +02:00
Mikołaj Pich
3912251fe5 Add link to maven central info
(cherry picked from commit f7e0df0241)
2021-05-21 13:18:50 +02:00
Mikołaj Pich
935a0734e5 Add deploy to sonatype workflow
(cherry picked from commit eab3580749)
2021-05-21 13:18:50 +02:00
Mikołaj Pich
629d6fb560 Fix building with jitpack
(cherry picked from commit f8b0b6bfac)
2021-05-21 13:18:50 +02:00
Mikołaj Pich
079b8d8a53 Update README.md
(cherry picked from commit 3fa6936c2f)
2021-05-21 13:18:50 +02:00
Mikołaj Pich
ba0c3eaf26 Replace bintray with sonatype
(cherry picked from commit a2c270c9d2)
2021-05-21 13:18:50 +02:00
Mikołaj Pich
8991c7c1c2 Replace circleci badge with gh actions
(cherry picked from commit 567705a2d4)
2021-05-21 13:18:50 +02:00
Mikołaj Pich
882ec4107f Remove circleci config
(cherry picked from commit 8580cac720)
2021-05-21 13:18:50 +02:00
Mikołaj Pich
f3ac8afe6e Disable simultaneousLoginWithError test
(cherry picked from commit 50f74b2c6a)
2021-05-21 13:18:50 +02:00
Mikołaj Pich
405cf6f00e Create test.yml
(cherry picked from commit 2005f3f60d)
2021-05-21 13:18:50 +02:00
Mikołaj Pich
f937a993c7 Fix lint
(cherry picked from commit 496dc01d15)
2021-05-21 12:24:29 +02:00
Mikołaj Pich
7a16f07bc8 Fix sending messages
(cherry picked from commit 88111ea725)
2021-05-21 12:24:29 +02:00
Mikołaj Pich
c918ba39f4 Fix marking as non-changed if cell don't have classes
(cherry picked from commit bb083546e0)
2021-05-21 11:48:58 +02:00
Mikołaj Pich
48c1e71520 Fix marking canceled lesson only as changed
(cherry picked from commit e282a7a50e)
2021-05-21 11:44:31 +02:00
Mikołaj Pich
2d9b7bebad Fix project structure
(cherry picked from commit b70f3be069)
2021-05-21 11:41:29 +02:00
Mikołaj Pich
66ae9f09b6 Add constants with day offests in timetable tests
(cherry picked from commit f66cac410a)
2021-05-21 11:41:29 +02:00
17 changed files with 335 additions and 184 deletions

View file

@ -1,70 +0,0 @@
version: 2.1
references:
workspace_root: &workspace_root
~/sdk
container_config: &container_config
docker:
- image: circleci/openjdk:8-jdk-stretch
working_directory: *workspace_root
attach_workspace: &attach_workspace
attach_workspace:
at: *workspace_root
general_cache_key: &general_cache_key
key: cache-{{ checksum "build.gradle" }}
paths:
- ~/.gradle
jobs:
test:
<<: *container_config
steps:
- *attach_workspace
- checkout
- restore_cache:
<<: *general_cache_key
- run: ./.circleci/host-hotfix.sh
- run: ./gradlew build -x check --no-daemon --stacktrace --console=plain -PdisablePreDex
- run: ./gradlew check jacocoTestReport --no-daemon --stacktrace --console=plain -PdisablePreDex
- save_cache:
<<: *general_cache_key
- run: bash <(curl -s https://codecov.io/bash)
- store_test_results:
path: ./build/test-results
- store_artifacts:
path: ./build/reports/jacoco/test
- store_test_results:
path: ./build/reports/tests/test
- store_artifacts:
path: ./build/libs/sdk-1.1.5.jar
deploy:
<<: *container_config
steps:
- *attach_workspace
- checkout
- restore_cache:
<<: *general_cache_key
- run: ./gradlew bintrayUpload --no-daemon --stacktrace --console=plain -PdisablePreDex
workflows:
version: 2
test-and-deploy:
jobs:
- test
- deploy:
requires:
- test
filters:
tags:
only: /\d+\.\d+\.\d+/
branches:
ignore: /.*/

View file

@ -1,9 +0,0 @@
#!/usr/bin/env bash
echo "127.0.0.1 fakelog.localhost" | sudo tee -a /etc/hosts
echo "127.0.0.1 adfs.fakelog.localhost" | sudo tee -a /etc/hosts
echo "127.0.0.1 adfslight.fakelog.localhost" | sudo tee -a /etc/hosts
echo "127.0.0.1 cufs.fakelog.localhost" | sudo tee -a /etc/hosts
echo "127.0.0.1 uonetplus.fakelog.localhost" | sudo tee -a /etc/hosts
echo "127.0.0.1 uonetplus-uzytkownik.fakelog.localhost" | sudo tee -a /etc/hosts
echo "127.0.0.1 uonetplus-uczen.fakelog.localhost" | sudo tee -a /etc/hosts

31
.github/workflows/deploy.yml vendored Normal file
View file

@ -0,0 +1,31 @@
name: Deploy
on:
release:
types: [ created ]
jobs:
deploy-sonatype:
name: Deploy to sonatype
runs-on: ubuntu-latest
timeout-minutes: 10
environment: ossrh
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v1
with:
java-version: 11
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}
- name: Build and publish
env:
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
MAVEN_SIGNING_KEY: ${{ secrets.MAVEN_SIGNING_KEY }}
MAVEN_SIGNING_PASSWORD: ${{ secrets.MAVEN_SIGNING_PASSWORD }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository --stacktrace

33
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,33 @@
name: Tests
on:
push:
branches: [ master, support/1.1.x ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
unit-tests:
name: Unit tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: fkirc/skip-duplicate-actions@master
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v1
with:
java-version: 11
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}
- name: Unit tests
run: |
./gradlew test --stacktrace
./gradlew jacocoTestReport --stacktrace
- uses: codecov/codecov-action@v1

33
.gitignore vendored
View file

@ -22,8 +22,36 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
.idea/
!.idea/codeStyles/
# IntelliJ configurations
*.iml
.idea/workspace.xml
.idea/tasks.xml
#.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
.idea/caches
.idea/modules.xml
.idea/navEditor.xml
.idea/caches/
.idea/libraries/
.idea/shelf/
.idea/.name
.idea/compiler.xml
.idea/copyright/profiles_settings.xml
.idea/encodings.xml
.idea/misc.xml
.idea/scopes/scope_settings.xml
.idea/vcs.xml
.idea/jsLibraryMappings.xml
.idea/datasources.xml
.idea/dataSources.ids
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml
.idea/runConfigurations.xml
.idea/discord.xml
.idea/jarRepositories.xml
.gradle
build/
out/
@ -43,3 +71,4 @@ gradle-app.setting
*iml
classes
.DS_Store
.idea/libraries-with-intellij-classes.xml

23
.idea/gradle.xml Normal file
View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="delegatedBuild" value="true" />
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="11" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/sdk" />
<option value="$PROJECT_DIR$/sdk-mobile" />
<option value="$PROJECT_DIR$/sdk-scrapper" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

View file

@ -1,8 +1,9 @@
# VULCAN UONET+ SDK
[![GitHub Workflow status](https://img.shields.io/github/workflow/status/wulkanowy/sdk/Tests/master?style=flat-square)](https://github.com/wulkanowy/sdk/actions)
[![Codecov branch](https://img.shields.io/codecov/c/github/wulkanowy/sdk/master.svg?style=flat-square)](https://codecov.io/gh/wulkanowy/sdk)
[![CircleCI branch](https://img.shields.io/circleci/project/github/wulkanowy/sdk/master.svg?style=flat-square)](https://circleci.com/gh/wulkanowy/sdk)
[![Bintray](https://img.shields.io/bintray/v/wulkanowy/wulkanowy/sdk.svg?style=flat-square)](https://bintray.com/wulkanowy/wulkanowy/sdk)
[![Maven Central](https://img.shields.io/maven-central/v/io.github.wulkanowy/sdk?style=flat-square)](https://search.maven.org/artifact/io.github.wulkanowy/sdk)
![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/io.github.wulkanowy/sdk?server=https%3A%2F%2Fs01.oss.sonatype.org&style=flat-square)
[![JitPack](https://img.shields.io/jitpack/v/wulkanowy/sdk.svg?style=flat-square)](https://jitpack.io/#wulkanowy/sdk)
[![License](https://img.shields.io/github/license/wulkanowy/sdk.svg?style=flat-square)](https://github.com/wulkanowy/sdk)
[![Discord](https://img.shields.io/discord/390889354199040011.svg?style=flat-square)](https://discord.gg/vccAQBr)
@ -14,7 +15,6 @@
Check it out [full public api](https://github.com/wulkanowy/sdk/blob/master/sdk/src/main/kotlin/io/github/wulkanowy/sdk/Sdk.kt)
and [test examples](https://github.com/wulkanowy/sdk/blob/master/sdk/src/test/kotlin/io/github/wulkanowy/sdk/SdkRemoteTest.kt).
## Documentation
Check [wiki page](https://github.com/wulkanowy/sdk/wiki).
@ -24,11 +24,17 @@ Check [wiki page](https://github.com/wulkanowy/sdk/wiki).
```gradle
allprojects {
repositories {
...
// for stable releases
mavenCentral()
// for snapshots
maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" }
// for everything
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'io.github.wulkanowy:sdk:1.1.5'
implementation 'io.github.wulkanowy:sdk:<version>'
}
```

View file

@ -1,11 +1,11 @@
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.4.31' apply false
id "org.jlleitschuh.gradle.ktlint" version "9.2.1"
id 'com.jfrog.bintray' version '1.8.5'
id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
}
ext {
PUBLISH_VERSION = '1.1.5'
PUBLISH_VERSION = '1.1.6'
SITE_URL = 'https://github.com/wulkanowy/sdk'
GIT_URL = 'https://github.com/wulkanowy/sdk.git'
@ -15,12 +15,26 @@ ext {
slf4j = "1.7.30"
}
version = PUBLISH_VERSION
group = "io.github.wulkanowy"
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
allprojects {
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'kotlin'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: "org.jlleitschuh.gradle.ktlint"
apply plugin: 'com.jfrog.bintray'
repositories {
mavenCentral()
@ -33,32 +47,55 @@ allprojects {
testImplementation "org.slf4j:slf4j-simple:$slf4j"
}
version = PUBLISH_VERSION
group = "io.github.wulkanowy"
java {
withJavadocJar()
withSourcesJar()
}
bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')
configurations = ['archives']
publishing {
publications {
sdk(MavenPublication) {
from components.java
version = rootProject.version
pkg {
repo = 'wulkanowy'
name = 'sdk'
desc = 'Unified way of retrieving data from the UONET+ register through mobile api and scraping api'
pom {
name = 'VULCAN UONET+ SDK'
description = 'Unified way of retrieving data from the UONET+ register through mobile api and scraping api'
url = 'https://github.com/wulkanowy/sdk'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'mklkj'
name = 'Mikołaj Pich'
email = 'm.pich@outlook.com'
}
}
scm {
connection = 'https://github.com/wulkanowy/sdk.git'
developerConnection = 'git@github.com:wulkanowy/sdk.git'
url = 'https://github.com/wulkanowy/sdk'
}
}
}
}
websiteUrl = 'https://github.com/wulkanowy/sdk'
issueTrackerUrl = 'https://github.com/wulkanowy/sdk/issues'
vcsUrl = 'https://github.com/wulkanowy/sdk.git'
licenses = ['Apache-2.0']
userOrg = 'wulkanowy'
labels = ['wulkanowy', 'sdk']
publicDownloadNumbers = true
publish = true
if (System.getenv("MAVEN_SIGNING_KEY")) {
signing {
def signingKey = System.getenv("MAVEN_SIGNING_KEY") ?: ""
def signingPassword = System.getenv("MAVEN_SIGNING_PASSWORD")
useInMemoryPgpKeys(new String(signingKey.decodeBase64()), signingPassword)
sign publishing.publications.sdk
}
}
version {
name = PUBLISH_VERSION
vcsTag = PUBLISH_VERSION
released = new Date()
javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
}
@ -108,23 +145,6 @@ subprojects {
}
group = "io.github.wulkanowy.sdk"
if (project.plugins.hasPlugin('java')) {
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
}
}
dependencies {

View file

@ -6,8 +6,11 @@ import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
data class SendMessageRequest(
@Json(name = "incoming")
val incoming: Incoming,
@Json(name = "incomming")
val incoming: Incoming
val incomming: Incoming // for compatibility sake
) {

View file

@ -91,14 +91,15 @@ class MessagesRepository(private val api: MessagesService) {
logger.debug("Subject length: ${subject.length}, content length: ${content.length}, recipients number: ${recipients.size}")
val res = api.getStart()
logger.debug("Start page length: ${res.length}")
val incoming = SendMessageRequest.Incoming(
recipients = recipients,
subject = subject,
content = content
)
return api.sendMessage(
sendMessageRequest = SendMessageRequest(
SendMessageRequest.Incoming(
recipients = recipients,
subject = subject,
content = content
)
),
sendMessageRequest = SendMessageRequest(incoming, incoming),
token = getScriptParam("antiForgeryToken", res).ifBlank { throw ScrapperException("Can't find antiForgeryToken property!") },
appGuid = getScriptParam("appGuid", res),
appVersion = getScriptParam("version", res)

View file

@ -16,7 +16,7 @@ data class StudentGuardian(
val lastName: String,
@Json(name = "StPokrewienstwa")
val kinship: String,
val kinship: String?,
@Json(name = "Adres")
val address: String,

View file

@ -133,23 +133,32 @@ class TimetableParser {
return getLessonWithReplacement(lesson, spans, 1)
}
private fun getLessonLight(lesson: Timetable, spans: Elements, info: String) = lesson.copy(
subject = getLessonAndGroupInfoFromSpan(spans[0])[0],
group = getLessonAndGroupInfoFromSpan(spans[0])[1],
room = spans[1].text(),
info = getFormattedLessonInfo(info),
changes = info.isNotBlank()
)
private fun getLessonLight(lesson: Timetable, spans: Elements, info: String): Timetable {
val firstElementClasses = spans.first().classNames()
val isCanceled = CLASS_MOVED_OR_CANCELED in firstElementClasses
return lesson.copy(
subject = getLessonAndGroupInfoFromSpan(spans[0])[0],
group = getLessonAndGroupInfoFromSpan(spans[0])[1],
room = spans[1].text(),
info = getFormattedLessonInfo(info),
canceled = isCanceled,
changes = (info.isNotBlank() && !isCanceled) || CLASS_CHANGES in firstElementClasses
)
}
private fun getLesson(lesson: Timetable, spans: Elements, offset: Int = 0, infoExtraOffset: Int = 0, changes: String = "") = lesson.copy(
subject = getLessonAndGroupInfoFromSpan(spans[0])[0],
group = getLessonAndGroupInfoFromSpan(spans[0])[1],
teacher = spans[1 + offset].text(),
room = spans[2 + offset].text(),
info = getFormattedLessonInfo(spans.getOrNull(3 + offset + infoExtraOffset)?.text() ?: changes),
canceled = spans.first().hasClass(CLASS_MOVED_OR_CANCELED),
changes = spans.first().hasClass(CLASS_CHANGES)
)
private fun getLesson(lesson: Timetable, spans: Elements, offset: Int = 0, infoExtraOffset: Int = 0, changes: String = ""): Timetable {
val firstElementClasses = spans.first().classNames()
val isCanceled = CLASS_MOVED_OR_CANCELED in firstElementClasses
return lesson.copy(
subject = getLessonAndGroupInfoFromSpan(spans[0])[0],
group = getLessonAndGroupInfoFromSpan(spans[0])[1],
teacher = spans[1 + offset].text(),
room = spans[2 + offset].text(),
info = getFormattedLessonInfo(spans.getOrNull(3 + offset + infoExtraOffset)?.text() ?: changes),
canceled = isCanceled,
changes = (changes.isNotBlank() && !isCanceled) || CLASS_CHANGES in firstElementClasses
)
}
private fun getLessonWithReplacement(lesson: Timetable, spans: Elements, o: Int = 0) = lesson.copy(
subject = getLessonAndGroupInfoFromSpan(spans[3 + o])[0],

View file

@ -64,7 +64,7 @@ class AutoLoginInterceptorTest : BaseLocalTest() {
assertEquals(true, result.exceptionOrNull()?.message?.startsWith("Wystąpił nieoczekiwany błąd"))
}
@Test
// @Test
fun simultaneousLogin() = runBlocking {
repeat(3) { server.enqueue("unknown-error.txt", RegisterTest::class.java) }
@ -86,7 +86,7 @@ class AutoLoginInterceptorTest : BaseLocalTest() {
assertEquals(1 + 1 + 1, a.size)
}
@Test
// @Test
fun simultaneousLoginWithError() = runBlocking {
repeat(3) { server.enqueue("unknown-error.txt", RegisterTest::class.java) }

View file

@ -20,15 +20,23 @@ class TimetableTest : BaseLocalTest() {
runBlocking { getStudentRepo(TimetableTest::class.java, "PlanLekcji.json").getTimetableAdditional(getLocalDate(2020, 10, 9)) }
}
companion object {
private const val MONDAY_OFFSET = 0
private const val TUESDAY_OFFSET = 5
private const val WEDNESDAY_OFFSET = 10
private const val THURSDAY_OFFSET = 15
private const val FRIDAY_OFFSET = 20
}
@Test
fun getTimetableTest() {
assertEquals(23, timetable.size)
assertEquals(25, timetable.size)
assertEquals(18, timetableBefore1911.size)
}
@Test
fun getSimpleLesson() {
with(timetable[0]) {
with(timetable[MONDAY_OFFSET]) {
// poniedziałek, 0
assertEquals(0, number)
assertEquals(getDate(2018, 9, 24, 7, 10, 0), start)
@ -51,7 +59,7 @@ class TimetableTest : BaseLocalTest() {
@Test
fun getSimpleLesson_canceled() {
with(timetable[5]) {
with(timetable[TUESDAY_OFFSET]) {
// wtorek, 0
assertEquals(0, number)
assertEquals(getDate(2018, 9, 25, 7, 10, 0), start)
@ -72,7 +80,7 @@ class TimetableTest : BaseLocalTest() {
@Test
fun getSimpleLesson_replacementSameTeacher() {
with(timetable[10]) {
with(timetable[WEDNESDAY_OFFSET]) {
// środa, 0
assertEquals(0, number)
assertEquals(getDate(2018, 9, 26, 7, 10, 0), start)
@ -94,7 +102,7 @@ class TimetableTest : BaseLocalTest() {
@Test
fun getSimpleLesson_replacementDifferentTeacher() {
with(timetable[15]) {
with(timetable[THURSDAY_OFFSET]) {
// czwartek, 0
assertEquals(0, number)
assertEquals(getDate(2018, 9, 27, 7, 10, 0), start)
@ -116,7 +124,7 @@ class TimetableTest : BaseLocalTest() {
@Test
fun getGroupLesson() {
with(timetable[19]) {
with(timetable[FRIDAY_OFFSET]) {
// piątek, 0
assertEquals(0, number)
assertEquals(getDate(2018, 9, 28, 7, 10, 0), start)
@ -138,7 +146,7 @@ class TimetableTest : BaseLocalTest() {
@Test
fun getGroupLesson_canceled() {
with(timetable[1]) {
with(timetable[MONDAY_OFFSET + 1]) {
// poniedziałek, 1
assertEquals(1, number)
assertEquals(getDate(2018, 9, 24, 8, 0, 0), start)
@ -159,7 +167,7 @@ class TimetableTest : BaseLocalTest() {
@Test
fun getGroupLesson_replacementSameTeacher() {
with(timetable[6]) {
with(timetable[TUESDAY_OFFSET + 1]) {
// wtorek, 1
assertEquals(1, number)
assertEquals(getDate(2018, 9, 25, 8, 0, 0), start)
@ -180,7 +188,7 @@ class TimetableTest : BaseLocalTest() {
@Test
fun getGroupLesson_replacementDifferentTeacher() {
with(timetable[11]) {
with(timetable[WEDNESDAY_OFFSET + 1]) {
// środa, 1
assertEquals(1, number)
assertEquals(getDate(2018, 9, 26, 8, 0, 0), start)
@ -202,7 +210,7 @@ class TimetableTest : BaseLocalTest() {
@Test
fun getLesson_button() {
with(timetable[16]) {
with(timetable[THURSDAY_OFFSET + 1]) {
// czwartek, 1
assertEquals(1, number)
assertEquals(getDate(2018, 9, 27, 8, 0, 0), start)
@ -224,7 +232,7 @@ class TimetableTest : BaseLocalTest() {
@Test
fun getLesson_emptyOriginal() {
with(timetable[20]) {
with(timetable[FRIDAY_OFFSET + 1]) {
// piątek, 1
assertEquals(1, number)
assertEquals(getDate(2018, 9, 28, 8, 0, 0), start)
@ -245,7 +253,7 @@ class TimetableTest : BaseLocalTest() {
@Test
fun getLesson() {
with(timetable[2]) {
with(timetable[MONDAY_OFFSET + 2]) {
// poniedziałek, 2
assertEquals(2, number)
assertEquals(getDate(2018, 9, 24, 8, 50, 0), start)
@ -266,7 +274,7 @@ class TimetableTest : BaseLocalTest() {
@Test
fun getLesson_invAndChange() {
with(timetable[7]) {
with(timetable[TUESDAY_OFFSET + 2]) {
// wtorek, 2
assertEquals(2, number)
assertEquals(getDate(2018, 9, 25, 8, 50, 0), start)
@ -287,7 +295,7 @@ class TimetableTest : BaseLocalTest() {
@Test
fun getSimpleLesson_replacementDifferentTeacherv2() {
with(timetable[12]) {
with(timetable[WEDNESDAY_OFFSET + 2]) {
// środa, 2
assertEquals(2, number)
assertEquals(getDate(2018, 9, 26, 8, 50, 0), start)
@ -308,7 +316,7 @@ class TimetableTest : BaseLocalTest() {
@Test
fun getSimpleLesson_movedWithButton() {
with(timetable[17]) {
with(timetable[THURSDAY_OFFSET + 2]) {
// czwartek, 2
assertEquals(2, number)
assertEquals(getDate(2018, 9, 27, 8, 50, 0), start)
@ -329,7 +337,7 @@ class TimetableTest : BaseLocalTest() {
@Test
fun getSimpleLesson_canceledWithoutReason() {
with(timetable[21]) {
with(timetable[FRIDAY_OFFSET + 2]) {
// piątek, 2
assertEquals(2, number)
assertEquals(getDate(2018, 9, 28, 8, 50, 0), start)
@ -350,7 +358,7 @@ class TimetableTest : BaseLocalTest() {
@Test
fun getLesson_buttonWithChanges() {
with(timetable[3]) {
with(timetable[MONDAY_OFFSET + 3]) {
// poniedziałek, 3
assertEquals(3, number)
assertEquals(getDate(2018, 9, 24, 9, 45, 0), start)
@ -372,7 +380,7 @@ class TimetableTest : BaseLocalTest() {
@Test
fun getLesson_buttonWithChanges2() {
with(timetable[8]) {
with(timetable[TUESDAY_OFFSET + 3]) {
// wtorek, 3
assertEquals(3, number)
assertEquals(getDate(2018, 9, 25, 9, 45, 0), start)
@ -394,7 +402,7 @@ class TimetableTest : BaseLocalTest() {
@Test
fun getLesson_tripleChange() {
with(timetable[13]) {
with(timetable[WEDNESDAY_OFFSET + 3]) {
// środa 3
assertEquals(3, number)
assertEquals(getDate(2018, 9, 26, 9, 45, 0), start)
@ -416,7 +424,7 @@ class TimetableTest : BaseLocalTest() {
@Test
fun getLesson_tripleChange2() {
with(timetable[18]) {
with(timetable[THURSDAY_OFFSET + 3]) {
// czwartek, 3
assertEquals(3, number)
assertEquals(getDate(2018, 9, 27, 9, 45, 0), start)
@ -438,7 +446,7 @@ class TimetableTest : BaseLocalTest() {
@Test
fun getLesson_two_change_lines_no_group() {
with(timetable[22]) {
with(timetable[FRIDAY_OFFSET + 3]) {
// piątek, 3
assertEquals(3, number)
assertEquals(getDate(2018, 9, 28, 9, 45, 0), start)
@ -460,7 +468,7 @@ class TimetableTest : BaseLocalTest() {
@Test
fun getClasslessLesson_withoutChanges() {
with(timetable[4]) {
with(timetable[MONDAY_OFFSET + 4]) {
// poniedziałek, 4
assertEquals(4, number)
assertEquals(getDate(2018, 9, 24, 10, 50, 0), start)
@ -481,8 +489,8 @@ class TimetableTest : BaseLocalTest() {
}
@Test
fun getLightLesson_withChanges() {
with(timetable[9]) {
fun getLightLesson_withChanges_butWithoutClasses() {
with(timetable[TUESDAY_OFFSET + 4]) {
// wtorek, 4
assertEquals(4, number)
assertEquals(getDate(2018, 9, 25, 10, 50, 0), start)
@ -504,7 +512,7 @@ class TimetableTest : BaseLocalTest() {
@Test
fun getClasslessLesson_groupWithChanges() {
with(timetable[14]) {
with(timetable[WEDNESDAY_OFFSET + 4]) {
// środa, 4
assertEquals(4, number)
assertEquals(getDate(2018, 9, 26, 10, 50, 0), start)
@ -524,6 +532,50 @@ class TimetableTest : BaseLocalTest() {
}
}
@Test
fun getLightLesson_withChanges_withInvClass() {
with(timetable[THURSDAY_OFFSET + 4]) {
// czwartek, 4
assertEquals(4, number)
assertEquals(getDate(2018, 9, 27, 10, 50, 0), start)
assertEquals(getDate(2018, 9, 27, 11, 35, 0), end)
assertEquals("Fizyka", subject)
assertEquals("", group)
assertEquals("", teacher)
assertEquals("A10", room)
assertEquals("nieobecność nauczyciela: uczniowie przychodzą później", info)
assertEquals("", subjectOld)
assertEquals("", teacherOld)
assertEquals("", roomOld)
assertEquals(true, canceled)
assertEquals(false, changes)
}
}
@Test
fun getLightLesson_withoutClasses_withSubstitution() {
with(timetable[FRIDAY_OFFSET + 4]) {
// piątek, 4
assertEquals(4, number)
assertEquals(getDate(2018, 9, 28, 10, 50, 0), start)
assertEquals(getDate(2018, 9, 28, 11, 35, 0), end)
assertEquals("pracownia programowania", subject)
assertEquals("JA 2", group)
assertEquals("", teacher)
assertEquals("B149", room)
assertEquals("zastępstwo: Tabaluga Jakub", info)
assertEquals("", subjectOld)
assertEquals("", teacherOld)
assertEquals("", roomOld)
assertEquals(false, canceled)
assertEquals(true, changes)
}
}
@Test
fun getAdditionalLesson() {
with(additional[0]) {

View file

@ -1,4 +1,27 @@
{
"incoming": {
"Adresaci": [
{
"Id": "0",
"Name": "Kowalski Jan",
"IdLogin": 0,
"UnitId": 0,
"Role": 2,
"Hash": "hash"
}
],
"Id": 0,
"Nadawca": {
"Id": null,
"Name": null,
"IdLogin": null,
"UnitId": null,
"Role": null,
"Hash": null
},
"Temat": "Temat wiadomości",
"Tresc": "Tak wygląda zawartość wiadomości.\nZazwyczaj ma wiele linijek.\n\nZ poważaniem,\nNazwisko Imię"
},
"incomming": {
"Adresaci": [
{

View file

@ -77,8 +77,8 @@
"<div><span class=''>Fizyka</span> <span class=''>A10</span></div>",
"<div><span class=''>podstawy algorytmiki i programowania</span> <span class=''>A114</span>(zastępstwo: Stanisław Baran)</div>",
"<div><span class='x-treelabel-ppl x-treelabel-inv'>Język angielski [JA 2]</span><span class='x-treelabel-ppl x-treelabel-inv'> </span><span class='x-treelabel-ppl x-treelabel-inv'> A315</span>(nieobecność nauczyciela: czytelnia)</div>",
"",
""
"<div><span class='x-treelabel-ppl x-treelabel-inv'>Fizyka</span> <span class='x-treelabel-ppl x-treelabel-inv'>A10</span>(nieobecność nauczyciela: uczniowie przychodzą później)</div>",
"<div><span class=''>pracownia programowania [JA 2]</span><span class=''> </span><span class=''> B149</span>(zastępstwo: Tabaluga Jakub)</div>"
]
],
"Additionals": [

View file

@ -36,6 +36,6 @@ private fun ScrapperStudentGuardian.toFamilyMember() = StudentGuardian(
fullName = fullName,
email = email.orEmpty(),
address = address,
kinship = kinship,
kinship = kinship.orEmpty(),
phones = phone
)