diff options
author | ankonym <ankonym@gmail.com> | 2015-09-02 17:01:16 +0200 |
---|---|---|
committer | ankonym <ankonym@gmail.com> | 2015-09-28 15:12:45 +0200 |
commit | 2f7d085c5747a1a68afc0d854fa087ffbb46f8e7 (patch) | |
tree | 770ca0a89192623372eb1cf24ae885a786fc4bfe /test/integration | |
parent | b3762da8d8a06e164524a20d26293a8d5a9770d8 (diff) |
Fix the remaining failures/errors in our tests
Handing freshly generated invite codes to Factory Girl to make the tests pass
Diffstat (limited to 'test/integration')
-rw-r--r-- | test/integration/api/cert_test.rb | 1 | ||||
-rw-r--r-- | test/integration/api/smtp_cert_test.rb | 12 | ||||
-rw-r--r-- | test/integration/api/srp_test.rb | 7 |
3 files changed, 16 insertions, 4 deletions
diff --git a/test/integration/api/cert_test.rb b/test/integration/api/cert_test.rb index 118fb9f..772901d 100644 --- a/test/integration/api/cert_test.rb +++ b/test/integration/api/cert_test.rb @@ -2,6 +2,7 @@ require 'test_helper' class CertTest < ApiIntegrationTest + test "retrieve eip cert" do login get '/1/cert', {}, RACK_ENV diff --git a/test/integration/api/smtp_cert_test.rb b/test/integration/api/smtp_cert_test.rb index 2f50ef3..681d509 100644 --- a/test/integration/api/smtp_cert_test.rb +++ b/test/integration/api/smtp_cert_test.rb @@ -3,8 +3,13 @@ require 'openssl' class SmtpCertTest < ApiIntegrationTest + setup do + @testcode = InviteCode.new + @testcode.save! + end + test "retrieve smtp cert" do - @user = FactoryGirl.create :user, effective_service_level_code: 2 + @user = FactoryGirl.create :user, effective_service_level_code: 2, :invite_code => @testcode.invite_code login post '/1/smtp_cert', {}, RACK_ENV assert_text_response @@ -15,7 +20,7 @@ class SmtpCertTest < ApiIntegrationTest end test "cert and key" do - @user = FactoryGirl.create :user, effective_service_level_code: 2 + @user = FactoryGirl.create :user, effective_service_level_code: 2, :invite_code => @testcode.invite_code login post '/1/smtp_cert', {}, RACK_ENV assert_text_response @@ -27,7 +32,7 @@ class SmtpCertTest < ApiIntegrationTest end test "fingerprint is stored with identity" do - @user = FactoryGirl.create :user, effective_service_level_code: 2 + @user = FactoryGirl.create :user, effective_service_level_code: 2, :invite_code => @testcode.invite_code login post '/1/smtp_cert', {}, RACK_ENV assert_text_response @@ -41,6 +46,7 @@ class SmtpCertTest < ApiIntegrationTest end test "fetching smtp certs requires email account" do + login post '/1/smtp_cert', {}, RACK_ENV assert_access_denied diff --git a/test/integration/api/srp_test.rb b/test/integration/api/srp_test.rb index ea06cde..463abcd 100644 --- a/test/integration/api/srp_test.rb +++ b/test/integration/api/srp_test.rb @@ -1,5 +1,10 @@ class SrpTest < RackTest + setup do + @testcode = InviteCode.new + @testcode.save! + end + teardown do if @user cleanup_user @@ -32,7 +37,7 @@ class SrpTest < RackTest attr_reader :server_auth - def register_user(login = "integration_test", password = 'srp, verify me!', invite_code = "testcode") + def register_user(login = "integration_test", password = 'srp, verify me!', invite_code = @testcode.invite_code) cleanup_user(login) post 'http://api.lvh.me:3000/1/users.json', user_params(login: login, password: password, invite_code: invite_code) |