Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Disable auth for tests #555

Merged
merged 4 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@
<groupId>com.github.conveyal</groupId>
<artifactId>gtfs-lib</artifactId>
<!-- Latest dev build on jitpack.io -->
<version>f2ceb59</version>
<version>f2ceb59027</version>
<!-- Exclusions added in order to silence SLF4J warnings about multiple bindings:
http://www.slf4j.org/codes.html#multiple_bindings
-->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.conveyal.datatools;

import com.conveyal.datatools.common.status.MonitorableJob;
import com.conveyal.datatools.manager.auth.Auth0Connection;
import com.conveyal.datatools.manager.jobs.LoadFeedJob;
import com.conveyal.datatools.manager.jobs.ProcessSingleFeedJob;
import com.conveyal.datatools.manager.jobs.ValidateFeedJob;
Expand Down Expand Up @@ -30,10 +31,12 @@ public class HandleCorruptGTFSFileTest {
public static void setUp() throws IOException {
// start server if it isn't already running
DatatoolsTest.setUp();
Auth0Connection.setAuthDisabled(true);
}

@AfterAll
public static void tearDown() {
Auth0Connection.setAuthDisabled(Auth0Connection.getDefaultAuthDisabled());
mockProject.delete();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.conveyal.datatools.DatatoolsTest;
import com.conveyal.datatools.UnitTest;
import com.conveyal.datatools.manager.auth.Auth0Connection;
import com.conveyal.datatools.manager.models.ExternalFeedSourceProperty;
import com.conveyal.datatools.manager.models.FeedSource;
import com.conveyal.datatools.manager.models.FeedVersion;
Expand Down Expand Up @@ -50,6 +51,7 @@ class MtcFeedResourceTest extends UnitTest {
static void setUp() throws IOException {
// start server if it isn't already running
DatatoolsTest.setUp();
Auth0Connection.setAuthDisabled(true);
// Create a project, feed sources.
project = new Project();
project.name = String.format("Test %s", new Date());
Expand All @@ -69,6 +71,7 @@ static void setUp() throws IOException {

@AfterAll
static void tearDown() {
Auth0Connection.setAuthDisabled(Auth0Connection.getDefaultAuthDisabled());
wireMockServer.stop();
if (project != null) {
project.delete();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.conveyal.datatools.DatatoolsTest;
import com.conveyal.datatools.UnitTest;
import com.conveyal.datatools.manager.DataManager;
import com.conveyal.datatools.manager.auth.Auth0Connection;
import com.conveyal.datatools.manager.jobs.MergeFeedsJobTest;
import com.conveyal.datatools.manager.models.FeedSource;
import com.conveyal.datatools.manager.models.FeedVersion;
Expand Down Expand Up @@ -44,6 +45,7 @@ public class GtfsPlusValidationTest extends UnitTest {
public static void setUp() throws IOException {
// Start server if it isn't already running.
DatatoolsTest.setUp();
Auth0Connection.setAuthDisabled(true);
// Create a project, feed sources, and feed versions to merge.
project = new Project();
project.name = String.format("Test %s", new Date());
Expand All @@ -65,6 +67,7 @@ public static void setUp() throws IOException {

@AfterAll
static void tearDown() {
Auth0Connection.setAuthDisabled(Auth0Connection.getDefaultAuthDisabled());
project.delete();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.conveyal.datatools.DatatoolsTest;
import com.conveyal.datatools.UnitTest;
import com.conveyal.datatools.manager.auth.Auth0Connection;
import com.conveyal.datatools.manager.auth.Auth0UserProfile;
import com.conveyal.datatools.manager.models.FeedRetrievalMethod;
import com.conveyal.datatools.manager.models.FeedSource;
Expand Down Expand Up @@ -65,6 +66,7 @@ public class ArbitraryTransformJobTest extends UnitTest {
public static void setUp() throws IOException {
// start server if it isn't already running
DatatoolsTest.setUp();
Auth0Connection.setAuthDisabled(true);

// Create a project, feed sources, and feed versions to merge.
project = new Project();
Expand All @@ -81,6 +83,7 @@ public static void setUp() throws IOException {
*/
@AfterAll
public static void tearDown() {
Auth0Connection.setAuthDisabled(Auth0Connection.getDefaultAuthDisabled());
// Project delete cascades to feed sources.
project.delete();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.amazonaws.services.s3.model.S3ObjectSummary;
import com.conveyal.datatools.DatatoolsTest;
import com.conveyal.datatools.UnitTest;
import com.conveyal.datatools.manager.auth.Auth0Connection;
import com.conveyal.datatools.manager.auth.Auth0UserProfile;
import com.conveyal.datatools.manager.models.ExternalFeedSourceProperty;
import com.conveyal.datatools.manager.models.FeedSource;
Expand Down Expand Up @@ -52,6 +53,7 @@ public class AutoPublishJobTest extends UnitTest {
public static void setUp() throws IOException {
// start server if it isn't already running
DatatoolsTest.setUp();
Auth0Connection.setAuthDisabled(true);

// Create a project, feed sources, and feed versions to merge.
project = new Project();
Expand All @@ -76,6 +78,7 @@ public static void setUp() throws IOException {

@AfterAll
public static void tearDown() {
Auth0Connection.setAuthDisabled(Auth0Connection.getDefaultAuthDisabled());
if (project != null) {
project.delete();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.conveyal.datatools.manager.jobs;

import com.conveyal.datatools.DatatoolsTest;
import com.conveyal.datatools.manager.auth.Auth0Connection;
import com.conveyal.datatools.manager.auth.Auth0UserProfile;
import com.conveyal.datatools.manager.models.*;
import com.conveyal.datatools.manager.persistence.Persistence;
import com.google.common.io.Files;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
Expand Down Expand Up @@ -63,6 +65,7 @@ private File[] getFoldersFromZippedShapefile(File zipFile) throws IOException {
@BeforeAll
public static void setUp() throws IOException {
DatatoolsTest.setUp();
Auth0Connection.setAuthDisabled(true);
// Calling GisExportJobTest.setUp() creates project and feeds
GisExportJobTest.setUp();
user = Auth0UserProfile.createTestAdminUser();
Expand All @@ -72,6 +75,11 @@ public static void setUp() throws IOException {
Persistence.deployments.create(deployment);
}

@AfterAll
public static void tearDown() {
Auth0Connection.setAuthDisabled(Auth0Connection.getDefaultAuthDisabled());
}

/**
* Ensures that shapefiles containing stop features for a deployment can be exported and
* contain geometry for each stop.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.conveyal.datatools.DatatoolsTest;
import com.conveyal.datatools.UnitTest;
import com.conveyal.datatools.common.status.MonitorableJob;
import com.conveyal.datatools.manager.auth.Auth0Connection;
import com.conveyal.datatools.manager.auth.Auth0UserProfile;
import com.conveyal.datatools.manager.models.FeedSource;
import com.conveyal.datatools.manager.models.FeedVersion;
Expand Down Expand Up @@ -53,6 +54,7 @@ public class FetchLoadFeedCombinationTest extends UnitTest {
public static void setUp() throws IOException {
// start server if it isn't already running
DatatoolsTest.setUp();
Auth0Connection.setAuthDisabled(true);

// Create a project and feed sources.
project = new Project();
Expand All @@ -70,6 +72,7 @@ public static void setUp() throws IOException {

@AfterAll
public static void tearDown() {
Auth0Connection.setAuthDisabled(Auth0Connection.getDefaultAuthDisabled());
wireMockServer.stop();
if (project != null) {
project.delete();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.conveyal.datatools.DatatoolsTest;
import com.conveyal.datatools.UnitTest;
import com.conveyal.datatools.manager.auth.Auth0Connection;
import com.conveyal.datatools.manager.auth.Auth0UserProfile;
import com.conveyal.datatools.manager.models.FeedRetrievalMethod;
import com.conveyal.datatools.manager.models.FeedSource;
Expand All @@ -11,6 +12,7 @@
import com.conveyal.datatools.manager.utils.SqlAssert;
import com.google.common.base.Strings;
import com.google.common.io.Files;
import org.junit.jupiter.api.AfterAll;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.MultiLineString;
import org.locationtech.jts.geom.Point;
Expand Down Expand Up @@ -149,6 +151,7 @@ public void validateShapefiles(File[] files, String agencyName, GisExportJob.Exp
@BeforeAll
public static void setUp() throws IOException {
DatatoolsTest.setUp();
Auth0Connection.setAuthDisabled(true);
LOG.info("{} setup", GisExportJobTest.class.getSimpleName());

// Create a project, feed sources, and feed versions to merge.
Expand All @@ -165,6 +168,11 @@ public static void setUp() throws IOException {
hawaiiVersion = createFeedVersionFromGtfsZip(hawaii, "hawaii_fake_no_shapes.zip");
}

@AfterAll
public static void tearDown() {
Auth0Connection.setAuthDisabled(Auth0Connection.getDefaultAuthDisabled());
}

/**
* Ensures that a shapefile containing stop features for a feed version can be exported and
* contains geometry for each stop.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.conveyal.datatools.DatatoolsTest;
import com.conveyal.datatools.UnitTest;
import com.conveyal.datatools.manager.auth.Auth0Connection;
import com.conveyal.datatools.manager.auth.Auth0UserProfile;
import com.conveyal.datatools.manager.gtfsplus.GtfsPlusValidation;
import com.conveyal.datatools.manager.jobs.feedmerge.MergeFeedsType;
Expand Down Expand Up @@ -86,6 +87,7 @@ public class MergeFeedsJobTest extends UnitTest {
public static void setUp() throws IOException {
// start server if it isn't already running
DatatoolsTest.setUp();
Auth0Connection.setAuthDisabled(true);

// Create a project, feed sources, and feed versions to merge.
project = new Project();
Expand Down Expand Up @@ -157,6 +159,7 @@ public static void setUp() throws IOException {
*/
@AfterAll
public static void tearDown() {
Auth0Connection.setAuthDisabled(Auth0Connection.getDefaultAuthDisabled());
if (project != null) {
project.delete();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.conveyal.datatools.manager.jobs;

import com.conveyal.datatools.DatatoolsTest;
import com.conveyal.datatools.manager.auth.Auth0Connection;
import com.conveyal.datatools.manager.models.FeedRetrievalMethod;
import com.conveyal.datatools.manager.models.FeedSource;
import com.conveyal.datatools.manager.models.FeedVersion;
Expand Down Expand Up @@ -48,6 +49,7 @@ public class NormalizeFieldTransformJobTest extends DatatoolsTest {
public static void setUp() throws IOException {
// start server if it isn't already running
DatatoolsTest.setUp();
Auth0Connection.setAuthDisabled(true);

// Create a project.
project = createProject();
Expand All @@ -58,6 +60,7 @@ public static void setUp() throws IOException {
*/
@AfterAll
public static void tearDown() {
Auth0Connection.setAuthDisabled(Auth0Connection.getDefaultAuthDisabled());
// Project delete cascades to feed sources.
project.delete();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.conveyal.datatools.DatatoolsTest;
import com.conveyal.datatools.UnitTest;
import com.conveyal.datatools.manager.auth.Auth0Connection;
import com.conveyal.datatools.manager.persistence.Persistence;
import com.conveyal.gtfs.error.NewGTFSError;
import com.conveyal.gtfs.error.NewGTFSErrorType;
Expand Down Expand Up @@ -35,6 +36,7 @@ public class FeedVersionTest extends UnitTest {
public static void setUp() throws Exception {
// start server if it isn't already running
DatatoolsTest.setUp();
Auth0Connection.setAuthDisabled(true);

// set up project
project = new Project();
Expand All @@ -48,6 +50,7 @@ public static void setUp() throws Exception {

@AfterAll
public static void tearDown() {
Auth0Connection.setAuthDisabled(Auth0Connection.getDefaultAuthDisabled());
if (project != null) {
project.delete();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.conveyal.datatools.DatatoolsTest;
import com.conveyal.datatools.UnitTest;
import com.conveyal.datatools.manager.DataManager;
import com.conveyal.datatools.manager.auth.Auth0Connection;
import com.conveyal.datatools.manager.models.FeedSource;
import com.conveyal.datatools.manager.models.FeedVersion;
import com.conveyal.datatools.manager.models.Project;
Expand Down Expand Up @@ -40,6 +41,7 @@ class SqlSchemaUpdaterTest extends UnitTest {
public static void setUp() throws IOException {
// start server if it isn't already running.
DatatoolsTest.setUp();
Auth0Connection.setAuthDisabled(true);

// Create a project and feed sources.
project = new Project();
Expand All @@ -60,6 +62,7 @@ public static void setUp() throws IOException {
*/
@AfterAll
public static void tearDown() {
Auth0Connection.setAuthDisabled(Auth0Connection.getDefaultAuthDisabled());
// Project delete cascades to feed sources.
project.delete();
}
Expand Down
Loading