Joshua Hesketh | ffe4206 | 2014-09-05 21:43:52 +1000 | [diff] [blame] | 1 | # 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 Hesketh | d78b448 | 2015-09-14 16:56:34 -0600 | [diff] [blame] | 15 | import fixtures |
Joshua Hesketh | ffe4206 | 2014-09-05 21:43:52 +1000 | [diff] [blame] | 16 | import logging |
| 17 | import testtools |
| 18 | |
Joshua Hesketh | d78b448 | 2015-09-14 16:56:34 -0600 | [diff] [blame] | 19 | import zuul.reporter.gerrit |
| 20 | import zuul.reporter.smtp |
| 21 | import zuul.reporter.sql |
Joshua Hesketh | ffe4206 | 2014-09-05 21:43:52 +1000 | [diff] [blame] | 22 | |
| 23 | |
| 24 | class TestSMTPReporter(testtools.TestCase): |
| 25 | log = logging.getLogger("zuul.test_reporter") |
| 26 | |
Joshua Hesketh | ffe4206 | 2014-09-05 21:43:52 +1000 | [diff] [blame] | 27 | def test_reporter_abc(self): |
| 28 | # We only need to instantiate a class for this |
Joshua Hesketh | 352264b | 2015-08-11 23:42:08 +1000 | [diff] [blame] | 29 | reporter = zuul.reporter.smtp.SMTPReporter({}) # noqa |
Joshua Hesketh | ffe4206 | 2014-09-05 21:43:52 +1000 | [diff] [blame] | 30 | |
| 31 | def test_reporter_name(self): |
| 32 | self.assertEqual('smtp', zuul.reporter.smtp.SMTPReporter.name) |
| 33 | |
| 34 | |
| 35 | class TestGerritReporter(testtools.TestCase): |
| 36 | log = logging.getLogger("zuul.test_reporter") |
| 37 | |
Joshua Hesketh | ffe4206 | 2014-09-05 21:43:52 +1000 | [diff] [blame] | 38 | 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 Hesketh | d78b448 | 2015-09-14 16:56:34 -0600 | [diff] [blame] | 44 | |
| 45 | |
| 46 | class 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) |