parent
95717ba28d
commit
74ac826a87
25 changed files with 761 additions and 49 deletions
30
tests/test_hub/test_add_volume.py
Normal file
30
tests/test_hub/test_add_volume.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import unittest
|
||||
|
||||
import mock
|
||||
|
||||
import koji
|
||||
import kojihub
|
||||
|
||||
|
||||
class TestAddVolume(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.verify_name_internal = mock.patch('kojihub.verify_name_internal').start()
|
||||
self.context = mock.patch('kojihub.context').start()
|
||||
# It seems MagicMock will not automatically handle attributes that
|
||||
# start with "assert"
|
||||
self.context.session.assertPerm = mock.MagicMock()
|
||||
self.context.session.assertLogin = mock.MagicMock()
|
||||
|
||||
def test_add_volume_wrong_format(self):
|
||||
volume_name = 'volume-name+'
|
||||
|
||||
# name is longer as expected
|
||||
self.verify_name_internal.side_effect = koji.GenericError
|
||||
with self.assertRaises(koji.GenericError):
|
||||
kojihub.add_volume(volume_name)
|
||||
|
||||
# not except regex rules
|
||||
self.verify_name_internal.side_effect = koji.GenericError
|
||||
with self.assertRaises(koji.GenericError):
|
||||
kojihub.add_volume(volume_name)
|
||||
Loading…
Add table
Add a link
Reference in a new issue