OLD | NEW |
(Empty) | |
| 1 #!/bin/bash |
| 2 |
| 3 ## Include utility functions. |
| 4 . "$XDG_TEST_DIR/include/testassertions.sh" |
| 5 . "$XDG_TEST_DIR/include/testcontrol.sh" |
| 6 |
| 7 ## Test function |
| 8 test_user_mime_uninstall() { |
| 9 # TODO: should follow the filename tests. |
| 10 QUERY_FILE="testfile.xdgtest" |
| 11 |
| 12 ## Begin the test. |
| 13 test_start "$FUNCNAME: uninstall user mime type" |
| 14 test_purpose "Verify that mime types get removed from the user space correctly." |
| 15 |
| 16 # Dependencies section |
| 17 test_init |
| 18 |
| 19 require_notroot |
| 20 |
| 21 use_file "$XDG_TEST_DIR/xdg-mime/data/testmime.xml" INPUT_FILE |
| 22 edit_file "$INPUT_FILE" "x-xdg-testpattern" TEST_MIME "x-$XDG_TEST_ID" |
| 23 assert_file "$INPUT_FILE" |
| 24 echo "text/$TEST_MIME" >testmime.expected |
| 25 |
| 26 echo "Some text." >testfile.xdgtest |
| 27 assert_file testfile.xdgtest |
| 28 |
| 29 assert_exit 0 xdg-mime query filetype testfile.xdgtest |
| 30 assert_stdout |
| 31 mv out.stdout origmime.save |
| 32 |
| 33 # Install & verify mime type is installed |
| 34 assert_exit 0 xdg-mime install --mode user "$INPUT_FILE" |
| 35 assert_exit 0 xdg-mime query filetype testfile.xdgtest |
| 36 assert_stdout testmime.expected |
| 37 |
| 38 # Test steps section |
| 39 test_procedure |
| 40 |
| 41 assert_exit 0 xdg-mime uninstall --mode user "$INPUT_FILE" |
| 42 assert_nostdout |
| 43 assert_nostderr |
| 44 |
| 45 ## Verify uninstall |
| 46 assert_exit 0 xdg-mime query filetype $QUERY_FILE |
| 47 assert_stdout origmime.save |
| 48 |
| 49 test_result |
| 50 } |
| 51 run_test test_user_mime_uninstall |
OLD | NEW |