Skip to content

Commit

Permalink
Make unit test for checking authentic file also check path
Browse files Browse the repository at this point in the history
  • Loading branch information
eriknellessen authored and Erik Nellessen committed Jan 18, 2022
1 parent 914626c commit f67422d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ build:
stage: build
script:
- cd build
- cmake ..
- GPG_KEY_FINGERPRINT=0102030405060708090A0B0C0D0E0F1011121314 cmake ..
- make install

artifacts:
Expand Down
10 changes: 6 additions & 4 deletions fuseecs/configuration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ sed -i '/#define ACCESS_USER_ID /c\#define ACCESS_USER_ID '`echo $UID` configura
sed -i '/#define MOUNTPOINT_DIRECTORY \"\"/c\#define MOUNTPOINT_DIRECTORY \"'$MOUNTPOINT'\"' configuration.h
sed -i '/#define ROOT_DIRECTORY \"\"/c\#define ROOT_DIRECTORY \"'$ENCRYPTED_DIRECTORY'\"' configuration.h
sed -i '/#define DECRYPTED_DIRECTORY \"\"/c\#define DECRYPTED_DIRECTORY \"'$DECRYPTED_DIRECTORY'\"' configuration.h
printf "Listing keys:\n"
gpg2 --list-secret-keys
read -p "Please copy and paste your key's fingerprint: " GPG_KEY_FINGERPRINT
if [[ -z "${GPG_KEY_FINGERPRINT}" ]]; then
printf "Listing keys:\n"
gpg2 --list-secret-keys
read -p "Please copy and paste your key's fingerprint: " GPG_KEY_FINGERPRINT
fi
sed -i '/#define OWN_PUBLIC_KEY_FINGERPRINT \"\"/c\#define OWN_PUBLIC_KEY_FINGERPRINT \"'$GPG_KEY_FINGERPRINT'\"' configuration.h
printf "Configuring configuration.h done.\n"
printf "Configuring configuration.h done.\n"
2 changes: 2 additions & 0 deletions fuseecs/test/gpg_operations_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ int __wrap_access(const char *pathname, int how) {
return __real_access(pathname, how);
}

check_expected(pathname);
return mock_type(int);
}

static void test_directory_contains_authentic_file(void **state) {
expect_string(__wrap_access, pathname, "/foo/bar.txt0102030405060708090A0B0C0D0E0F1011121314.gpg");
will_return(__wrap_access, 1);

char *encrypted_directory = "/foo/";
Expand Down

0 comments on commit f67422d

Please sign in to comment.