Commits

Sam Adams  committed 0bbfb5c

Fixed deposit ATs

  • Participants
  • Parent commits e26491f

Comments (0)

Files changed (2)

File acceptance-test-driver/src/main/java/net/chempound/acceptance/dsl/driver/APIDriver.java

 
 import net.chempound.acceptance.dsl.TestContext;
 import net.chempound.client.*;
+import net.chempound.storage.InMemoryResource;
+import net.chempound.storage.LocalResource;
+import net.chempound.util.MimeType;
 
 import java.net.URI;
 
             .withTitle(context.actual(config.title))
             .withSlug(context.actual(config.slug));
 
+        if (config.file != null) {
+            request.addResource(createResource(config.file));
+        }
+
         final DepositItemResponse response;
         try {
             response = client.depositItem(request);
         return new Item(response.getUri());
     }
 
+    private static LocalResource createResource(final Resource file) {
+        return new InMemoryResource(file.getPath(), new MimeType(file.getMimeType()), file.getContent());
+    }
+
 }

File acceptance-tests/src/test/java/net/chempound/acceptance/DepositAcceptanceTest.java

 /**
  * @author Sam Adams
  */
-@Ignore
 public class DepositAcceptanceTest extends AbstractAcceptanceTest {
 
     private WebUIDriver webDriver;
             .withFile(file)
             .execute();
 
-        webDriver.check(item, hasFileLink("file"));
+        webDriver.check(item, hasFileLink(file.getPath()));
     }
 
     @Test
     }
 
     private static Resource newResource() {
-        return new Resource("path", "mime/Type", generateContent());
+        return new Resource("path", "mime/type", generateContent());
     }
 
     private static byte[] generateContent() {