Exemplo n.º 1
0
def test_updateList_added(controller):
    cm = ComputeManager()
    computes = []
    compute = Compute()
    computes.append(compute)
    controller._http_client = MagicMock()
    cm.updateList(computes)
    assert compute.id() in cm._computes
    controller._http_client.createHTTPQuery.assert_called_with(
        "POST", "/computes", None, body=compute.__json__())
Exemplo n.º 2
0
def test_json():
    compute = Compute("test")
    compute.setHost("example.org")
    compute.setName("Test")
    compute.setProtocol("https")
    compute.setUser("hello")
    compute.setPassword("world")
    compute.setPort(4242)
    assert compute.__json__() == {
        'compute_id': 'test',
        'host': 'example.org',
        'name': 'Test',
        'password': '******',
        'port': 4242,
        'protocol': 'https',
        'user': '******'
    }
Exemplo n.º 3
0
def test_updateList_added(controller):
    cm = ComputeManager()
    computes = []
    compute = Compute()
    computes.append(compute)
    controller._http_client = MagicMock()
    cm.updateList(computes)
    assert compute.id() in cm._computes
    controller._http_client.createHTTPQuery.assert_called_with("POST", "/computes", None, body=compute.__json__())