def test_get_switch(self): get_switch = switch.get_switch( 1, user=self.user_object, ) self.assertIsNotNone(get_switch) self.assertEqual(get_switch['ip'], '0.0.0.0')
def test_update_switch(self): switch.update_switch(1, user=self.user_object, vendor='test_update') update_switch = switch.get_switch( 1, user=self.user_object, ) expected = 'test_update' self.assertEqual(expected, update_switch['vendor'])
def test_update_switch(self): switch.update_switch( 1, user=self.user_object, vendor='test_update' ) update_switch = switch.get_switch( 1, user=self.user_object, ) expected = 'test_update' self.assertEqual(expected, update_switch['vendor'])
def test_patch_switch(self): switch.patch_switch(1, user=self.user_object, credentials={ 'version': '2c', 'community': 'public' }) patch_switch = switch.get_switch( 1, user=self.user_object, ) expected = {'credentials': {'version': '2c', 'community': 'public'}} self.assertTrue( all(item in patch_switch.items() for item in expected.items()))
def test_patch_switch(self): switch.patch_switch( self.user_object, 1, patched_credentials={ 'version': '2c', 'community': 'public' } ) patch_switch = switch.get_switch( self.user_object, 1 ) expected = { 'version': '2c', 'community': 'public' } self.assertTrue( item in expected.items() for item in patch_switch.items() )
def test_patch_switch(self): switch.patch_switch( 1, user=self.user_object, credentials={ 'version': '2c', 'community': 'public' } ) patch_switch = switch.get_switch( 1, user=self.user_object, ) expected = { 'credentials': { 'version': '2c', 'community': 'public' } } self.assertTrue( all(item in patch_switch.items() for item in expected.items()) )
def show_switch(switch_id): """Get switch.""" data = _get_request_args() return utils.make_json_response( 200, switch_api.get_switch(current_user, switch_id, **data) )
def test_get_switch(self): get_switch = switch.get_switch( self.user_object, 1 ) self.assertIsNotNone(get_switch)