-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HDXDSYS-683 Remove any timezone information in iso formatted data (#67)
Fix for timezone incorrectly being in iso formatted strings
- Loading branch information
Showing
11 changed files
with
124 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import copy | ||
import re | ||
|
||
from . import resource_data | ||
from hdx.data.filestore_helper import FilestoreHelper | ||
from hdx.data.resource import Resource | ||
|
||
|
||
class TestFilestoreHelper: | ||
def test_dataset_update_filestore_resource(self, configuration): | ||
resource_data_copy = copy.deepcopy(resource_data) | ||
resource = Resource(resource_data_copy) | ||
filestore_resources = {} | ||
FilestoreHelper.dataset_update_filestore_resource( | ||
resource, filestore_resources, 0 | ||
) | ||
assert resource == { | ||
"api_type": "api", | ||
"description": "My Resource", | ||
"format": "xlsx", | ||
"name": "MyResource1", | ||
"package_id": "6f36a41c-f126-4b18-aaaf-6c2ddfbc5d4d", | ||
"resource_type": "api", | ||
"url": "http://test/spreadsheet.xlsx", | ||
} | ||
assert filestore_resources == {} | ||
|
||
resource.set_file_to_upload("test") | ||
FilestoreHelper.dataset_update_filestore_resource( | ||
resource, filestore_resources, 0 | ||
) | ||
assert resource == { | ||
"api_type": "api", | ||
"description": "My Resource", | ||
"format": "xlsx", | ||
"name": "MyResource1", | ||
"package_id": "6f36a41c-f126-4b18-aaaf-6c2ddfbc5d4d", | ||
"resource_type": "api", | ||
"url": "updated_by_file_upload_step", | ||
} | ||
assert filestore_resources == {0: "test"} | ||
|
||
resource.mark_data_updated() | ||
FilestoreHelper.dataset_update_filestore_resource( | ||
resource, filestore_resources, 0 | ||
) | ||
regex = r"^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.\d\d\d\d\d\d$" | ||
assert re.match(regex, resource["last_modified"]) | ||
assert filestore_resources == {0: "test"} |
Oops, something went wrong.