Skip to content

Commit 8626c0c

Browse files
committed
Ignore tests if Dropbox isn't enabled, and explain in README
1 parent 97b3156 commit 8626c0c

File tree

8 files changed

+31
-2
lines changed

8 files changed

+31
-2
lines changed

README.org

+8-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ http://orgmode.org for more information.
2323
</a>
2424
#+END_HTML
2525

26-
** Documentation
26+
** End-user documentation
2727

2828
Find out more here: https://github.com/orgzly/documentation
2929

@@ -38,6 +38,13 @@ example:
3838

3939
Make sure you [[https://developer.android.com/training/testing/espresso/setup][turn off animations]] for the device you're testing on.
4040

41+
Java 8 is required for command line usage. Later versions are currently not compatible.
42+
43+
*** Dropbox
44+
45+
Dropbox integration, and associated tests, are disabled in the default configuration.
46+
To enable, follow the instructions in sample.app.properties.
47+
4148
** License
4249

4350
The project is licensed under the [[https://github.com/orgzly/orgzly-android/blob/master/LICENSE][GNU General Public License version 3 (or newer)]].

app/src/androidTest/java/com/orgzly/android/espresso/MiscTest.java

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import androidx.test.rule.ActivityTestRule;
99

10+
import com.orgzly.test.BuildConfig;
1011
import com.orgzly.R;
1112
import com.orgzly.android.OrgzlyTest;
1213
import com.orgzly.android.db.entity.NotePosition;
@@ -15,6 +16,7 @@
1516
import com.orgzly.android.ui.repos.ReposActivity;
1617

1718
import org.hamcrest.Matcher;
19+
import org.junit.Assume;
1820
import org.junit.Rule;
1921
import org.junit.Test;
2022

@@ -478,6 +480,8 @@ public void testMainActivityFragments() {
478480

479481
@Test
480482
public void testReposActivityFragments() {
483+
Assume.assumeTrue(BuildConfig.IS_DROPBOX_ENABLED);
484+
481485
ActivityTestRule rule = new EspressoActivityTestRule<>(ReposActivity.class);
482486

483487
testUtils.setupRepo(RepoType.DIRECTORY, "file:/");

app/src/androidTest/java/com/orgzly/android/espresso/ReposActivityTest.java

+4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
import androidx.test.rule.ActivityTestRule;
44

5+
import com.orgzly.test.BuildConfig;
56
import com.orgzly.R;
67
import com.orgzly.android.OrgzlyTest;
78
import com.orgzly.android.ui.repos.ReposActivity;
89

10+
import org.junit.Assume;
911
import org.junit.Rule;
1012
import org.junit.Test;
1113

@@ -59,6 +61,8 @@ public void testDirectoryRepoWithPercentCharacter() {
5961

6062
@Test
6163
public void testDropboxRepoWithPercentCharacter() {
64+
Assume.assumeTrue(BuildConfig.IS_DROPBOX_ENABLED);
65+
6266
String localDir = "/Documents/user@host%2Fdir";
6367

6468
activityRule.launchActivity(null);

app/src/androidTest/java/com/orgzly/android/espresso/SyncingTest.java

+6
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
import com.orgzly.android.sync.BookSyncStatus;
1515
import com.orgzly.android.sync.SyncService;
1616
import com.orgzly.android.ui.main.MainActivity;
17+
import com.orgzly.test.BuildConfig;
1718

1819
import org.junit.Assert;
20+
import org.junit.Assume;
1921
import org.junit.Rule;
2022
import org.junit.Test;
2123

@@ -562,6 +564,8 @@ public void testEncodingAfterSyncSaving() {
562564

563565
@Test
564566
public void testSettingLinkToRenamedRepo() {
567+
Assume.assumeTrue(BuildConfig.IS_DROPBOX_ENABLED);
568+
565569
Repo repo = testUtils.setupRepo(RepoType.MOCK, "mock://repo-a");
566570
testUtils.setupRook(repo, "mock://repo-a/booky.org", "Täht", "1abcde", 1400067156000L);
567571
activityRule.launchActivity(null);
@@ -616,6 +620,8 @@ public void testSettingLinkToRenamedRepo() {
616620

617621
@Test
618622
public void testRenamingReposRemovesLinksWhatUsedThem() {
623+
Assume.assumeTrue(BuildConfig.IS_DROPBOX_ENABLED);
624+
619625
testUtils.setupRepo(RepoType.MOCK, "mock://repo-a");
620626
testUtils.setupRepo(RepoType.MOCK, "mock://repo-b");
621627
testUtils.setupBook("booky", "");

app/src/androidTest/java/com/orgzly/android/repos/DropboxRepoTest.java

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.orgzly.android.prefs.AppPreferences;
88
import com.orgzly.android.util.MiscUtils;
99

10+
import org.junit.Assume;
1011
import org.junit.Before;
1112
import org.junit.Test;
1213

@@ -24,6 +25,7 @@ public class DropboxRepoTest extends OrgzlyTest {
2425
@Before
2526
public void setUp() throws Exception {
2627
super.setUp();
28+
Assume.assumeTrue(com.orgzly.test.BuildConfig.IS_DROPBOX_ENABLED);
2729

2830
AppPreferences.dropboxToken(context, BuildConfig.DROPBOX_TOKEN);
2931
}

app/src/androidTest/java/com/orgzly/android/repos/RepoFactoryTest.java

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.orgzly.android.OrgzlyTest;
44

5+
import org.junit.Assume;
56
import org.junit.Test;
67

78
import static org.junit.Assert.assertEquals;
@@ -12,13 +13,17 @@ public class RepoFactoryTest extends OrgzlyTest {
1213

1314
@Test
1415
public void testCreateRepoFromUrl1() {
16+
Assume.assumeTrue(com.orgzly.test.BuildConfig.IS_DROPBOX_ENABLED);
17+
1518
SyncRepo repo = testUtils.repoInstance(RepoType.DROPBOX, "dropbox:");
1619
assertTrue(repo instanceof DropboxRepo);
1720
assertEquals("dropbox:", repo.getUri().toString());
1821
}
1922

2023
@Test
2124
public void testCreateRepoFromUrl2() {
25+
Assume.assumeTrue(com.orgzly.test.BuildConfig.IS_DROPBOX_ENABLED);
26+
2227
SyncRepo repo = testUtils.repoInstance(RepoType.DROPBOX, "dropbox:/path");
2328
assertTrue(repo instanceof DropboxRepo);
2429
assertEquals("dropbox:/path", repo.getUri().toString());

app/src/main/java/com/orgzly/android/ui/repos/ReposActivity.kt

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import com.orgzly.android.ui.repo.directory.DirectoryRepoActivity
2424
import com.orgzly.android.ui.repo.dropbox.DropboxRepoActivity
2525
import com.orgzly.android.ui.repo.git.GitRepoActivity
2626
import com.orgzly.android.ui.repo.webdav.WebdavRepoActivity
27+
import com.orgzly.android.util.LogUtils
2728
import com.orgzly.databinding.ActivityReposBinding
2829
import javax.inject.Inject
2930

sample.app.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# You should copy this file to "app.properties" which is required by build.
22
#
33
# If you don't modify the values below, you will still be able to run the app.
4-
# Some tests will fail and you won't be able to use Dropbox as a repository,
4+
# Some tests will be ignored and you won't be able to use Dropbox as a repository,
55
# but everything else should be working fine.
66

77
# Token used by few tests which use Dropbox.

0 commit comments

Comments
 (0)