This repository has been archived by the owner on Dec 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de65d00
commit 3ded264
Showing
3 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/test/scala/io/findify/s3mock/ListBucketEmptyWorkdirTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package io.findify.s3mock | ||
|
||
import java.util.UUID | ||
|
||
import scala.collection.JavaConverters._ | ||
import com.amazonaws.auth.BasicAWSCredentials | ||
import com.amazonaws.services.s3.AmazonS3Client | ||
import io.findify.s3mock.provider.FileProvider | ||
import org.scalatest.{BeforeAndAfterAll, FlatSpec, Matchers} | ||
|
||
/** | ||
* Created by shutty on 8/30/16. | ||
*/ | ||
class ListBucketEmptyWorkdirTest extends FlatSpec with Matchers with BeforeAndAfterAll { | ||
lazy val s3 = new AmazonS3Client(new BasicAWSCredentials("hello", "world")) | ||
|
||
val workDir = s"/tmp/${UUID.randomUUID()}" | ||
lazy val server = new S3Mock(8001, new FileProvider(workDir)) | ||
|
||
override def beforeAll = { | ||
s3.setEndpoint("http://127.0.0.1:8001") | ||
server.start | ||
} | ||
override def afterAll = { | ||
server.stop | ||
} | ||
|
||
"s3mock" should "list bucket with empty prefix" in { | ||
s3.createBucket("list") | ||
s3.putObject("list", "foo1", "xxx") | ||
s3.putObject("list", "foo2", "xxx") | ||
val list = s3.listObjects("list").getObjectSummaries.asScala.toList | ||
list.map(_.getKey).forall(_.startsWith("/foo")) shouldBe true | ||
} | ||
|
||
|
||
} |