Skip to content

Commit

Permalink
Merge pull request #2 from Root-App/zack-fake-get-uploaded-files
Browse files Browse the repository at this point in the history
Updated gem to upload fake files into file system
  • Loading branch information
martinza authored Jan 8, 2018
2 parents 0c962c6 + c48ad24 commit ae050c3
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 37 deletions.
78 changes: 43 additions & 35 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
amazon (0.0.1)
amazon (0.0.3)
activesupport
aws-sdk
pg
Expand All @@ -16,16 +16,16 @@ GEM
i18n (~> 0.7)
minitest (~> 5.1)
tzinfo (~> 1.1)
aws-partitions (1.30.0)
aws-partitions (1.38.0)
aws-sdk (3.0.1)
aws-sdk-resources (~> 3)
aws-sdk-acm (1.1.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-apigateway (1.2.0)
aws-sdk-apigateway (1.5.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-applicationautoscaling (1.3.0)
aws-sdk-applicationautoscaling (1.6.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-applicationdiscoveryservice (1.0.0)
Expand All @@ -40,7 +40,7 @@ GEM
aws-sdk-autoscaling (1.3.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-batch (1.1.0)
aws-sdk-batch (1.2.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-budgets (1.2.0)
Expand All @@ -49,7 +49,7 @@ GEM
aws-sdk-clouddirectory (1.0.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-cloudformation (1.2.0)
aws-sdk-cloudformation (1.3.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-cloudfront (1.1.0)
Expand Down Expand Up @@ -79,10 +79,10 @@ GEM
aws-sdk-cloudwatchlogs (1.2.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-codebuild (1.3.0)
aws-sdk-codebuild (1.4.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-codecommit (1.1.0)
aws-sdk-codecommit (1.2.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-codedeploy (1.0.0)
Expand All @@ -106,14 +106,17 @@ GEM
aws-sdk-configservice (1.4.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-core (3.6.0)
aws-sdk-core (3.9.0)
aws-partitions (~> 1.0)
aws-sigv4 (~> 1.0)
jmespath (~> 1.0)
aws-sdk-costandusagereportservice (1.0.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-databasemigrationservice (1.2.0)
aws-sdk-costexplorer (1.0.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-databasemigrationservice (1.3.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-datapipeline (1.0.0)
Expand All @@ -137,19 +140,19 @@ GEM
aws-sdk-dynamodbstreams (1.0.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-ec2 (1.14.0)
aws-sdk-ec2 (1.18.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-ecr (1.2.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-ecs (1.3.0)
aws-sdk-ecs (1.4.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-efs (1.0.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-elasticache (1.2.0)
aws-sdk-elasticache (1.3.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-elasticbeanstalk (1.2.0)
Expand All @@ -158,7 +161,7 @@ GEM
aws-sdk-elasticloadbalancing (1.1.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-elasticloadbalancingv2 (1.4.0)
aws-sdk-elasticloadbalancingv2 (1.6.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-elasticsearchservice (1.2.0)
Expand All @@ -167,10 +170,10 @@ GEM
aws-sdk-elastictranscoder (1.0.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-emr (1.0.0)
aws-sdk-emr (1.1.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-firehose (1.0.0)
aws-sdk-firehose (1.1.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-gamelift (1.1.0)
Expand All @@ -179,7 +182,7 @@ GEM
aws-sdk-glacier (1.4.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-glue (1.1.0)
aws-sdk-glue (1.2.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-greengrass (1.1.0)
Expand All @@ -203,13 +206,13 @@ GEM
aws-sdk-iotdataplane (1.0.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-kinesis (1.0.0)
aws-sdk-kinesis (1.1.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-kinesisanalytics (1.1.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-kms (1.2.0)
aws-sdk-kms (1.3.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-lambda (1.0.0)
Expand All @@ -224,7 +227,7 @@ GEM
aws-sdk-lexmodelbuildingservice (1.2.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-lightsail (1.1.0)
aws-sdk-lightsail (1.2.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-machinelearning (1.0.0)
Expand All @@ -251,31 +254,34 @@ GEM
aws-sdk-opsworks (1.1.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-opsworkscm (1.1.0)
aws-sdk-opsworkscm (1.2.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-organizations (1.5.0)
aws-sdk-organizations (1.7.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-pinpoint (1.2.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-polly (1.3.0)
aws-sdk-polly (1.4.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-pricing (1.0.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-rds (1.6.0)
aws-sdk-rds (1.8.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-redshift (1.1.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-rekognition (1.0.0)
aws-sdk-rekognition (1.1.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-resourcegroupstaggingapi (1.0.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-resources (3.1.0)
aws-sdk-resources (3.3.0)
aws-sdk-acm (~> 1)
aws-sdk-apigateway (~> 1)
aws-sdk-applicationautoscaling (~> 1)
Expand Down Expand Up @@ -306,6 +312,7 @@ GEM
aws-sdk-cognitosync (~> 1)
aws-sdk-configservice (~> 1)
aws-sdk-costandusagereportservice (~> 1)
aws-sdk-costexplorer (~> 1)
aws-sdk-databasemigrationservice (~> 1)
aws-sdk-datapipeline (~> 1)
aws-sdk-dax (~> 1)
Expand Down Expand Up @@ -356,6 +363,7 @@ GEM
aws-sdk-organizations (~> 1)
aws-sdk-pinpoint (~> 1)
aws-sdk-polly (~> 1)
aws-sdk-pricing (~> 1)
aws-sdk-rds (~> 1)
aws-sdk-redshift (~> 1)
aws-sdk-rekognition (~> 1)
Expand All @@ -381,23 +389,23 @@ GEM
aws-sdk-workdocs (~> 1)
aws-sdk-workspaces (~> 1)
aws-sdk-xray (~> 1)
aws-sdk-route53 (1.3.0)
aws-sdk-route53 (1.5.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-route53domains (1.1.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-s3 (1.5.0)
aws-sdk-s3 (1.7.0)
aws-sdk-core (~> 3)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.0)
aws-sdk-servicecatalog (1.1.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-ses (1.3.0)
aws-sdk-ses (1.4.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-shield (1.0.0)
aws-sdk-shield (1.1.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-simpledb (1.0.0)
Expand All @@ -415,13 +423,13 @@ GEM
aws-sdk-sqs (1.3.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-ssm (1.3.0)
aws-sdk-ssm (1.4.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-states (1.0.0)
aws-sdk-states (1.2.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-storagegateway (1.1.0)
aws-sdk-storagegateway (1.2.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-support (1.0.0)
Expand All @@ -436,13 +444,13 @@ GEM
aws-sdk-wafregional (1.2.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-workdocs (1.0.0)
aws-sdk-workdocs (1.1.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-workspaces (1.0.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sdk-xray (1.0.0)
aws-sdk-xray (1.1.0)
aws-sdk-core (~> 3)
aws-sigv4 (~> 1.0)
aws-sigv2 (1.0.1)
Expand Down
2 changes: 1 addition & 1 deletion amazon.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "amazon"
s.version = "0.0.2"
s.version = "0.0.3"
s.authors = ["Root"]
s.email = ["[email protected]"]
s.summary = "Integration with Amazon SDK"
Expand Down
6 changes: 5 additions & 1 deletion lib/amazon/fake_communicator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ def bucket.get_files_in_folder(folder)
case @bucket_name
when "random_bucket" then raise Aws::S3::Errors.error_class('NoSuchBucket').new("test", "test")
else
["2015-05-12-file.csv", "2015-05-13-file.csv"]
if @bucket_files.present? && @bucket_files.keys.present?
@bucket_files.keys
else
["2015-05-12-file.csv", "2015-05-13-file.csv"]
end
end
end

Expand Down
15 changes: 15 additions & 0 deletions spec/support/shared_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@
expect(files).to be_an(Array)
end

it "should find files in folder when uploaded" do
file = Tempfile.open("out.txt") do |f|
f.write("hello world")
f
end
bucket.upload_file("sample.file", file.path)

bucket = communicator.find_bucket(SpecHelper::TESTING_BUCKET)

files = bucket.get_files_in_folder("public/account_facts/")

expect(files).to be_present
expect(files).to include("sample.file")
end

it "should get file link to s3" do
link = bucket.get_file_link("public/account_facts/", "2017-05-13-public.account_facts.csv")

Expand Down

0 comments on commit ae050c3

Please sign in to comment.