summaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/.gitkeep0
-rw-r--r--test/unit/bug_test.rb8
-rw-r--r--test/unit/comment_test.rb54
-rw-r--r--test/unit/cpe_test.rb8
-rw-r--r--test/unit/cve_assignment_test.rb8
-rw-r--r--test/unit/cve_change_test.rb8
-rw-r--r--test/unit/cve_comment_test.rb8
-rw-r--r--test/unit/cve_reference_test.rb8
-rw-r--r--test/unit/cve_test.rb92
-rw-r--r--test/unit/glsa_mailer_test.rb4
-rw-r--r--test/unit/glsa_test.rb55
-rw-r--r--test/unit/helpers/bug_helper_test.rb4
-rw-r--r--test/unit/helpers/bugs_helper_test.rb4
-rw-r--r--test/unit/helpers/comments_helper_test.rb4
-rw-r--r--test/unit/helpers/cve_helper_test.rb4
-rw-r--r--test/unit/helpers/glsa_helper_test.rb4
-rw-r--r--test/unit/helpers/index_helper_test.rb4
-rw-r--r--test/unit/helpers/search_helper_test.rb4
-rw-r--r--test/unit/helpers/templates_helper_test.rb4
-rw-r--r--test/unit/helpers/tools_helper_test.rb4
-rw-r--r--test/unit/helpers/user_helper_test.rb4
-rw-r--r--test/unit/package_test.rb8
-rw-r--r--test/unit/reference_test.rb8
-rw-r--r--test/unit/revision_test.rb47
-rw-r--r--test/unit/template_test.rb7
-rw-r--r--test/unit/user_test.rb47
26 files changed, 0 insertions, 410 deletions
diff --git a/test/unit/.gitkeep b/test/unit/.gitkeep
deleted file mode 100644
index e69de29..0000000
--- a/test/unit/.gitkeep
+++ /dev/null
diff --git a/test/unit/bug_test.rb b/test/unit/bug_test.rb
deleted file mode 100644
index 14af505..0000000
--- a/test/unit/bug_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require 'test_helper'
-
-class BugTest < ActiveSupport::TestCase
- # Replace this with your real tests.
- test "the truth" do
- assert true
- end
-end
diff --git a/test/unit/comment_test.rb b/test/unit/comment_test.rb
deleted file mode 100644
index 6e0de8b..0000000
--- a/test/unit/comment_test.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-require 'test_helper'
-
-class CommentTest < ActiveSupport::TestCase
- fixtures :all
-
- test "padawans should not be able to make approvals" do
- c = Comment.new
- c.glsa_id = 1
- c.user = users(:test_padawan)
- c.text = "test"
- c.rating = "approval"
- c.save
-
- assert c.errors.any?
- assert_includes c.errors[:rating], "You may not approve or reject drafts"
- end
-
- test "padawans should not be able to make rejections" do
- c = Comment.new
- c.glsa_id = 1
- c.user = users(:test_padawan)
- c.text = "test"
- c.rating = "rejection"
- c.save
-
- assert c.errors.any?
- assert_includes c.errors[:rating], "You may not approve or reject drafts"
- end
-
- test "advisory owners should not be able to approve their own drafts" do
- c = Comment.new
- c.user_id = 1
- c.text = "test"
- c.rating = "approval"
- c.glsa_id = 2
- c.save
-
- assert c.errors.any?
- assert_equal ["The owner of a draft cannot make approvals or rejections"], c.errors[:rating]
- end
-
- test "users should not be able to approve a draft twice" do
- # second comment loaded from fixtures
- c = Comment.new
- c.user_id = 7
- c.text = "test"
- c.rating = "approval"
- c.glsa_id = 2
- c.save
-
- assert c.errors.any?
- assert_equal ["You have already approved or rejected this draft"], c.errors[:rating]
- end
-end
diff --git a/test/unit/cpe_test.rb b/test/unit/cpe_test.rb
deleted file mode 100644
index e671d82..0000000
--- a/test/unit/cpe_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require 'test_helper'
-
-class CpeTest < ActiveSupport::TestCase
- # Replace this with your real tests.
- test "the truth" do
- assert true
- end
-end
diff --git a/test/unit/cve_assignment_test.rb b/test/unit/cve_assignment_test.rb
deleted file mode 100644
index 9c132b2..0000000
--- a/test/unit/cve_assignment_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require 'test_helper'
-
-class CveAssignmentTest < ActiveSupport::TestCase
- # Replace this with your real tests.
- test "the truth" do
- assert true
- end
-end
diff --git a/test/unit/cve_change_test.rb b/test/unit/cve_change_test.rb
deleted file mode 100644
index 6d34a62..0000000
--- a/test/unit/cve_change_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require 'test_helper'
-
-class CveChangeTest < ActiveSupport::TestCase
- # Replace this with your real tests.
- test "the truth" do
- assert true
- end
-end
diff --git a/test/unit/cve_comment_test.rb b/test/unit/cve_comment_test.rb
deleted file mode 100644
index a6ee432..0000000
--- a/test/unit/cve_comment_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require 'test_helper'
-
-class CveCommentTest < ActiveSupport::TestCase
- # Replace this with your real tests.
- test "the truth" do
- assert true
- end
-end
diff --git a/test/unit/cve_reference_test.rb b/test/unit/cve_reference_test.rb
deleted file mode 100644
index f2462ab..0000000
--- a/test/unit/cve_reference_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require 'test_helper'
-
-class CveReferenceTest < ActiveSupport::TestCase
- # Replace this with your real tests.
- test "the truth" do
- assert true
- end
-end
diff --git a/test/unit/cve_test.rb b/test/unit/cve_test.rb
deleted file mode 100644
index c874e9b..0000000
--- a/test/unit/cve_test.rb
+++ /dev/null
@@ -1,92 +0,0 @@
-require 'test_helper'
-
-class CveTest < ActiveSupport::TestCase
- test "URL generation" do
- cve = cves(:cve_one)
-
- assert_equal('https://nvd.nist.gov/vuln/detail/CVE-2004-1776', cve.url)
- assert_equal('https://nvd.nist.gov/vuln/detail/CVE-2004-1776', cve.url(:nvd))
- assert_equal('https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-1776', cve.url(:mitre))
- assert_raise(ArgumentError) { cve.url(:invalid_site) }
- end
-
- test "to_s" do
- assert_equal(
- "CVE-2004-1776 (https://nvd.nist.gov/vuln/detail/CVE-2004-1776):\n Cisco IOS 12.1(3) and 12.1(3)T allows remote attackers to read and modify\n device configuration data via the cable-docsis read-write community string\n used by the Data Over Cable Service Interface Specification (DOCSIS)\n standard.",
- cves(:cve_one).to_s
- )
- end
-
- test "assigning" do
- cve = cves(:cve_two)
- user = users(:test_user)
-
- assert_nothing_raised(Exception) {
- cve.assign(99999, user)
- }
-
- assert_equal("ASSIGNED", cve.state)
- assert_equal(user.id, cve.cve_changes.first.user_id)
- assert_equal(99999, cve.assignments.first.bug)
- end
-
- test "nfu" do
- cve = cves(:cve_two)
- user = users(:test_user)
-
- assert_nothing_raised(Exception) {
- cve.nfu(user)
- }
-
- assert_equal("NFU", cve.state)
- assert_equal(user.id, cve.cve_changes.first.user_id)
- end
-
- test "invalid" do
- cve = cves(:cve_two)
- user = users(:test_user)
-
- assert_nothing_raised(Exception) {
- cve.invalidate(user)
- }
-
- assert_equal("INVALID", cve.state)
- assert_equal(user.id, cve.cve_changes.first.user_id)
- end
-
- test "later" do
- cve = cves(:cve_two)
- user = users(:test_user)
-
- assert_nothing_raised(Exception) {
- cve.later(user)
- }
-
- assert_equal("LATER", cve.state)
- assert_equal(user.id, cve.cve_changes.first.user_id)
- end
-
- test "mark as new" do
- cve = cves(:cve_two)
- user = users(:test_user)
-
- assert_nothing_raised(Exception) {
- cve.mark_new(user)
- }
-
- assert_equal("NEW", cve.state)
- assert_equal(user.id, cve.cve_changes.first.user_id)
- end
-
- test "add comment" do
- cve = cves(:cve_two)
- user = users(:test_user)
-
- assert_nothing_raised(Exception) {
- cve.add_comment(user, "Comment Text")
- }
-
- assert_equal("Comment Text", cve.comments.first.comment)
- assert_equal(user.id, cve.comments.first.user_id)
- end
-end
diff --git a/test/unit/glsa_mailer_test.rb b/test/unit/glsa_mailer_test.rb
deleted file mode 100644
index 2c554fc..0000000
--- a/test/unit/glsa_mailer_test.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'test_helper'
-
-class GlsaMailerTest < ActionMailer::TestCase
-end
diff --git a/test/unit/glsa_test.rb b/test/unit/glsa_test.rb
deleted file mode 100644
index 15bd63d..0000000
--- a/test/unit/glsa_test.rb
+++ /dev/null
@@ -1,55 +0,0 @@
-require 'test_helper'
-
-class GlsaTest < ActiveSupport::TestCase
- fixtures :glsas, :users
-
- test "uniqueness" do
- glsa = Glsa.new(:glsa_id => glsas(:glsa_one).glsa_id)
-
- assert !glsa.save
- assert glsa.invalid?(:glsa_id)
- end
-
- test "successful creation" do
- glsa = Glsa.new(:glsa_id => "GLSA-2004-99")
-
- glsa.submitter = users(:test_user)
- glsa.requester = users(:test_user)
- glsa.bugreadymaker = users(:test_user)
-
- assert glsa.save
- end
-
- test "new request" do
- glsa = Glsa.new_request(
- "Some title",
- "236060, 260006",
- "some comment",
- "public",
- false,
- users(:test_user)
- )
-
- assert_equal(glsa.last_revision.title, "Some title")
- assert_equal(glsa.last_revision.bugs.map{|bug| bug.bug_id}.sort, [236060, 260006])
- assert !glsa.restricted
- end
-
- test "adding bulk references" do
- glsa = glsas(:glsa_two)
-
- glsa.add_references([
- {:title => "REF1", :url => "http://ref1/"},
- {:title => "REF2", :url => "http://ref2/"}
- ])
-
- assert glsa.valid?
-
- rev = glsa.last_revision
- assert rev.valid?
- assert_equal 'REF1', rev.references[0].title
- assert_equal 'http://ref1/', rev.references[0].url
- assert_equal 'REF2', rev.references[1].title
- assert_equal 'http://ref2/', rev.references[1].url
- end
-end
diff --git a/test/unit/helpers/bug_helper_test.rb b/test/unit/helpers/bug_helper_test.rb
deleted file mode 100644
index 6074d6d..0000000
--- a/test/unit/helpers/bug_helper_test.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'test_helper'
-
-class BugHelperTest < ActionView::TestCase
-end
diff --git a/test/unit/helpers/bugs_helper_test.rb b/test/unit/helpers/bugs_helper_test.rb
deleted file mode 100644
index 1f3a2a5..0000000
--- a/test/unit/helpers/bugs_helper_test.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'test_helper'
-
-class BugsHelperTest < ActionView::TestCase
-end
diff --git a/test/unit/helpers/comments_helper_test.rb b/test/unit/helpers/comments_helper_test.rb
deleted file mode 100644
index 2518c16..0000000
--- a/test/unit/helpers/comments_helper_test.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'test_helper'
-
-class CommentsHelperTest < ActionView::TestCase
-end
diff --git a/test/unit/helpers/cve_helper_test.rb b/test/unit/helpers/cve_helper_test.rb
deleted file mode 100644
index ea901ba..0000000
--- a/test/unit/helpers/cve_helper_test.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'test_helper'
-
-class CveHelperTest < ActionView::TestCase
-end
diff --git a/test/unit/helpers/glsa_helper_test.rb b/test/unit/helpers/glsa_helper_test.rb
deleted file mode 100644
index de7b8ef..0000000
--- a/test/unit/helpers/glsa_helper_test.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'test_helper'
-
-class GlsaHelperTest < ActionView::TestCase
-end
diff --git a/test/unit/helpers/index_helper_test.rb b/test/unit/helpers/index_helper_test.rb
deleted file mode 100644
index 104f529..0000000
--- a/test/unit/helpers/index_helper_test.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'test_helper'
-
-class IndexHelperTest < ActionView::TestCase
-end
diff --git a/test/unit/helpers/search_helper_test.rb b/test/unit/helpers/search_helper_test.rb
deleted file mode 100644
index 3034163..0000000
--- a/test/unit/helpers/search_helper_test.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'test_helper'
-
-class SearchHelperTest < ActionView::TestCase
-end
diff --git a/test/unit/helpers/templates_helper_test.rb b/test/unit/helpers/templates_helper_test.rb
deleted file mode 100644
index 6aa6ac7..0000000
--- a/test/unit/helpers/templates_helper_test.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'test_helper'
-
-class TemplatesHelperTest < ActionView::TestCase
-end
diff --git a/test/unit/helpers/tools_helper_test.rb b/test/unit/helpers/tools_helper_test.rb
deleted file mode 100644
index 0677abe..0000000
--- a/test/unit/helpers/tools_helper_test.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'test_helper'
-
-class ToolsHelperTest < ActionView::TestCase
-end
diff --git a/test/unit/helpers/user_helper_test.rb b/test/unit/helpers/user_helper_test.rb
deleted file mode 100644
index ad44a53..0000000
--- a/test/unit/helpers/user_helper_test.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'test_helper'
-
-class UserHelperTest < ActionView::TestCase
-end
diff --git a/test/unit/package_test.rb b/test/unit/package_test.rb
deleted file mode 100644
index 7fb7c58..0000000
--- a/test/unit/package_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require 'test_helper'
-
-class PackageTest < ActiveSupport::TestCase
- # Replace this with your real tests.
- test "the truth" do
- assert true
- end
-end
diff --git a/test/unit/reference_test.rb b/test/unit/reference_test.rb
deleted file mode 100644
index 77911d9..0000000
--- a/test/unit/reference_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require 'test_helper'
-
-class ReferenceTest < ActiveSupport::TestCase
- # Replace this with your real tests.
- test "the truth" do
- assert true
- end
-end
diff --git a/test/unit/revision_test.rb b/test/unit/revision_test.rb
deleted file mode 100644
index 52016dd..0000000
--- a/test/unit/revision_test.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-require 'test_helper'
-
-class RevisionTest < ActiveSupport::TestCase
- test "deep copy" do
- revision = revisions(:revision_one)
- new_revision = revision.deep_copy
-
- assert_equal(revision.title, new_revision.title)
- assert_equal(revision.glsa_id, new_revision.glsa_id)
- assert_equal(revision.access, new_revision.access)
- assert_equal(revision.product, new_revision.product)
- assert_equal(revision.category, new_revision.category)
- assert_equal(revision.severity, new_revision.severity)
- assert_equal(revision.synopsis, new_revision.synopsis)
- assert_equal(revision.background, new_revision.background)
- assert_equal(revision.description, new_revision.description)
- assert_equal(revision.impact, new_revision.impact)
- assert_equal(revision.workaround, new_revision.workaround)
- assert_equal(revision.resolution, new_revision.resolution)
-
- # Assuming that if the bug ID is copied, so is the rest
- assert_equal(revision.bugs.map{|bug| bug.bug_id}.sort, new_revision.bugs.map{|bug| bug.bug_id}.sort)
-
- assert_equal(revision.references.map{|ref| ref.url}.sort, new_revision.references.map{|ref| ref.url}.sort)
- assert_equal(
- revision.packages.map{|pkg| "#{pkg.comp}#{pkg.atom}-#{pkg.version}"}.sort,
- new_revision.packages.map{|pkg| "#{pkg.comp}#{pkg.atom}-#{pkg.version}"}.sort
- )
- end
-
- test "linked bugs" do
- assert_equal([236060, 260006], revisions(:revision_one).get_linked_bugs.sort)
- end
-
- test "malformed XML" do
- revision = revisions(:revision_one)
- revision.description = "<h1>hi"
-
- revision.save
- #assert revision.errors.any?
- #assert_equal [:description, "is not well-formed XML"], revision.errors.first
-
- revision.description = "hi"
- revision.save
- #assert_equal false, revision.errors.any?
- end
-end
diff --git a/test/unit/template_test.rb b/test/unit/template_test.rb
deleted file mode 100644
index a8346d6..0000000
--- a/test/unit/template_test.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-require 'test_helper'
-
-class TemplateTest < ActiveSupport::TestCase
- # test "the truth" do
- # assert true
- # end
-end
diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb
deleted file mode 100644
index 8ca01c5..0000000
--- a/test/unit/user_test.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-# GLSAMaker v2
-# Copyright (C) 2009-2011 Alex Legler <a3li@gentoo.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# For more information, see the LICENSE file.
-
-require 'test_helper'
-
-class UserTest < ActiveSupport::TestCase
- fixtures :users
-
- test "invalid user name" do
- user = User.new
- assert !user.valid?
- assert user.invalid?(:login)
- end
-
- test "unique user name" do
- user = User.new(:login => users(:test_user).login,
- :name => "Mr. T",
- :email => "foo@gentoo.org")
-
- assert !user.save
- assert_equal ["User name must be unique"], user.errors[:login]
- end
-
- test "invalid email" do
- user = User.new(:login => 'notyetthere',
- :name => 'doesntmatteranyway',
- :email => 'THIScouldNEVERbeAvalidEMAIL@ADDRESS')
-
- assert !user.valid?
- assert user.invalid?(:email)
- end
-
- test "successful creation" do
- user = User.new(:login => 'not_yet_taken_login',
- :name => 'doesntmatteranyway',
- :email => 'foo@bar.org',
- :access => 0)
-
- assert user.save
- end
-end