Пример #1
0
 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')
Пример #2
0
 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')
Пример #3
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'])
Пример #4
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'])
Пример #5
0
 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()))
Пример #6
0
 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()
     )
Пример #7
0
 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())
     )
Пример #8
0
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)
    )
Пример #9
0
 def test_get_switch(self):
     get_switch = switch.get_switch(
         self.user_object,
         1
     )
     self.assertIsNotNone(get_switch)