atlassian_upm 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5a3bdbcfa971ac941c92dad168892cf702e0bf4f
4
- data.tar.gz: 91f081455d7fb5f2c096fcce54845e138e3a4984
3
+ metadata.gz: 9b17101f7d066b8b4a8861de1771d82d1c3fc775
4
+ data.tar.gz: a3f4607a4f7a7a50f917410f5bef7da67fc88888
5
5
  SHA512:
6
- metadata.gz: 7b4d202088d90a8d322f880b6c48d8178e807a1b33030dced3774ce547f3aebb4e8328a0b806487f766b77a741e3750fa080893610949f8aaf36b5d40f309db2
7
- data.tar.gz: b4132ae68eee2d2022145718c86cf38fb3a0c926a531c1dbc99c0a12bd9de8f083594525f33661ec46b81da92bb15f1b3bb1e244789709a177c0cf86b66b0871
6
+ metadata.gz: 8b88ac7b0baab52c81aeda51d99e4605a181d9d639a044c321f7bc95fb3eb571431ff80b40fea8d51b12d00b5eabf3917502c1d107cca6c84774cf22947f7d80
7
+ data.tar.gz: e904de4193ac315572817f0b6b8497e90caab961a98355e4b44c82e1bfe6a125b6a7db12dd50a6d75906b9136f31d186f71c154b5cc193a5c32c6f68f9ef593f
@@ -9,4 +9,9 @@ class UPMClient
9
9
  def token
10
10
  @rest_client.head.headers[:upm_token]
11
11
  end
12
+
13
+ def uploadPlugin(filename)
14
+ @rest_client.post({:plugin => File.new(filename), :multipart => true}, {:token => token()})
15
+ true
16
+ end
12
17
  end
@@ -1,5 +1,5 @@
1
1
 
2
2
 
3
3
  module UPM
4
- VERSION = "0.1"
4
+ VERSION = "0.2"
5
5
  end
data/spec/upm_spec.rb CHANGED
@@ -3,8 +3,19 @@ require 'webmock/rspec'
3
3
 
4
4
  describe "Atlassian Universal Plugin Manager" do
5
5
 
6
- it "should be get the upm_token" do
6
+ before (:each) do
7
+ @client = UPMClient.new('url','user','password')
7
8
  stub_request(:head, "user:password@url").to_return(:headers => { 'upm_token' => 'token123' })
8
- UPMClient.new('url','user','password').token.should == 'token123'
9
+ stub_request(:post, "user:password@url").to_return(:status => 200)
10
+ end
11
+
12
+ it "should be get the upm_token" do
13
+ expect(@client.token).to eq 'token123'
14
+ end
15
+
16
+ it "should be post the plugin to host" do
17
+ expect(File).to receive(:new).with("filename").and_return(double)
18
+ expect(@client.uploadPlugin("filename")).to eq true
19
+ expect(WebMock).to have_requested(:post, "user:password@url").with(:headers => {'token' => 'token123', 'Content-Type'=> /multipart\/form-data\; boundary=[\d]+/})
9
20
  end
10
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atlassian_upm
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - KinWah Lai, Bas Vodde
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-14 00:00:00.000000000 Z
11
+ date: 2014-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake