Skip to content

Commit a268dae

Browse files
authored
chore: Move integration tests into tests dir
1 parent 8be03d5 commit a268dae

File tree

58 files changed

+1605
-1635
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1605
-1635
lines changed

.github/workflows/rust.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ jobs:
1919
- name: Build
2020
run: cargo build --verbose
2121
- name: Run tests
22-
run: cargo test --verbose --features api-client,receipt-utility,ocsp
22+
run: cargo test --verbose --features api-client,receipt-utility
23+
- name: Run tests (Only ocsp)
24+
run: cargo test --verbose --features ocsp

.gitignore

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,7 @@ fabric.properties
8787
debug/
8888
target/
8989

90-
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
91-
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
9290
Cargo.lock
93-
api/Cargo.lock
94-
core/Cargo.lock
95-
sdk/bindings/Cargo.lock
96-
sdk/example/Cargo.lock
97-
sdk/lib/Cargo.lock
9891
# These are backup files generated by rustfmt
9992
**/*.rs.bk
10093

src/api_client.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ mod tests {
767767
#[tokio::test]
768768
async fn test_extend_renewal_date_for_all_active_subscribers() {
769769
let client = app_store_server_api_client_with_body_from_file(
770-
"resources/models/extendRenewalDateForAllActiveSubscribersResponse.json",
770+
"tests/resources/models/extendRenewalDateForAllActiveSubscribersResponse.json",
771771
StatusCode::OK,
772772
Some(|req, body| {
773773
assert_eq!(Method::POST, req.method());
@@ -834,7 +834,7 @@ mod tests {
834834
#[tokio::test]
835835
async fn test_extend_subscription_renewal_date() {
836836
let client = app_store_server_api_client_with_body_from_file(
837-
"resources/models/extendSubscriptionRenewalDateResponse.json",
837+
"tests/resources/models/extendSubscriptionRenewalDateResponse.json",
838838
StatusCode::OK,
839839
Some(|req, body| {
840840
assert_eq!(Method::PUT, req.method());
@@ -889,7 +889,7 @@ mod tests {
889889
#[tokio::test]
890890
async fn test_get_all_subscription_statuses() {
891891
let client = app_store_server_api_client_with_body_from_file(
892-
"resources/models/getAllSubscriptionStatusesResponse.json",
892+
"tests/resources/models/getAllSubscriptionStatusesResponse.json",
893893
StatusCode::OK,
894894
Some(|req, _body| {
895895
assert_eq!(Method::GET, req.method());
@@ -946,7 +946,7 @@ mod tests {
946946
#[tokio::test]
947947
async fn test_get_refund_history() {
948948
let client = app_store_server_api_client_with_body_from_file(
949-
"resources/models/getRefundHistoryResponse.json",
949+
"tests/resources/models/getRefundHistoryResponse.json",
950950
StatusCode::OK,
951951
Some(|req, _body| {
952952
assert_eq!(Method::GET, req.method());
@@ -974,7 +974,7 @@ mod tests {
974974
#[tokio::test]
975975
async fn test_get_status_of_subscription_renewal_date_extensions() {
976976
let client = app_store_server_api_client_with_body_from_file(
977-
"resources/models/getStatusOfSubscriptionRenewalDateExtensionsResponse.json",
977+
"tests/resources/models/getStatusOfSubscriptionRenewalDateExtensionsResponse.json",
978978
StatusCode::OK,
979979
Some(|req, _body| {
980980
assert_eq!(Method::GET, req.method());
@@ -1007,7 +1007,7 @@ mod tests {
10071007
#[tokio::test]
10081008
async fn test_get_test_notification_status() {
10091009
let client = app_store_server_api_client_with_body_from_file(
1010-
"resources/models/getTestNotificationStatusResponse.json",
1010+
"tests/resources/models/getTestNotificationStatusResponse.json",
10111011
StatusCode::OK,
10121012
Some(|req, _body| {
10131013
assert_eq!(Method::GET, req.method());
@@ -1041,7 +1041,7 @@ mod tests {
10411041
#[tokio::test]
10421042
async fn test_get_notification_history() {
10431043
let client = app_store_server_api_client_with_body_from_file(
1044-
"resources/models/getNotificationHistoryResponse.json",
1044+
"tests/resources/models/getNotificationHistoryResponse.json",
10451045
StatusCode::OK,
10461046
Some(|req, body| {
10471047
assert_eq!(Method::POST, req.method());
@@ -1121,7 +1121,7 @@ mod tests {
11211121
#[tokio::test]
11221122
async fn test_get_transaction_history_v1() {
11231123
let client = app_store_server_api_client_with_body_from_file(
1124-
"resources/models/transactionHistoryResponse.json",
1124+
"tests/resources/models/transactionHistoryResponse.json",
11251125
StatusCode::OK,
11261126
Some(|req, _body| {
11271127
assert_eq!(Method::GET, req.method());
@@ -1166,7 +1166,7 @@ mod tests {
11661166
#[tokio::test]
11671167
async fn test_get_transaction_history_v2() {
11681168
let client = app_store_server_api_client_with_body_from_file(
1169-
"resources/models/transactionHistoryResponse.json",
1169+
"tests/resources/models/transactionHistoryResponse.json",
11701170
StatusCode::OK,
11711171
Some(|req, _body| {
11721172
assert_eq!(Method::GET, req.method());
@@ -1251,7 +1251,7 @@ mod tests {
12511251
#[tokio::test]
12521252
async fn test_get_transaction_info() {
12531253
let client = app_store_server_api_client_with_body_from_file(
1254-
"resources/models/transactionInfoResponse.json",
1254+
"tests/resources/models/transactionInfoResponse.json",
12551255
StatusCode::OK,
12561256
Some(|req, _body| {
12571257
assert_eq!(Method::GET, req.method());
@@ -1273,7 +1273,7 @@ mod tests {
12731273
#[tokio::test]
12741274
async fn test_look_up_order_id() {
12751275
let client = app_store_server_api_client_with_body_from_file(
1276-
"resources/models/lookupOrderIdResponse.json",
1276+
"tests/resources/models/lookupOrderIdResponse.json",
12771277
StatusCode::OK,
12781278
Some(|req, _body| {
12791279
assert_eq!(Method::GET, req.method());
@@ -1296,7 +1296,7 @@ mod tests {
12961296
#[tokio::test]
12971297
async fn test_request_test_notification() {
12981298
let client = app_store_server_api_client_with_body_from_file(
1299-
"resources/models/requestTestNotificationResponse.json",
1299+
"tests/resources/models/requestTestNotificationResponse.json",
13001300
StatusCode::OK,
13011301
Some(|req, _body| {
13021302
assert_eq!(Method::POST, req.method());
@@ -1412,7 +1412,7 @@ mod tests {
14121412
#[tokio::test]
14131413
async fn test_invalid_app_account_token_uuid_error() {
14141414
let client = app_store_server_api_client_with_body_from_file(
1415-
"resources/models/invalidAppAccountTokenUUIDError.json",
1415+
"tests/resources/models/invalidAppAccountTokenUUIDError.json",
14161416
StatusCode::BAD_REQUEST,
14171417
None,
14181418
);
@@ -1443,7 +1443,7 @@ mod tests {
14431443
#[tokio::test]
14441444
async fn test_family_transaction_not_supported_error() {
14451445
let client = app_store_server_api_client_with_body_from_file(
1446-
"resources/models/familyTransactionNotSupportedError.json",
1446+
"tests/resources/models/familyTransactionNotSupportedError.json",
14471447
StatusCode::BAD_REQUEST,
14481448
None,
14491449
);
@@ -1474,7 +1474,7 @@ mod tests {
14741474
#[tokio::test]
14751475
async fn test_transaction_id_not_original_transaction_id_error() {
14761476
let client = app_store_server_api_client_with_body_from_file(
1477-
"resources/models/transactionIdNotOriginalTransactionId.json",
1477+
"tests/resources/models/transactionIdNotOriginalTransactionId.json",
14781478
StatusCode::BAD_REQUEST,
14791479
None,
14801480
);
@@ -1505,7 +1505,7 @@ mod tests {
15051505
#[tokio::test]
15061506
async fn test_headers() {
15071507
let client = app_store_server_api_client_with_body_from_file(
1508-
"resources/models/transactionInfoResponse.json",
1508+
"tests/resources/models/transactionInfoResponse.json",
15091509
StatusCode::OK,
15101510
Some(|req, _body| {
15111511
let headers = req.headers();
@@ -1538,7 +1538,7 @@ mod tests {
15381538
#[tokio::test]
15391539
async fn test_api_error() {
15401540
let client = app_store_server_api_client_with_body_from_file(
1541-
"resources/models/apiException.json",
1541+
"tests/resources/models/apiException.json",
15421542
StatusCode::INTERNAL_SERVER_ERROR,
15431543
None,
15441544
);
@@ -1560,7 +1560,7 @@ mod tests {
15601560
#[tokio::test]
15611561
async fn test_api_too_many_requests() {
15621562
let client = app_store_server_api_client_with_body_from_file(
1563-
"resources/models/apiTooManyRequestsException.json",
1563+
"tests/resources/models/apiTooManyRequestsException.json",
15641564
StatusCode::TOO_MANY_REQUESTS,
15651565
None,
15661566
);
@@ -1582,7 +1582,7 @@ mod tests {
15821582
#[tokio::test]
15831583
async fn test_api_unknown_error() {
15841584
let client = app_store_server_api_client_with_body_from_file(
1585-
"resources/models/apiUnknownError.json",
1585+
"tests/resources/models/apiUnknownError.json",
15861586
StatusCode::BAD_REQUEST,
15871587
None,
15881588
);
@@ -1607,7 +1607,7 @@ mod tests {
16071607
#[tokio::test]
16081608
async fn test_decoding_with_unknown_enum_value() {
16091609
let client = app_store_server_api_client_with_body_from_file(
1610-
"resources/models/transactionHistoryResponseWithMalformedEnvironment.json",
1610+
"tests/resources/models/transactionHistoryResponseWithMalformedEnvironment.json",
16111611
StatusCode::OK,
16121612
None,
16131613
);
@@ -1633,7 +1633,7 @@ mod tests {
16331633
#[tokio::test]
16341634
async fn test_decoding_with_malformed_json() {
16351635
let client = app_store_server_api_client_with_body_from_file(
1636-
"resources/models/transactionHistoryResponseWithMalformedAppAppleId.json",
1636+
"tests/resources/models/transactionHistoryResponseWithMalformedAppAppleId.json",
16371637
StatusCode::OK,
16381638
None,
16391639
);
@@ -1735,7 +1735,7 @@ mod tests {
17351735
#[tokio::test]
17361736
async fn test_get_notification_history_with_microsecond_values() {
17371737
let client = app_store_server_api_client_with_body_from_file(
1738-
"resources/models/getNotificationHistoryResponse.json",
1738+
"tests/resources/models/getNotificationHistoryResponse.json",
17391739
StatusCode::OK,
17401740
Some(|_req, body| {
17411741
let decoded_json: HashMap<String, Value> = serde_json::from_slice(body.unwrap()).unwrap();
@@ -1770,7 +1770,7 @@ mod tests {
17701770
// This test ensures we don't accidentally allow it in the future
17711771
// Note: In Rust, we handle this at compile time with the Environment enum,
17721772
// but we can test that LocalTesting environment (which maps to Xcode in some contexts) works
1773-
let key = fs::read("resources/certs/testSigningKey.p8").expect("Failed to read file");
1773+
let key = fs::read("tests/resources/certs/testSigningKey.p8").expect("Failed to read file");
17741774

17751775
// LocalTesting environment should work (it's our equivalent of Xcode for testing)
17761776
let client = AppStoreServerAPIClient::new(
@@ -1806,7 +1806,7 @@ mod tests {
18061806
status: http::StatusCode,
18071807
request_verifier: Option<RequestVerifier>,
18081808
) -> AppStoreServerAPIClient {
1809-
let key = fs::read("resources/certs/testSigningKey.p8").expect("Failed to read file");
1809+
let key = fs::read("tests/resources/certs/testSigningKey.p8").expect("Failed to read file");
18101810

18111811
let request_overrider = move |req: &reqwest::Request, request_body: Option<&[u8]>| {
18121812
if let Some(request_verifier) = request_verifier {

0 commit comments

Comments
 (0)