Changeset - 3e5521eebc62
[Not reviewed]
0 1 0
Branko Majic (branko) - 10 months ago 2025-02-12 04:37:34
branko@majic.rs
MAR-242: Avoid using magic numbers without explanation.
1 file changed with 3 insertions and 1 deletions:
0 comments (0 inline, 0 general)
roles/xmpp_server/molecule/default/tests/test_client.py
Show inline comments
 
@@ -179,30 +179,32 @@ def test_http_file_share_size_limit(host, username, password, domain):
 

	
 
@pytest.mark.parametrize("username, password, domain, server", [
 
    ["john.doe", "johnpassword", "domain1", "parameters-mandatory"],
 
    ["jane.doe", "janepassword", "domain2", "parameters-optional"],
 
    ["mick.doe", "mickpassword", "domain3", "parameters-optional"],
 
])
 
@pytest.mark.usefixtures("server_clean_domain_uploads")
 
def test_http_file_share_daily_quota(host, username, password, domain):
 
    """
 
    Tests the user's daily quota for files uploaded via XEP-0363.
 
    """
 

	
 
    # Equivalent of 100MiB.
 
    file_size_limit = 10 * 1024 * 1024
 
    file_count = 10
 

	
 
    # Fill-up the daily quota.
 
    create_sample_file = host.run("dd if=/dev/zero of=/tmp/http_file_upload_sample.txt bs=%sB count=1", str(file_size_limit))
 
    assert create_sample_file.rc == 0
 
    for _ in range(10):
 
    for _ in range(file_count):
 
        send = host.run(f"go-sendxmpp --debug --username {username}@{domain} --password {password} --jserver {domain}:5222 "
 
                        f"--http-upload /tmp/http_file_upload_sample.txt "
 
                        f"{username}@{domain}")
 
        assert send.rc == 0
 

	
 
    # Test exceeded daily quota.
 
    create_sample_file = host.run("dd if=/dev/zero of=/tmp/http_file_upload_sample.txt bs=1B count=1")
 
    assert create_sample_file.rc == 0
 

	
 
    send = host.run(f"go-sendxmpp --debug --username {username}@{domain} --password {password} --jserver {domain}:5222 "
 
                    f"--http-upload /tmp/http_file_upload_sample.txt "
 
                    f"{username}@{domain}")
0 comments (0 inline, 0 general)