blob: 6a179d2296eeec8a2fdad8d480cd2eb238903fab [file] [log] [blame]
Joshua Heskethffe42062014-09-05 21:43:52 +10001# Copyright 2014 Rackspace Australia
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
Joshua Heskethd78b4482015-09-14 16:56:34 -060015import fixtures
Joshua Heskethffe42062014-09-05 21:43:52 +100016import logging
17import testtools
18
Joshua Heskethd78b4482015-09-14 16:56:34 -060019import zuul.reporter.gerrit
20import zuul.reporter.smtp
21import zuul.reporter.sql
Joshua Heskethffe42062014-09-05 21:43:52 +100022
23
24class TestSMTPReporter(testtools.TestCase):
25 log = logging.getLogger("zuul.test_reporter")
26
Joshua Heskethffe42062014-09-05 21:43:52 +100027 def test_reporter_abc(self):
28 # We only need to instantiate a class for this
Joshua Hesketh352264b2015-08-11 23:42:08 +100029 reporter = zuul.reporter.smtp.SMTPReporter({}) # noqa
Joshua Heskethffe42062014-09-05 21:43:52 +100030
31 def test_reporter_name(self):
32 self.assertEqual('smtp', zuul.reporter.smtp.SMTPReporter.name)
33
34
35class TestGerritReporter(testtools.TestCase):
36 log = logging.getLogger("zuul.test_reporter")
37
Joshua Heskethffe42062014-09-05 21:43:52 +100038 def test_reporter_abc(self):
39 # We only need to instantiate a class for this
40 reporter = zuul.reporter.gerrit.GerritReporter(None) # noqa
41
42 def test_reporter_name(self):
43 self.assertEqual('gerrit', zuul.reporter.gerrit.GerritReporter.name)
Joshua Heskethd78b4482015-09-14 16:56:34 -060044
45
46class TestSQLReporter(testtools.TestCase):
47 log = logging.getLogger("zuul.test_reporter")
48
49 def test_reporter_abc(self):
50 # We only need to instantiate a class for this
51 # First mock out _setup_tables
52 def _fake_setup_tables(self):
53 pass
54
55 self.useFixture(fixtures.MonkeyPatch(
56 'zuul.reporter.sql.SQLReporter._setup_tables',
57 _fake_setup_tables
58 ))
59
60 reporter = zuul.reporter.sql.SQLReporter() # noqa
61
62 def test_reporter_name(self):
63 self.assertEqual(
64 'sql', zuul.reporter.sql.SQLReporter.name)