mockito.verifyZeroInteractions

Here are the examples of the python api mockito.verifyZeroInteractions taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

16 Examples 7

Example 1

Project: mythbox
Source File: test_resolver.py
View license
    def test_store_When_channel_has_no_icon_Then_do_nothing(self):
        # Setup
        channel = Channel({'name':'Bogus Channel', 'icon':None, 'chanid': '9', 'callsign': 'WXYZ'})
        conn = Mock()
        downloader = MythChannelIconResolver(conn)
         
        # Test 
        downloader.store(channel, 'bogusDestDir')
    
        # Verify
        verifyZeroInteractions(conn)

Example 2

Project: mythbox
Source File: test_fanart.py
View license
    def test_getPosters_When_not_struck_out_and_delegate_returns_posters_Then_return_posters(self):
        # Setup
        provider = OneStrikeAndYoureOutFanartProvider(self.platform, self.delegate, self.nextProvider)
        when(self.delegate).getPosters(any()).thenReturn(['blah.png'])
        
        # Test
        posters = provider.getPosters(self.program)
        
        # Verify
        self.assertEqual('blah.png', posters[0])
        self.assertNotIn(self.program.title(), provider.struckOut.values())
        verifyZeroInteractions(self.nextProvider)

Example 3

Project: mythbox
Source File: test_fanart.py
View license
    def test_getPosters_When_struck_out_Then_skip_delegate_and_return_nextProviders_result(self):
        # Setup
        provider = OneStrikeAndYoureOutFanartProvider(self.platform, self.delegate, self.nextProvider)
        key = provider.createKey('getPosters', self.program)
        provider.strikeOut(key, self.program)
        when(self.nextProvider).getPosters(any()).thenReturn(['blah.png'])
        
        # Test
        posters = provider.getPosters(self.program)
        
        # Verify
        self.assertEqual('blah.png', posters[0])
        self.assertIn(self.program.title(), provider.struckOut[key].values())
        verifyZeroInteractions(self.delegate)

Example 4

Project: mythbox
Source File: test_fanart.py
View license
    def test_getSeasonAndEpisode_When_struck_out_Then_skip_delegate_and_return_nextProviders_result(self):
        # Setup
        provider = OneStrikeAndYoureOutFanartProvider(self.platform, self.delegate, self.nextProvider)
        key = provider.createKey('getSeasonAndEpisode', self.program)
        provider.strikeOut(key, self.program)
        when(self.nextProvider).getSeasonAndEpisode(any()).thenReturn(('1','2'))
        
        # Test
        season, episode = provider.getSeasonAndEpisode(self.program)
        
        # Verify
        self.assertEqual('1', season)
        self.assertEqual('2', episode)
        self.assertIn(self.program.title(), provider.struckOut[key].values())
        verifyZeroInteractions(self.delegate)

Example 5

Project: mythbox
Source File: test_fanart.py
View license
    def test_getSeasonAndEpisode_When_not_struck_out_and_delegate_returns_season_and_episode_Then_return_season_and_episode(self):
        # Setup
        provider = OneStrikeAndYoureOutFanartProvider(self.platform, self.delegate, self.nextProvider)
        when(self.delegate).getSeasonAndEpisode(any()).thenReturn(('1','2',))
        
        # Test
        season, episode = provider.getSeasonAndEpisode(self.program)
        
        # Verify
        self.assertEqual('1', season)
        self.assertEqual('2', episode)
        self.assertNotIn(self.program.title(), provider.struckOut.values())
        verifyZeroInteractions(self.nextProvider)

Example 6

Project: mythbox
Source File: test_fanart.py
View license
    def test_getSeasonAndEpisode_When_found_in_cache_Then_return_cached_copy(self):
        # Given
        key = self.provider.createEpisodeKey('getSeasonAndEpisode', self.program)
        self.provider.imagePathsByKey[key] = ('5','12')
                        
        # When
        season, episode = self.provider.getSeasonAndEpisode(self.program)
        
        # Then
        self.assertEqual('5', season)
        self.assertEqual('12', episode)
        verifyZeroInteractions(self.nextProvider)

Example 7

Project: mythbox
Source File: test_resolver.py
View license
    def test_store_When_channel_has_no_icon_Then_do_nothing(self):
        # Setup
        channel = Channel({'name':'Bogus Channel', 'icon':None, 'chanid': '9', 'callsign': 'WXYZ'})
        conn = Mock()
        downloader = MythChannelIconResolver(conn)
         
        # Test 
        downloader.store(channel, 'bogusDestDir')
    
        # Verify
        verifyZeroInteractions(conn)

Example 8

Project: mythbox
Source File: test_fanart.py
View license
    def test_getPosters_When_not_struck_out_and_delegate_returns_posters_Then_return_posters(self):
        # Setup
        provider = OneStrikeAndYoureOutFanartProvider(self.platform, self.delegate, self.nextProvider)
        when(self.delegate).getPosters(any()).thenReturn(['blah.png'])
        
        # Test
        posters = provider.getPosters(self.program)
        
        # Verify
        self.assertEqual('blah.png', posters[0])
        self.assertNotIn(self.program.title(), provider.struckOut.values())
        verifyZeroInteractions(self.nextProvider)

Example 9

Project: mythbox
Source File: test_fanart.py
View license
    def test_getPosters_When_struck_out_Then_skip_delegate_and_return_nextProviders_result(self):
        # Setup
        provider = OneStrikeAndYoureOutFanartProvider(self.platform, self.delegate, self.nextProvider)
        key = provider.createKey('getPosters', self.program)
        provider.strikeOut(key, self.program)
        when(self.nextProvider).getPosters(any()).thenReturn(['blah.png'])
        
        # Test
        posters = provider.getPosters(self.program)
        
        # Verify
        self.assertEqual('blah.png', posters[0])
        self.assertIn(self.program.title(), provider.struckOut[key].values())
        verifyZeroInteractions(self.delegate)

Example 10

Project: mythbox
Source File: test_fanart.py
View license
    def test_getSeasonAndEpisode_When_struck_out_Then_skip_delegate_and_return_nextProviders_result(self):
        # Setup
        provider = OneStrikeAndYoureOutFanartProvider(self.platform, self.delegate, self.nextProvider)
        key = provider.createKey('getSeasonAndEpisode', self.program)
        provider.strikeOut(key, self.program)
        when(self.nextProvider).getSeasonAndEpisode(any()).thenReturn(('1','2'))
        
        # Test
        season, episode = provider.getSeasonAndEpisode(self.program)
        
        # Verify
        self.assertEqual('1', season)
        self.assertEqual('2', episode)
        self.assertIn(self.program.title(), provider.struckOut[key].values())
        verifyZeroInteractions(self.delegate)

Example 11

Project: mythbox
Source File: test_fanart.py
View license
    def test_getSeasonAndEpisode_When_not_struck_out_and_delegate_returns_season_and_episode_Then_return_season_and_episode(self):
        # Setup
        provider = OneStrikeAndYoureOutFanartProvider(self.platform, self.delegate, self.nextProvider)
        when(self.delegate).getSeasonAndEpisode(any()).thenReturn(('1','2',))
        
        # Test
        season, episode = provider.getSeasonAndEpisode(self.program)
        
        # Verify
        self.assertEqual('1', season)
        self.assertEqual('2', episode)
        self.assertNotIn(self.program.title(), provider.struckOut.values())
        verifyZeroInteractions(self.nextProvider)

Example 12

Project: mythbox
Source File: test_fanart.py
View license
    def test_getSeasonAndEpisode_When_found_in_cache_Then_return_cached_copy(self):
        # Given
        key = self.provider.createEpisodeKey('getSeasonAndEpisode', self.program)
        self.provider.imagePathsByKey[key] = ('5','12')
                        
        # When
        season, episode = self.provider.getSeasonAndEpisode(self.program)
        
        # Then
        self.assertEqual('5', season)
        self.assertEqual('12', episode)
        verifyZeroInteractions(self.nextProvider)

Example 13

Project: mythbox
Source File: test_toolkit.py
View license
    def test_enterText_Should_DoNothing_When_UserCancelsOperation(self):
        # Setup
        xbmc.Keyboard.stubConfirmed = False
        control = Mock()
        validator = Mock()
        updater = Mock()
        
        # Test
        enterText(control=control, validator=validator.validate, updater=updater.update)
        
        # Verify
        verifyZeroInteractions(validator)
        verifyZeroInteractions(updater)

Example 14

Project: mythbox
Source File: test_toolkit.py
View license
    def test_enterText_Should_NotUpdateControlAndModel_When_UserEnteredTextFailsValidation(self):
        # Setup
        xbmc.Keyboard.stubConfirmed = True
        xbmc.Keyboard.stubText = 'Bubba'
        control = Mock()
        updater = Mock()
        validator = Mock()
        when(validator).validate(any()).thenRaise(Exception('Invalid name'))        
        
        # Test
        enterText(control=control, validator=validator.validate, updater=updater.update)
        
        # Verify
        verifyZeroInteractions(updater)
        verify(control, 0).setLabel(any(str), any(str))

Example 15

Project: mythbox
Source File: test_toolkit.py
View license
    def test_enterText_Should_DoNothing_When_UserCancelsOperation(self):
        # Setup
        xbmc.Keyboard.stubConfirmed = False
        control = Mock()
        validator = Mock()
        updater = Mock()
        
        # Test
        enterText(control=control, validator=validator.validate, updater=updater.update)
        
        # Verify
        verifyZeroInteractions(validator)
        verifyZeroInteractions(updater)

Example 16

Project: mythbox
Source File: test_toolkit.py
View license
    def test_enterText_Should_NotUpdateControlAndModel_When_UserEnteredTextFailsValidation(self):
        # Setup
        xbmc.Keyboard.stubConfirmed = True
        xbmc.Keyboard.stubText = 'Bubba'
        control = Mock()
        updater = Mock()
        validator = Mock()
        when(validator).validate(any()).thenRaise(Exception('Invalid name'))        
        
        # Test
        enterText(control=control, validator=validator.validate, updater=updater.update)
        
        # Verify
        verifyZeroInteractions(updater)
        verify(control, 0).setLabel(any(str), any(str))