Skip to content

Commit

Permalink
final tests for room handlers in Admin API
Browse files Browse the repository at this point in the history
  • Loading branch information
avdb13 committed Feb 13, 2024
1 parent 35fad6a commit c96487b
Show file tree
Hide file tree
Showing 5 changed files with 248 additions and 36 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Continuous Integration
on:
push:
branches:
- "*"
- main
pull_request:
branches: [main]
paths:
Expand Down Expand Up @@ -86,9 +86,6 @@ jobs:
run: |
cargo test -p test -- --test-threads=1
- name: Code Coverage
uses: actions-rs/[email protected]

- name: Print Logs
if: always()
run: |
Expand Down
4 changes: 3 additions & 1 deletion crates/core/src/account/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ mod test {
};
let err = dto.validate().err().unwrap();

assert!(err.to_string().contains("username cannot contain uppercase letters"));
assert!(err
.to_string()
.contains("username cannot contain uppercase letters"));
}
}
2 changes: 1 addition & 1 deletion crates/matrix/src/admin/resources/room.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ pub struct ListResponse {

#[derive(Debug, Deserialize)]
pub struct MembersResponse {
pub members: Vec<String>,
pub members: Vec<OwnedUserId>,
pub total: u64,
}

Expand Down
9 changes: 6 additions & 3 deletions crates/matrix/src/client/resources/room.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ pub struct LeaveRoomResponse {}
#[derive(Debug, Deserialize)]
pub struct ForgetRoomResponse {}

#[derive(Debug, Deserialize)]
pub struct RoomKickOrBanResponse {}

#[derive(Debug, Deserialize)]
pub struct MatrixError {
pub errcode: String,
Expand Down Expand Up @@ -226,7 +229,7 @@ impl Room {
access_token: impl Into<String>,
room_id: &RoomId,
body: RoomKickOrBanBody,
) -> Result<()> {
) -> Result<RoomKickOrBanResponse> {
let mut tmp = (*client).clone();
tmp.set_token(access_token)?;

Expand Down Expand Up @@ -255,7 +258,7 @@ impl Room {
access_token: impl Into<String>,
room_id: &RoomId,
body: RoomKickOrBanBody,
) -> Result<()> {
) -> Result<RoomKickOrBanResponse> {
let mut tmp = (*client).clone();
tmp.set_token(access_token)?;

Expand Down Expand Up @@ -284,7 +287,7 @@ impl Room {
access_token: impl Into<String>,
room_id: &RoomId,
body: RoomKickOrBanBody,
) -> Result<()> {
) -> Result<RoomKickOrBanResponse> {
let mut tmp = (*client).clone();
tmp.set_token(access_token)?;

Expand Down
Loading

0 comments on commit c96487b

Please sign in to comment.