예제 #1
0
def test_get_json_string():
    ctr = ChangeTrackingRecord("myTopic", 1020304, 0, "soruce", "table", "db", {"a": 1, "b": 2, "c": 3})
    expected = (
        '{"topic": "myTopic", "version": 1020304, "operation": 0, "source_host": "soruce", '
        '"source_table": "table", "source_database": "db", "tuple": {"a": 1, "b": 2, "c": 3}, '
        '"headers": {"forwardable": true, "deduplicatable": true}, "addlParams": {}}'
    )
    assert ctr.getJSONString() == expected
예제 #2
0
def test_ctr_wrong_topic():
    with pytest.raises(AttributeError):
        ChangeTrackingRecord(404, 1020304, 0, "soruce", "table", "db", {"a": 1, "b": 2, "c": 3})
예제 #3
0
def test_ctr_wrong_host():
    with pytest.raises(AttributeError):
        ChangeTrackingRecord("Mytopic", 1020304, 0, 3480, "table", "db", {"a": 1, "b": 2, "c": 3})
예제 #4
0
def test_ctr_wrong_operation():
    with pytest.raises(AttributeError):
        ChangeTrackingRecord("Mytopic", 120304, 9, "soruce", "table", "db", {"a": 1, "b": 2, "c": 3})
예제 #5
0
def test_ctr_wrong_version_float():
    with pytest.raises(AttributeError):
        ChangeTrackingRecord(
            "Mytopic", 534543.9457, 0, "soruce", "table", "db", {"a": 1, "b": 2, "c": 3}
        )
예제 #6
0
def test_ctr_wrong_version_str():
    with pytest.raises(AttributeError):
        ChangeTrackingRecord("Mytopic", "1.1.0", 0, "soruce", "table", "db", {"a": 1, "b": 2, "c": 3})