Commit Graph

1095 Commits (45d3020518bb97b67235d5e41a9ea5d032450b42)

Author SHA1 Message Date
Richard Piazza f3526bbfa6 flakey5 2018-12-07 14:06:36 -05:00
Richard Piazza 55ac3564bd flakey4 2018-12-07 14:03:46 -05:00
Richard Piazza 52c7d2a722 flakey3 2018-12-07 13:59:57 -05:00
Richard Piazza 3ea8035fcb flakey2 2018-12-07 13:47:44 -05:00
Richard Piazza da4a91a3ca flakey 2018-12-07 13:30:05 -05:00
Richard Piazza 03cceb827d add_visitor - take 2 2018-12-07 12:43:23 -05:00
Emmanuelle Vargas-Gonzalez 96b81fc489 pre-commit formatting changes 2018-12-06 15:19:50 -05:00
Emmanuelle Vargas-Gonzalez 01df0ccc57 Add new files for the test/v2X/stix2_data/ directory 2018-12-06 15:18:25 -05:00
Emmanuelle Vargas-Gonzalez bfa49ce37a Removed everything in test/v21/stix2_data/
Bring back optional version parameter to datastores. Update
documentation. Update v21 test suite
2018-12-06 15:11:30 -05:00
Emmanuelle Vargas-Gonzalez 3d099bec91 Merge branch 'master' of github.com:oasis-open/cti-python-stix2 into 1.1.0-release 2018-12-06 15:08:36 -05:00
Chris Lenk 522e9cedd0
Merge pull request #228 from chisholm/multi_version_filesystem_store
Multi version filesystem store, take 2
2018-12-03 07:29:07 -05:00
Emmanuelle Vargas-Gonzalez e1f7cc4028 change "Notes" for "Note" to keep visual effect in documentation 2018-11-30 09:39:05 -05:00
Emmanuelle Vargas-Gonzalez 7ee7352574
Update README.rst 2018-11-29 19:05:49 -05:00
Emmanuelle Vargas-Gonzalez f76de87f59
Update test_datastore_taxii.py
return the right bundle...
2018-11-29 18:45:34 -05:00
Emmanuelle Vargas-Gonzalez c62b9e92e7 revamp code in MockTAXIICollectionEndpoint, add more tests 2018-11-29 18:36:37 -05:00
Emmanuelle Vargas-Gonzalez 06716e3cfd remove redundant/unreachable code in core, add tests 2018-11-29 14:41:57 -05:00
Emmanuelle Vargas-Gonzalez aa649d4727 more pre-commit changes 2018-11-29 13:50:05 -05:00
Emmanuelle Vargas-Gonzalez f1490a98c8 remove full path from `constants` and fix directory resolution 2018-11-29 13:49:06 -05:00
Emmanuelle Vargas-Gonzalez 63c22aba99 fix path issues related to memory datastore 2018-11-29 12:17:26 -05:00
Emmanuelle Vargas-Gonzalez 6e9312efb7 fix test memory datastore teardown 2018-11-29 11:48:14 -05:00
Emmanuelle Vargas-Gonzalez 1b0fa0129f pre-commit changes 2018-11-29 11:06:27 -05:00
Emmanuelle Vargas-Gonzalez e365de3693 update setup.py information 2018-11-29 10:53:54 -05:00
Emmanuelle Vargas-Gonzalez 7f3a8b6c80 more tests to improve coverage 2018-11-29 10:27:13 -05:00
Emmanuelle Vargas-Gonzalez 6f897bc91d small enhancements, fix property for TLPMarking 2018-11-29 10:26:20 -05:00
Emmanuelle Vargas-Gonzalez 79c9d85072 make Memory datastore return path where data was saved to 2018-11-29 10:25:15 -05:00
Emmanuelle Vargas-Gonzalez 682e90ccaa expose the confidence methods via `stix2.scales.<method>` 2018-11-28 17:17:05 -05:00
Emmanuelle Vargas-Gonzalez ee14a116bd add new .rst documentation files 2018-11-28 17:03:02 -05:00
Emmanuelle Vargas-Gonzalez e896812754 minor code changes 2018-11-28 16:51:35 -05:00
Emmanuelle Vargas-Gonzalez 71a2aa2611 update project documentation. 2018-11-28 16:51:00 -05:00
Emmanuelle Vargas-Gonzalez 97a21c3064 my precious tables gone :( 2018-11-28 15:34:48 -05:00
Emmanuelle Vargas-Gonzalez c3031a0282 fix typo on DNI scale 2018-11-28 11:28:26 -05:00
Emmanuelle Vargas-Gonzalez aaddeb8b97 Merge branch 'master' of github.com:oasis-open/cti-python-stix2 into 1.1.0-release 2018-11-28 11:21:27 -05:00
Emmanuelle Vargas-Gonzalez e8b5ecc0de download badge is back! 2018-11-28 09:31:17 -05:00
Emmanuelle Vargas-Gonzalez 7aad97307e use stix2 version to update documentation 2018-11-28 09:20:26 -05:00
Michael Chisholm 17970a3faa Fixed a couple filter tests.
- a length check should come before the access, so you can verify
whether the access will succeed.

- Also removed some tests which can't work, due to the filter
changes.  In fact, a lot of these tests should probably be
removed or changed if we want to disallow running
apply_common_filters() on plain dicts.  They will often
coincidentally still succeed though, so I left them in.
2018-11-27 18:42:51 -05:00
Michael Chisholm 3a2f247f68 Fixed my own brainfart with converting string filter values to
datetimes: I'd converted the object property instead of the
filter value! :-P

Also, I fixed filter validation: it was checking for exact types
of the filter values and disallowing subtypes.  This library
includes a datetime subtype named STIXdatetime, and this type
should be usable as a filter value too.  So we need to allow
subtypes.
2018-11-27 18:38:55 -05:00
Michael Chisholm f57b9c34ef Add a newline to the end of a file 2018-11-27 17:58:01 -05:00
Michael Chisholm 18ff6f6094 Import cleanup to satisfy tox checks 2018-11-27 17:52:38 -05:00
Michael Chisholm 3adf7800a8 Changed how filters work, with respect to datetime objects.
Timestamp properties can now be checked against filter values
which are either strings or datetime objects, using datetime
semantics (previously, it reduced to a string compare).
If a stix object property is datetime-valued and the filter
value is a string, the string is parsed to a datetime object,
rather than the other way around.

Filtering in the filesystem store now parses JSON dicts to
_STIXBase objects before applying the filters.

Due to the parsing change, bad JSON content can produce a
different kind of error, so I had to change one of the tests.
2018-11-27 17:36:17 -05:00
Michael Chisholm d8a775c60d Fix some more improper exception re-raises in the filesystem
datastore test suite.  Add a new test corpus file, located so
as to test the backward compatibility functionality of
FileSystemSource.  Add a test to the suite which ensures that
this new file is found.
2018-11-27 15:24:09 -05:00
Michael Chisholm 63166ab256 Add some backward-compatibility to filesystem store: versioned
objects are searched for as ID-named json files in the type
directories, in addition to timestamp-named files in ID
directories.

Made a bugfix: fixed improper exception re-raises

Made an efficiency improvement: don't stat() files in
_get_matching_dir_entries() if no st_mode_test callable is given.
2018-11-27 15:24:09 -05:00
Michael Chisholm f615161110 Added some tests for adding markings to sinks and stores. 2018-11-27 15:24:08 -05:00
Michael Chisholm da13882eec Fix FileSystemSource.get() to not look for the latest version of
an object when markings are queried, since markings are not
versioned.
2018-11-27 15:24:08 -05:00
Michael Chisholm 0cecbeb9d8 Ran trailing-whitespace pre-commit hook. It changed a bunch of
files, in ways we don't completely understand...
2018-11-27 15:24:08 -05:00
Michael Chisholm 0a8ff2ab2e Add some newer versions of a couple of object IDs in the stix2
test data corpus.  Updated filesystem store tests accordingly:
- Remove comments from all_versions tests stating that multiple
  versions are not supported.  Improve the tests to ensure that
  all versions are in fact retrieved.
- Update the get() test to assure that it gets only the latest
  version, when there is more than one version.
- Update some count checks, since there are more objects now
- Fix some typos
2018-11-27 15:24:07 -05:00
Michael Chisholm 2b983368e5 Fix an indexing error which caused FileSystemSource.get() to return
the oldest object instead of the newest.
2018-11-27 15:24:07 -05:00
Michael Chisholm 9693c16cd1 Adjust import order to satisfy tox import check 2018-11-27 15:24:07 -05:00
Michael Chisholm 428a18ded2 Implemented clenk's suggested changes in multi-version filesystem
store:
- Use utils.get_type_from_id() instead of my own (I didn't know it
  was already there)
- Use dict-style instead of attribute-style access to get stix
  object properties
- Convert timezone-aware timestamps to UTC in _timestamp2filename()
  to ensure that different times always result in different
  filenames.

Also added a couple new tests for _timestamp2filename(), which
exercises the timezone conversion code.
2018-11-27 15:24:07 -05:00
Michael Chisholm 461e8bd5cb Removed the old FileSystemSource.query method. I'd renamed it
"query2" and forgot about it and left it there...
2018-11-27 15:24:07 -05:00
Michael Chisholm 0096835cfc Add multi-version support to the filesystem datastore.
Factored out the _is_marking() function from the memory datastore
module to utils so it can be reused, and changed both filesystem
and memory datastore modules to import and use it.
2018-11-27 15:24:07 -05:00