aboutsummaryrefslogtreecommitdiff
path: root/app/src/test
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-09-15 00:33:22 -0700
committerAllan Wang <me@allanwang.ca>2019-09-15 00:33:22 -0700
commit509aca4c2c40f9418ae8866be5ba9f3fb4428d90 (patch)
treeb85a808f3c84fe6915a5fec0d9ab8ce1d0dc3329 /app/src/test
parent5071a44197cdc3b7ad4a2c3d188fcfd205f32449 (diff)
downloadfrost-509aca4c2c40f9418ae8866be5ba9f3fb4428d90.tar.gz
frost-509aca4c2c40f9418ae8866be5ba9f3fb4428d90.tar.bz2
frost-509aca4c2c40f9418ae8866be5ba9f3fb4428d90.zip
Remove auth and native ui elements by default
Diffstat (limited to 'app/src/test')
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/facebook/requests/FbRequestTest.kt93
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/internal/Internal.kt7
2 files changed, 0 insertions, 100 deletions
diff --git a/app/src/test/kotlin/com/pitchedapps/frost/facebook/requests/FbRequestTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/facebook/requests/FbRequestTest.kt
deleted file mode 100644
index 67f62a40..00000000
--- a/app/src/test/kotlin/com/pitchedapps/frost/facebook/requests/FbRequestTest.kt
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright 2018 Allan Wang
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package com.pitchedapps.frost.facebook.requests
-
-import com.fasterxml.jackson.databind.ObjectMapper
-import com.pitchedapps.frost.internal.AUTH
-import com.pitchedapps.frost.internal.COOKIE
-import com.pitchedapps.frost.internal.USER_ID
-import com.pitchedapps.frost.internal.authDependent
-import okhttp3.Call
-import org.junit.BeforeClass
-import org.junit.Ignore
-import org.junit.Test
-import kotlin.test.assertEquals
-import kotlin.test.assertFalse
-import kotlin.test.assertNotNull
-import kotlin.test.assertTrue
-import kotlin.test.fail
-
-/**
- * Created by Allan Wang on 21/12/17.
- */
-class FbRequestTest {
-
- companion object {
- @BeforeClass
- @JvmStatic
- fun before() {
- authDependent()
- }
- }
-
- /**
- * Used to emulate [executeForNoError]
- * Must be consistent with that method
- */
- private fun Call.assertNoError() {
- val data = execute().body()?.string() ?: fail("Content was null")
- println("Call response: $data")
- assertTrue(data.isNotEmpty(), "Content was empty")
- assertFalse(data.contains("error"), "Content had error")
- }
-
- @Test
- fun auth() {
- val auth = COOKIE.getAuth()
- assertNotNull(auth)
- assertEquals(USER_ID, auth.userId)
- assertEquals(COOKIE, auth.cookie)
- println("Test auth: ${auth.fb_dtsg}")
- }
-
- @Test
- @Ignore("Post requests are now experimental")
- fun markNotification() {
- val notifId = 1514443903880
- AUTH.markNotificationRead(notifId).call.assertNoError()
- }
-
- @Ignore("Broken as of 2019/01/03; however, this was never used in production to begin with")
- @Test
- fun fullSizeImage() {
- val fbid = 10150706277522838L // google's current cover photo
- val url = AUTH.getFullSizedImage(fbid).invoke()
- println(url)
- assertEquals(true, url?.startsWith("https://scontent"), "Bad start for url $url")
- }
-
- @Test
- fun testMenu() {
- val data = AUTH.getMenuData().invoke()
- assertNotNull(data)
- println(ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(data))
- assertTrue(data.data.isNotEmpty())
- assertTrue(data.footer.hasContent, "Footer may be badly parsed")
- val items = data.flatMapValid()
- assertTrue(items.size > 15, "Something may be badly parsed")
- }
-}
diff --git a/app/src/test/kotlin/com/pitchedapps/frost/internal/Internal.kt b/app/src/test/kotlin/com/pitchedapps/frost/internal/Internal.kt
index 41473e86..d0d5c019 100644
--- a/app/src/test/kotlin/com/pitchedapps/frost/internal/Internal.kt
+++ b/app/src/test/kotlin/com/pitchedapps/frost/internal/Internal.kt
@@ -19,8 +19,6 @@ package com.pitchedapps.frost.internal
import com.pitchedapps.frost.facebook.FB_USER_MATCHER
import com.pitchedapps.frost.facebook.FbItem
import com.pitchedapps.frost.facebook.get
-import com.pitchedapps.frost.facebook.requests.RequestAuth
-import com.pitchedapps.frost.facebook.requests.getAuth
import com.pitchedapps.frost.utils.frostJsoup
import org.junit.Assume
import java.io.File
@@ -53,11 +51,6 @@ val PROPS: Properties by lazy {
val COOKIE: String by lazy { PROPS.getProperty("COOKIE") ?: "" }
val USER_ID: Long by lazy { FB_USER_MATCHER.find(COOKIE)[1]?.toLong() ?: -1 }
-val AUTH: RequestAuth by lazy {
- COOKIE.getAuth().apply {
- println("Auth:\nuser:$userId\nfb_dtsg: $fb_dtsg\nrev: $rev\ncomplete: $isComplete")
- }
-}
private val VALID_COOKIE: Boolean by lazy {
val data = testJsoup(FbItem.SETTINGS.url)