Skip to content

Commit

Permalink
Tests: Mark module with darwin instead of functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
matan1008 committed Mar 7, 2022
1 parent bbe7d26 commit 4659cf6
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 3 deletions.
19 changes: 19 additions & 0 deletions src/rpcclient/tests/test_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import pytest

from rpcclient.exceptions import ArgumentError


def test_peek(client):
"""
:param rpcclient.client.Client client:
"""
with client.safe_malloc(0x100) as peekable:
client.peek(peekable, 0x100)


def test_peek_invalid_address(client):
"""
:param rpcclient.client.Client client:
"""
with pytest.raises(ArgumentError):
client.peek(0, 0x10)
2 changes: 2 additions & 0 deletions src/rpcclient/tests/test_core_foundation_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import pytest

pytestmark = pytest.mark.darwin


@pytest.mark.parametrize('data', [
None,
Expand Down
18 changes: 18 additions & 0 deletions src/rpcclient/tests/test_darwin_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import pytest

pytestmark = pytest.mark.darwin


def test_modules(client):
"""
:param rpcclient.client.Client client:
"""
assert '/usr/lib/libSystem.B.dylib' in client.modules


def test_uname(client):
"""
:param rpcclient.client.Client client:
"""
assert client.uname.sysname == 'Darwin'
assert 'machine' in client.uname
4 changes: 2 additions & 2 deletions src/rpcclient/tests/test_objc_symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

from rpcclient.darwin.consts import NSStringEncoding

pytestmark = pytest.mark.darwin


@pytest.mark.darwin
def test_method_by_method_name(client):
NSString = client.objc_get_class('NSString')
ascii_encoding = NSStringEncoding.NSASCIIStringEncoding
Expand All @@ -14,7 +15,6 @@ def test_method_by_method_name(client):
assert str1.uppercaseString().cStringUsingEncoding_(ascii_encoding).peek_str() == 'TAYLOR SWIFT'


@pytest.mark.darwin
def test_calling_property(client):
d = client.symbols.objc_getClass('NSMutableDictionary').objc_call('new').objc_symbol
# call method
Expand Down
1 change: 1 addition & 0 deletions src/rpcclient/tests/test_preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from rpcclient.exceptions import NoSuchPreferenceError

pytestmark = pytest.mark.darwin
DOMAIN = 'rpcserver'


Expand Down
3 changes: 2 additions & 1 deletion src/rpcclient/tests/test_xpc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import pytest

pytestmark = pytest.mark.darwin


@pytest.mark.darwin
def test_from_xpc_object(client):
"""
:param rpcclient.darwin.client.DarwinClient client:
Expand Down

0 comments on commit 4659cf6

Please sign in to comment.