Exemplo n.º 1
0
 def test_update_switch_machine(self):
     switch.add_switch_machine(
         1,
         mac='28:6e:d4:46:c4:25',
         port='1',
         user=self.user_object,
     )
     switch.update_switch_machine(
         1,
         1,
         tag='test_tag',
         user=self.user_object,
     )
     update_switch_machine = switch.list_switch_machines(
         1,
         user=self.user_object,
     )
     expected = {
         'switch_id': 1,
         'id': 1,
         'mac': '28:6e:d4:46:c4:25',
         'tag': 'test_tag',
         'switch_ip': '0.0.0.0',
         'machine_id': 1,
         'port': '1',
         'switch_machine_id': 1
     }
     self.assertTrue(
         all(item in update_switch_machine[0].items()
             for item in expected.items()))
Exemplo n.º 2
0
 def test_update_switch_machine(self):
     switch.add_switch_machine(
         1,
         mac='28:6e:d4:46:c4:25',
         port='1',
         user=self.user_object,
     )
     switch.update_switch_machine(
         1,
         1,
         tag='test_tag',
         user=self.user_object,
     )
     update_switch_machine = switch.list_switch_machines(
         1,
         user=self.user_object,
     )
     expected = {
         'switch_id': 1,
         'id': 1,
         'mac': '28:6e:d4:46:c4:25',
         'tag': 'test_tag',
         'switch_ip': '0.0.0.0',
         'machine_id': 1,
         'port': '1',
         'switch_machine_id': 1
     }
     self.assertTrue(
         all(item in update_switch_machine[0].items()
             for item in expected.items())
     )
Exemplo n.º 3
0
def update_switch_machine():
    """update switch machine."""
    data = _get_request_data()
    return utils.make_json_response(
        200,
        switch_api.update_switch_machine(
            current_user, switch_id, machine_id, **data
        )
    )
Exemplo n.º 4
0
 def test_update_switch_machine(self):
     switch.add_switch_machine(
         self.user_object,
         1,
         mac='28:6e:d4:46:c4:25',
         port='1'
     )
     switch.update_switch_machine(
         self.user_object,
         1,
         1,
         tag='test_tag'
     )
     update_switch_machine = switch.list_switch_machines(
         self.user_object,
         1
     )
     expected = {'tag': 'test_tag'}
     self.assertTrue(
         item in update_switch_machine[0].items for item in expected.items()
     )