From 195224a989fa57e9a70fa10c0cdd6603295bb0dd Mon Sep 17 00:00:00 2001 From: Azul Date: Sat, 26 Jan 2013 10:52:36 +0100 Subject: removing the leap_ca namespacing from certs --- certs/test/unit/cert_test.rb | 39 ------------------------------ certs/test/unit/client_certificate_test.rb | 39 ++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 39 deletions(-) delete mode 100644 certs/test/unit/cert_test.rb create mode 100644 certs/test/unit/client_certificate_test.rb (limited to 'certs/test/unit') diff --git a/certs/test/unit/cert_test.rb b/certs/test/unit/cert_test.rb deleted file mode 100644 index 0b21d0b..0000000 --- a/certs/test/unit/cert_test.rb +++ /dev/null @@ -1,39 +0,0 @@ -require 'test_helper' - -class CertTest < ActiveSupport::TestCase - - setup do - @sample = LeapCA::Cert.new LeapCA::Cert.valid_attributes_hash - end - - test "stub cert for testing is valid" do - assert @sample.valid? - end - - test "setting random on create validation" do - @sample.random = "asdf" - assert @sample.valid? - assert @sample.random.is_a? Float - assert @sample.random >= 0 - assert @sample.random < 1 - end - - test "validates random" do - @sample.save # make sure we are past the on_create - assert @sample.valid? - ["asdf", 1, 2, -0.1, nil, "asdf"].each do |invalid| - @sample.random = invalid - assert !@sample.valid?, "#{invalid} should not be a valid value for random" - end - end - - test "validates key" do - @sample.key = nil - assert !@sample.valid?, "Cert should require key" - end - - test "validates cert" do - @sample.cert = nil - assert !@sample.valid?, "Cert should require cert" - end -end diff --git a/certs/test/unit/client_certificate_test.rb b/certs/test/unit/client_certificate_test.rb new file mode 100644 index 0000000..a721483 --- /dev/null +++ b/certs/test/unit/client_certificate_test.rb @@ -0,0 +1,39 @@ +require 'test_helper' + +class ClientCertificateTest < ActiveSupport::TestCase + + setup do + @sample = ClientCertificate.new ClientCertificate.valid_attributes_hash + end + + test "stub cert for testing is valid" do + assert @sample.valid? + end + + test "setting random on create validation" do + @sample.random = "asdf" + assert @sample.valid? + assert @sample.random.is_a? Float + assert @sample.random >= 0 + assert @sample.random < 1 + end + + test "validates random" do + @sample.save # make sure we are past the on_create + assert @sample.valid? + ["asdf", 1, 2, -0.1, nil, "asdf"].each do |invalid| + @sample.random = invalid + assert !@sample.valid?, "#{invalid} should not be a valid value for random" + end + end + + test "validates key" do + @sample.key = nil + assert !@sample.valid?, "Cert should require key" + end + + test "validates cert" do + @sample.cert = nil + assert !@sample.valid?, "Cert should require cert" + end +end -- cgit v1.2.3