def test_get_item_with_ivalid_type(self): with pytest.raises(TypeError): audit_logs.AuditLog( entries=[object(), object()], integrations={}, users={}, webhooks={}, )["OK"]
def test_len(self): audit_log = audit_logs.AuditLog( entries={ snowflakes.Snowflake(432123): object(), snowflakes.Snowflake(432654): object(), snowflakes.Snowflake(432888): object(), snowflakes.Snowflake(783452): object(), }, integrations={}, users={}, webhooks={}, ) assert len(audit_log) == 4
def test_iter(self): entry_1 = object() entry_2 = object() entry_3 = object() audit_log = audit_logs.AuditLog( entries={ snowflakes.Snowflake(432123): entry_1, snowflakes.Snowflake(432654): entry_2, snowflakes.Snowflake(432888): entry_3, }, integrations={}, users={}, webhooks={}, ) assert list(audit_log) == [entry_1, entry_2, entry_3]
def test_get_item_with_slice(self): entry_1 = object() entry_2 = object() audit_log = audit_logs.AuditLog( entries={ snowflakes.Snowflake(432123): object(), snowflakes.Snowflake(432654): entry_1, snowflakes.Snowflake(432888): object(), snowflakes.Snowflake(666666): entry_2, snowflakes.Snowflake(783452): object(), }, integrations={}, users={}, webhooks={}, ) assert audit_log[1:5:2] == (entry_1, entry_2)
def test_get_item_with_index(self): entry = object() entry_2 = object() audit_log = audit_logs.AuditLog( entries={ snowflakes.Snowflake(432123): object(), snowflakes.Snowflake(432654): entry, snowflakes.Snowflake(432888): object(), snowflakes.Snowflake(677777): object(), snowflakes.Snowflake(999999): entry_2, }, integrations={}, users={}, webhooks={}, ) assert audit_log[1] is entry assert audit_log[4] is entry_2